SOURCES (LINUX_2_6_20): kernel-bcm43xx-combined_2.6.20.2.patch (NE...
matkor
matkor at pld-linux.org
Sun Mar 11 16:46:29 CET 2007
Author: matkor Date: Sun Mar 11 15:46:29 2007 GMT
Module: SOURCES Tag: LINUX_2_6_20
---- Log message:
- Rel 0.2. Updated bcm43xx patch to recent version.
---- Files affected:
SOURCES:
kernel-bcm43xx-combined_2.6.20.2.patch (NONE -> 1.1) (NEW), kernel-bcm43xx-2.6.20_combined.patch (1.1.2.1 -> NONE) (REMOVED)
---- Diffs:
================================================================
Index: SOURCES/kernel-bcm43xx-combined_2.6.20.2.patch
diff -u /dev/null SOURCES/kernel-bcm43xx-combined_2.6.20.2.patch:1.1
--- /dev/null Sun Mar 11 16:46:29 2007
+++ SOURCES/kernel-bcm43xx-combined_2.6.20.2.patch Sun Mar 11 16:46:24 2007
@@ -0,0 +1,1192 @@
+A number of the calls in the initialization routines fail to check the returned value for
+errors. This patch adds the necessary checks and logs any errors found when appropriate.
+
+Signed-off-by: Larry Finger <Larry.Finger at lwfinger.net>
+---
+
+To be applied to wireless-2.6.
+
+
+A number of the calls in the initialization routines fail to check the returned value for
+errors. This patch adds the necessary checks and logs any errors found when appropriate.
+
+Signed-off-by: Larry Finger <Larry.Finger at lwfinger.net>
+---
+
+To be applied to wireless-2.6.
+
+
+Index: linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+===================================================================
+--- linux-2.6.20.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
++++ linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+@@ -3679,7 +3679,7 @@ static int bcm43xx_read_phyinfo(struct b
+ {
+ struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
+ u16 value;
+- u8 phy_version;
++ u8 phy_analog;
+ u8 phy_type;
+ u8 phy_rev;
+ int phy_rev_ok = 1;
+@@ -3687,12 +3687,12 @@ static int bcm43xx_read_phyinfo(struct b
+
+ value = bcm43xx_read16(bcm, BCM43xx_MMIO_PHY_VER);
+
+- phy_version = (value & 0xF000) >> 12;
++ phy_analog = (value & 0xF000) >> 12;
+ phy_type = (value & 0x0F00) >> 8;
+ phy_rev = (value & 0x000F);
+
+- dprintk(KERN_INFO PFX "Detected PHY: Version: %x, Type %x, Revision %x\n",
+- phy_version, phy_type, phy_rev);
++ dprintk(KERN_INFO PFX "Detected PHY: Analog: %x, Type %x, Revision %x\n",
++ phy_analog, phy_type, phy_rev);
+
+ switch (phy_type) {
+ case BCM43xx_PHYTYPE_A:
+@@ -3735,7 +3735,7 @@ static int bcm43xx_read_phyinfo(struct b
+ phy_rev);
+ }
+
+- phy->version = phy_version;
++ phy->analog = phy_analog;
+ phy->type = phy_type;
+ phy->rev = phy_rev;
+ if ((phy_type == BCM43xx_PHYTYPE_B) || (phy_type == BCM43xx_PHYTYPE_G)) {
+@@ -4258,6 +4258,7 @@ static int bcm43xx_resume(struct pci_dev
+ {
+ struct net_device *net_dev = pci_get_drvdata(pdev);
+ struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
++ struct ieee80211softmac_device *mac = ieee80211_priv(net_dev);
+ int err = 0;
+
+ dprintk(KERN_INFO PFX "Resuming...\n");
+@@ -4279,6 +4280,9 @@ static int bcm43xx_resume(struct pci_dev
+ }
+ netif_device_attach(net_dev);
+
++ if (mac->associnfo.associated)
++ ieee80211softmac_try_reassoc(mac);
++
+ dprintk(KERN_INFO PFX "Device resumed.\n");
+
+ return 0;
+Index: linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+===================================================================
+--- linux-2.6.20.orig/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
++++ linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+@@ -145,16 +145,14 @@ dma_addr_t map_descbuffer(struct bcm43xx
+ int tx)
+ {
+ dma_addr_t dmaaddr;
++ int direction = PCI_DMA_FROMDEVICE;
+
+- if (tx) {
+- dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev,
+- buf, len,
+- DMA_TO_DEVICE);
+- } else {
+- dmaaddr = dma_map_single(&ring->bcm->pci_dev->dev,
++ if (tx)
++ direction = PCI_DMA_TODEVICE;
++
++ dmaaddr = pci_map_single(ring->bcm->pci_dev,
+ buf, len,
+- DMA_FROM_DEVICE);
+- }
++ direction);
+
+ return dmaaddr;
+ }
+@@ -166,13 +164,13 @@ void unmap_descbuffer(struct bcm43xx_dma
+ int tx)
+ {
+ if (tx) {
+- dma_unmap_single(&ring->bcm->pci_dev->dev,
++ pci_unmap_single(ring->bcm->pci_dev,
+ addr, len,
+- DMA_TO_DEVICE);
++ PCI_DMA_TODEVICE);
+ } else {
+- dma_unmap_single(&ring->bcm->pci_dev->dev,
++ pci_unmap_single(ring->bcm->pci_dev,
+ addr, len,
+- DMA_FROM_DEVICE);
++ PCI_DMA_FROMDEVICE);
+ }
+ }
+
+@@ -183,8 +181,8 @@ void sync_descbuffer_for_cpu(struct bcm4
+ {
+ assert(!ring->tx);
+
+- dma_sync_single_for_cpu(&ring->bcm->pci_dev->dev,
+- addr, len, DMA_FROM_DEVICE);
++ pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
++ addr, len, PCI_DMA_FROMDEVICE);
+ }
+
+ static inline
+@@ -194,8 +192,8 @@ void sync_descbuffer_for_device(struct b
+ {
+ assert(!ring->tx);
+
+- dma_sync_single_for_device(&ring->bcm->pci_dev->dev,
+- addr, len, DMA_FROM_DEVICE);
++ pci_dma_sync_single_for_cpu(ring->bcm->pci_dev,
++ addr, len, PCI_DMA_TODEVICE);
+ }
+
+ /* Unmap and free a descriptor buffer. */
+@@ -214,17 +212,53 @@ void free_descriptor_buffer(struct bcm43
+
+ static int alloc_ringmemory(struct bcm43xx_dmaring *ring)
+ {
+- struct device *dev = &(ring->bcm->pci_dev->dev);
+-
+- ring->descbase = dma_alloc_coherent(dev, BCM43xx_DMA_RINGMEMSIZE,
+- &(ring->dmabase), GFP_KERNEL);
++ ring->descbase = pci_alloc_consistent(ring->bcm->pci_dev, BCM43xx_DMA_RINGMEMSIZE,
++ &(ring->dmabase));
+ if (!ring->descbase) {
+- printk(KERN_ERR PFX "DMA ringmemory allocation failed\n");
+- return -ENOMEM;
++ /* Allocation may have failed due to pci_alloc_consistent
++ insisting on use of GFP_DMA, which is more restrictive
++ than necessary... */
++ struct dma_desc *rx_ring;
++ dma_addr_t rx_ring_dma;
++
++ rx_ring = kzalloc(BCM43xx_DMA_RINGMEMSIZE, GFP_KERNEL);
++ if (!rx_ring)
++ goto out_err;
++
++ rx_ring_dma = pci_map_single(ring->bcm->pci_dev, rx_ring,
++ BCM43xx_DMA_RINGMEMSIZE,
++ PCI_DMA_BIDIRECTIONAL);
++
++ if (pci_dma_mapping_error(rx_ring_dma) ||
++ rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
++ /* Sigh... */
++ if (!pci_dma_mapping_error(rx_ring_dma))
++ pci_unmap_single(ring->bcm->pci_dev,
++ rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
++ PCI_DMA_BIDIRECTIONAL);
++ rx_ring_dma = pci_map_single(ring->bcm->pci_dev,
++ rx_ring, BCM43xx_DMA_RINGMEMSIZE,
++ PCI_DMA_BIDIRECTIONAL);
++ if (pci_dma_mapping_error(rx_ring_dma) ||
++ rx_ring_dma + BCM43xx_DMA_RINGMEMSIZE > ring->bcm->dma_mask) {
++ assert(0);
++ if (!pci_dma_mapping_error(rx_ring_dma))
++ pci_unmap_single(ring->bcm->pci_dev,
++ rx_ring_dma, BCM43xx_DMA_RINGMEMSIZE,
++ PCI_DMA_BIDIRECTIONAL);
++ goto out_err;
++ }
++ }
++
++ ring->descbase = rx_ring;
++ ring->dmabase = rx_ring_dma;
+ }
+ memset(ring->descbase, 0, BCM43xx_DMA_RINGMEMSIZE);
+
+ return 0;
++out_err:
++ printk(KERN_ERR PFX "DMA ringmemory allocation failed\n");
++ return -ENOMEM;
+ }
+
+ static void free_ringmemory(struct bcm43xx_dmaring *ring)
+@@ -407,6 +441,29 @@ static int setup_rx_descbuffer(struct bc
+ if (unlikely(!skb))
+ return -ENOMEM;
+ dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
++ /* This hardware bug work-around adapted from the b44 driver.
++ The chip may be unable to do PCI DMA to/from anything above 1GB */
++ if (pci_dma_mapping_error(dmaaddr) ||
++ dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
++ /* This one has 30-bit addressing... */
++ if (!pci_dma_mapping_error(dmaaddr))
++ pci_unmap_single(ring->bcm->pci_dev,
++ dmaaddr, ring->rx_buffersize,
++ PCI_DMA_FROMDEVICE);
++ dev_kfree_skb_any(skb);
++ skb = __dev_alloc_skb(ring->rx_buffersize,GFP_DMA);
++ if (skb == NULL)
++ return -ENOMEM;
++ dmaaddr = pci_map_single(ring->bcm->pci_dev,
++ skb->data, ring->rx_buffersize,
++ PCI_DMA_FROMDEVICE);
++ if (pci_dma_mapping_error(dmaaddr) ||
++ dmaaddr + ring->rx_buffersize > ring->bcm->dma_mask) {
++ assert(0);
++ dev_kfree_skb_any(skb);
++ return -ENOMEM;
++ }
++ }
+ meta->skb = skb;
+ meta->dmaaddr = dmaaddr;
+ skb->dev = ring->bcm->net_dev;
+@@ -636,8 +693,10 @@ struct bcm43xx_dmaring * bcm43xx_setup_d
+ err = dmacontroller_setup(ring);
+ if (err)
+ goto err_free_ringmemory;
++ return ring;
+
+ out:
++ printk(KERN_ERR PFX "Error in bcm43xx_setup_dmaring\n");
+ return ring;
+
+ err_free_ringmemory:
+@@ -705,30 +764,16 @@ int bcm43xx_dma_init(struct bcm43xx_priv
+ struct bcm43xx_dmaring *ring;
+ int err = -ENOMEM;
+ int dma64 = 0;
+- u64 mask = bcm43xx_get_supported_dma_mask(bcm);
+- int nobits;
+
+- if (mask == DMA_64BIT_MASK) {
++ bcm->dma_mask = bcm43xx_get_supported_dma_mask(bcm);
++ if (bcm->dma_mask == DMA_64BIT_MASK)
+ dma64 = 1;
+- nobits = 64;
+- } else if (mask == DMA_32BIT_MASK)
+- nobits = 32;
+- else
+- nobits = 30;
+- err = pci_set_dma_mask(bcm->pci_dev, mask);
+- err |= pci_set_consistent_dma_mask(bcm->pci_dev, mask);
+- if (err) {
+-#ifdef CONFIG_BCM43XX_PIO
+- printk(KERN_WARNING PFX "DMA not supported on this device."
+- " Falling back to PIO.\n");
+- bcm->__using_pio = 1;
+- return -ENOSYS;
+-#else
+- printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
+- "Please recompile the driver with PIO support.\n");
+- return -ENODEV;
+-#endif /* CONFIG_BCM43XX_PIO */
+- }
++ err = pci_set_dma_mask(bcm->pci_dev, bcm->dma_mask);
++ if (err)
++ goto no_dma;
++ err = pci_set_consistent_dma_mask(bcm->pci_dev, bcm->dma_mask);
++ if (err)
++ goto no_dma;
+
+ /* setup TX DMA channels. */
+ ring = bcm43xx_setup_dmaring(bcm, 0, 1, dma64);
+@@ -774,9 +819,12 @@ int bcm43xx_dma_init(struct bcm43xx_priv
+ dma->rx_ring3 = ring;
+ }
+
+- dprintk(KERN_INFO PFX "%d-bit DMA initialized\n", nobits);
++ dprintk(KERN_INFO PFX "%d-bit DMA initialized\n",
++ (bcm->dma_mask == DMA_64BIT_MASK) ? 64 :
++ (bcm->dma_mask == DMA_32BIT_MASK) ? 32 : 30);
+ err = 0;
+ out:
++ if(err)BUG();
+ return err;
+
+ err_destroy_rx0:
+@@ -800,7 +848,18 @@ err_destroy_tx1:
+ err_destroy_tx0:
+ bcm43xx_destroy_dmaring(dma->tx_ring0);
+ dma->tx_ring0 = NULL;
+- goto out;
++no_dma:
++#ifdef CONFIG_BCM43XX_PIO
++ printk(KERN_WARNING PFX "DMA not supported on this device."
++ " Falling back to PIO.\n");
++ bcm->__using_pio = 1;
++ BUG();
++ return -ENOSYS;
++#else
++ printk(KERN_ERR PFX "FATAL: DMA not supported and PIO not configured. "
++ "Please recompile the driver with PIO support.\n");
++ return -ENODEV;
++#endif /* CONFIG_BCM43XX_PIO */
+ }
+
+ /* Generate a cookie for the TX header. */
+@@ -905,6 +964,7 @@ static void dma_tx_fragment(struct bcm43
+ struct bcm43xx_dmadesc_generic *desc;
+ struct bcm43xx_dmadesc_meta *meta;
+ dma_addr_t dmaaddr;
++ struct sk_buff *bounce_skb;
+
+ assert(skb_shinfo(skb)->nr_frags == 0);
+
+@@ -924,9 +984,28 @@ static void dma_tx_fragment(struct bcm43
+ skb->len - sizeof(struct bcm43xx_txhdr),
+ (cur_frag == 0),
+ generate_cookie(ring, slot));
++ dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
++ if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
++ /* chip cannot handle DMA to/from > 1GB, use bounce buffer (copied from b44 driver) */
++ if (!dma_mapping_error(dmaaddr))
++ unmap_descbuffer(ring, dmaaddr, skb->len, 1);
++ bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC|GFP_DMA);
++ if (!bounce_skb)
++ return;
++ dmaaddr = map_descbuffer(ring, bounce_skb->data, bounce_skb->len, 1);
++ if (dma_mapping_error(dmaaddr) || dmaaddr + skb->len > ring->bcm->dma_mask) {
++ if (!dma_mapping_error(dmaaddr))
++ unmap_descbuffer(ring, dmaaddr, skb->len, 1);
++ dev_kfree_skb_any(bounce_skb);
++ assert(0);
++ return;
++ }
++ memcpy(skb_put(bounce_skb, skb->len), skb->data, skb->len);
++ dev_kfree_skb_any(skb);
++ skb = bounce_skb;
++ }
+
+ meta->skb = skb;
+- dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
+ meta->dmaaddr = dmaaddr;
+
+ fill_descriptor(ring, desc, dmaaddr,
+Index: linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx.h
+===================================================================
+--- linux-2.6.20.orig/drivers/net/wireless/bcm43xx/bcm43xx.h
++++ linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx.h
+@@ -333,7 +333,7 @@
+ #define BCM43xx_SBF_PS2 0x04000000
+ #define BCM43xx_SBF_NO_SSID_BCAST 0x08000000
+ #define BCM43xx_SBF_TIME_UPDATE 0x10000000
+-#define BCM43xx_SBF_80000000 0x80000000 /*FIXME: fix name*/
++#define BCM43xx_SBF_MODE_G 0x80000000
+
+ /* Microcode */
+ #define BCM43xx_UCODE_REVISION 0x0000
+@@ -538,7 +538,7 @@ struct bcm43xx_lopair {
+
+ struct bcm43xx_phyinfo {
+ /* Hardware Data */
+- u8 version;
++ u8 analog;
+ u8 type;
+ u8 rev;
+ u16 antenna_diversity;
+@@ -766,6 +766,7 @@ struct bcm43xx_private {
+ * This is currently always BCM43xx_BUSTYPE_PCI
+ */
+ u8 bustype;
++ u64 dma_mask;
+
+ u16 board_vendor;
+ u16 board_type;
+Index: linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+===================================================================
+--- linux-2.6.20.orig/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
++++ linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+@@ -261,22 +261,22 @@ static int bcm43xx_wx_get_rangeparams(st
+ if (phy->type == BCM43xx_PHYTYPE_A ||
+ phy->type == BCM43xx_PHYTYPE_G) {
+ range->num_bitrates = 8;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB;
+- range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_12MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_18MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_24MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_36MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB * 500000;
++ range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB * 500000;
+ }
+ if (phy->type == BCM43xx_PHYTYPE_B ||
+ phy->type == BCM43xx_PHYTYPE_G) {
+ range->num_bitrates += 4;
+- range->bitrate[i++] = IEEE80211_CCK_RATE_1MB;
+- range->bitrate[i++] = IEEE80211_CCK_RATE_2MB;
+- range->bitrate[i++] = IEEE80211_CCK_RATE_5MB;
+- range->bitrate[i++] = IEEE80211_CCK_RATE_11MB;
++ range->bitrate[i++] = IEEE80211_CCK_RATE_1MB * 500000;
++ range->bitrate[i++] = IEEE80211_CCK_RATE_2MB * 500000;
++ range->bitrate[i++] = IEEE80211_CCK_RATE_5MB * 500000;
++ range->bitrate[i++] = IEEE80211_CCK_RATE_11MB * 500000;
+ }
+
+ geo = ieee80211_get_geo(bcm->ieee);
+@@ -286,7 +286,7 @@ static int bcm43xx_wx_get_rangeparams(st
+ if (j == IW_MAX_FREQUENCIES)
+ break;
+ range->freq[j].i = j + 1;
+- range->freq[j].m = geo->a[i].freq;//FIXME?
++ range->freq[j].m = geo->a[i].freq * 100000;
+ range->freq[j].e = 1;
+ j++;
+ }
+@@ -294,7 +294,7 @@ static int bcm43xx_wx_get_rangeparams(st
+ if (j == IW_MAX_FREQUENCIES)
+ break;
+ range->freq[j].i = j + 1;
+- range->freq[j].m = geo->bg[i].freq;//FIXME?
++ range->freq[j].m = geo->bg[i].freq * 100000;
+ range->freq[j].e = 1;
+ j++;
+ }
+Index: linux-2.6.20/net/ieee80211/ieee80211_tx.c
+===================================================================
+--- linux-2.6.20.orig/net/ieee80211/ieee80211_tx.c
++++ linux-2.6.20/net/ieee80211/ieee80211_tx.c
+@@ -502,9 +502,6 @@ int ieee80211_xmit(struct sk_buff *skb,
+ if (host_encrypt)
+ ieee80211_encrypt_fragment(ieee, skb_frag, hdr_len);
+ else if (host_build_iv) {
+- struct ieee80211_crypt_data *crypt;
+-
+- crypt = ieee->crypt[ieee->tx_keyidx];
+ atomic_inc(&crypt->refcnt);
+ if (crypt->ops->build_iv)
+ crypt->ops->build_iv(skb_frag, hdr_len,
+Index: linux-2.6.20/include/net/ieee80211softmac.h
+===================================================================
+--- linux-2.6.20.orig/include/net/ieee80211softmac.h
++++ linux-2.6.20/include/net/ieee80211softmac.h
+@@ -254,6 +254,7 @@ struct ieee80211softmac_device {
+ };
+
+ extern void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm);
++extern void ieee80211softmac_try_reassoc(struct ieee80211softmac_device *mac);
+
+ static inline void * ieee80211softmac_priv(struct net_device *dev)
+ {
+Index: linux-2.6.20/net/ieee80211/softmac/ieee80211softmac_assoc.c
+===================================================================
+--- linux-2.6.20.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c
++++ linux-2.6.20/net/ieee80211/softmac/ieee80211softmac_assoc.c
+@@ -441,6 +441,7 @@ ieee80211softmac_try_reassoc(struct ieee
+ schedule_delayed_work(&mac->associnfo.work, 0);
+ spin_unlock_irqrestore(&mac->lock, flags);
+ }
++EXPORT_SYMBOL_GPL(ieee80211softmac_try_reassoc);
+
+ int
+ ieee80211softmac_handle_disassoc(struct net_device * dev,
+Index: linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+===================================================================
+--- linux-2.6.20.orig/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
++++ linux-2.6.20/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+@@ -205,8 +205,8 @@ static void bcm43xx_phy_init_pctl(struct
+ (bcm->board_type == 0x0416))
+ return;
+
+- bcm43xx_write16(bcm, 0x03E6, bcm43xx_read16(bcm, 0x03E6) & 0xFFDF);
+ bcm43xx_phy_write(bcm, 0x0028, 0x8018);
++ bcm43xx_write16(bcm, 0x03E6, bcm43xx_read16(bcm, 0x03E6) & 0xFFDF);
+
+ if (phy->type == BCM43xx_PHYTYPE_G) {
+ if (!phy->connected)
+@@ -317,6 +317,13 @@ static void bcm43xx_phy_agcsetup(struct
+ bcm43xx_ilt_write(bcm, offset + 0x0801, 7);
+ bcm43xx_ilt_write(bcm, offset + 0x0802, 16);
+ bcm43xx_ilt_write(bcm, offset + 0x0803, 28);
++
++ if (phy->rev >= 6) {
++ bcm43xx_phy_write(bcm, 0x0426, (bcm43xx_phy_read(bcm, 0x0426)
++ & 0xFFFC));
++ bcm43xx_phy_write(bcm, 0x0426, (bcm43xx_phy_read(bcm, 0x0426)
++ & 0xEFFF));
++ }
+ }
+
+ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm)
+@@ -337,7 +344,7 @@ static void bcm43xx_phy_setupg(struct bc
+ for (i = 0; i < BCM43xx_ILT_NOISEG1_SIZE; i++)
+ bcm43xx_ilt_write(bcm, 0x1800 + i, bcm43xx_ilt_noiseg1[i]);
+ for (i = 0; i < BCM43xx_ILT_ROTOR_SIZE; i++)
+- bcm43xx_ilt_write(bcm, 0x2000 + i, bcm43xx_ilt_rotor[i]);
++ bcm43xx_ilt_write32(bcm, 0x2000 + i, bcm43xx_ilt_rotor[i]);
+ } else {
+ /* nrssi values are signed 6-bit values. Not sure why we write 0x7654 here... */
+ bcm43xx_nrssi_hw_write(bcm, 0xBA98, (s16)0x7654);
+@@ -377,7 +384,7 @@ static void bcm43xx_phy_setupg(struct bc
+
+ if (phy->rev == 1) {
+ for (i = 0; i < BCM43xx_ILT_RETARD_SIZE; i++)
+- bcm43xx_ilt_write(bcm, 0x2400 + i, bcm43xx_ilt_retard[i]);
++ bcm43xx_ilt_write32(bcm, 0x2400 + i, bcm43xx_ilt_retard[i]);
+ for (i = 0; i < 4; i++) {
+ bcm43xx_ilt_write(bcm, 0x5404 + i, 0x0020);
+ bcm43xx_ilt_write(bcm, 0x5408 + i, 0x0020);
+@@ -500,10 +507,10 @@ static void bcm43xx_phy_setupa(struct bc
+ for (i = 0; i < BCM43xx_ILT_NOISEA2_SIZE; i++)
+ bcm43xx_ilt_write(bcm, 0x1800 + i, bcm43xx_ilt_noisea2[i]);
+ for (i = 0; i < BCM43xx_ILT_ROTOR_SIZE; i++)
+- bcm43xx_ilt_write(bcm, 0x2000 + i, bcm43xx_ilt_rotor[i]);
++ bcm43xx_ilt_write32(bcm, 0x2000 + i, bcm43xx_ilt_rotor[i]);
+ bcm43xx_phy_init_noisescaletbl(bcm);
+ for (i = 0; i < BCM43xx_ILT_RETARD_SIZE; i++)
+- bcm43xx_ilt_write(bcm, 0x2400 + i, bcm43xx_ilt_retard[i]);
++ bcm43xx_ilt_write32(bcm, 0x2400 + i, bcm43xx_ilt_retard[i]);
+ break;
+ case 3:
+ for (i = 0; i < 64; i++)
+@@ -729,19 +736,19 @@ static void bcm43xx_phy_initb5(struct bc
+ struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
+ struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
+ u16 offset;
++ u16 value;
++ u8 old_channel;
+
+- if (phy->version == 1 &&
+- radio->version == 0x2050) {
++ if (phy->analog == 1)
+ bcm43xx_radio_write16(bcm, 0x007A,
+ bcm43xx_radio_read16(bcm, 0x007A)
+ | 0x0050);
+- }
+- if ((bcm->board_vendor != PCI_VENDOR_ID_BROADCOM) &&
+- (bcm->board_type != 0x0416)) {
++ if (!(bcm->board_vendor == PCI_VENDOR_ID_BROADCOM &&
++ bcm->board_type == 0x0416)) {
++ value = 0x2120;
+ for (offset = 0x00A8 ; offset < 0x00C7; offset++) {
+- bcm43xx_phy_write(bcm, offset,
+- (bcm43xx_phy_read(bcm, offset) + 0x2020)
+- & 0x3F3F);
++ bcm43xx_phy_write(bcm, offset, value);
++ value += 0x0202;
+ }
+ }
+ bcm43xx_phy_write(bcm, 0x0035,
+@@ -776,7 +783,7 @@ static void bcm43xx_phy_initb5(struct bc
+ bcm43xx_phy_read(bcm, BCM43xx_PHY_RADIO_BITFIELD) | (1 << 11));
+ }
+
+- if (phy->version == 1 && radio->version == 0x2050) {
++ if (phy->analog == 1) {
+ bcm43xx_phy_write(bcm, 0x0026, 0xCE00);
+ bcm43xx_phy_write(bcm, 0x0021, 0x3763);
+ bcm43xx_phy_write(bcm, 0x0022, 0x1BC3);
+@@ -787,14 +794,15 @@ static void bcm43xx_phy_initb5(struct bc
+ bcm43xx_phy_write(bcm, 0x0030, 0x00C6);
+ bcm43xx_write16(bcm, 0x03EC, 0x3F22);
+
+- if (phy->version == 1 && radio->version == 0x2050)
++ if (phy->analog == 1)
+ bcm43xx_phy_write(bcm, 0x0020, 0x3E1C);
+ else
+ bcm43xx_phy_write(bcm, 0x0020, 0x301C);
+
+- if (phy->version == 0)
++ if (phy->analog == 0)
+ bcm43xx_write16(bcm, 0x03E4, 0x3000);
+
++ old_channel = radio->channel;
+ /* Force to channel 7, even if not supported. */
+ bcm43xx_radio_selectchannel(bcm, 7, 0);
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list