Pull ec into release branch
[pandora-kernel.git] / drivers / net / wireless / bcm43xx / bcm43xx_main.c
index 2e400aa..a38e7ee 100644 (file)
@@ -851,8 +851,6 @@ static int bcm43xx_sprom_extract(struct bcm43xx_private *bcm)
        value = sprom[BCM43xx_SPROM_ETHPHY];
        bcm->sprom.et0phyaddr = (value & 0x001F);
        bcm->sprom.et1phyaddr = (value & 0x03E0) >> 5;
-       bcm->sprom.et0mdcport = (value & (1 << 14)) >> 14;
-       bcm->sprom.et1mdcport = (value & (1 << 15)) >> 15;
 
        /* boardrev, antennas, locale */
        value = sprom[BCM43xx_SPROM_BOARDREV];
@@ -948,6 +946,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
        u8 channel;
        struct bcm43xx_phyinfo *phy;
        const char *iso_country;
+       u8 max_bg_channel;
 
        geo = kzalloc(sizeof(*geo), GFP_KERNEL);
        if (!geo)
@@ -969,6 +968,23 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
        }
        iso_country = bcm43xx_locale_iso(bcm->sprom.locale);
 
+/* set the maximum channel based on locale set in sprom or witle locale option */
+       switch (bcm->sprom.locale) {
+       case BCM43xx_LOCALE_THAILAND:
+       case BCM43xx_LOCALE_ISRAEL:
+       case BCM43xx_LOCALE_JORDAN:
+       case BCM43xx_LOCALE_USA_CANADA_ANZ:
+       case BCM43xx_LOCALE_USA_LOW:
+               max_bg_channel = 11;
+               break;
+       case BCM43xx_LOCALE_JAPAN:
+       case BCM43xx_LOCALE_JAPAN_HIGH:
+               max_bg_channel = 14;
+               break;
+       default:
+               max_bg_channel = 13;
+       }
+
        if (have_a) {
                for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL;
                      channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) {
@@ -980,7 +996,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
        }
        if (have_bg) {
                for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL;
-                     channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) {
+                     channel <= max_bg_channel; channel++) {
                        chan = &geo->bg[i++];
                        chan->freq = bcm43xx_channel_to_freq_bg(channel);
                        chan->channel = channel;
@@ -1449,12 +1465,10 @@ static void handle_irq_transmit_status(struct bcm43xx_private *bcm)
 
                bcm43xx_debugfs_log_txstat(bcm, &stat);
 
-               if (stat.flags & BCM43xx_TXSTAT_FLAG_IGNORE)
+               if (stat.flags & BCM43xx_TXSTAT_FLAG_AMPDU)
+                       continue;
+               if (stat.flags & BCM43xx_TXSTAT_FLAG_INTER)
                        continue;
-               if (!(stat.flags & BCM43xx_TXSTAT_FLAG_ACK)) {
-                       //TODO: packet was not acked (was lost)
-               }
-               //TODO: There are more (unknown) flags to test. see bcm43xx_main.h
 
                if (bcm43xx_using_pio(bcm))
                        bcm43xx_pio_handle_xmitstatus(bcm, &stat);
@@ -1862,9 +1876,6 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id)
 
        spin_lock(&bcm->irq_lock);
 
-       assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
-       assert(bcm->current_core->id == BCM43xx_COREID_80211);
-
        reason = bcm43xx_read32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON);
        if (reason == 0xffffffff) {
                /* irq not for us (shared irq) */
@@ -1875,6 +1886,9 @@ static irqreturn_t bcm43xx_interrupt_handler(int irq, void *dev_id)
        if (!reason)
                goto out;
 
+       assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
+       assert(bcm->current_core->id == BCM43xx_COREID_80211);
+
        bcm->dma_reason[0] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA0_REASON)
                             & 0x0001DC00;
        bcm->dma_reason[1] = bcm43xx_read32(bcm, BCM43xx_MMIO_DMA1_REASON)
@@ -2737,8 +2751,9 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
                                 * dangling pins on the second core. Be careful
                                 * and ignore these cores here.
                                 */
-                               if (bcm->pci_dev->device != 0x4324) {
-                                       dprintk(KERN_INFO PFX "Ignoring additional 802.11 core.\n");
+                               if (1 /*bcm->pci_dev->device != 0x4324*/ ) {
+                               /* TODO: A PHY */
+                                       dprintk(KERN_INFO PFX "Ignoring additional 802.11a core.\n");
                                        continue;
                                }
                        }
@@ -3696,7 +3711,7 @@ static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
 {
        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;
@@ -3704,12 +3719,12 @@ static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
 
        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:
@@ -3752,7 +3767,7 @@ static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
                       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)) {