ath9k: add MAC revision detection for AR9330
authorGabor Juhos <juhosg@openwrt.org>
Tue, 21 Jun 2011 09:23:23 +0000 (11:23 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 22 Jun 2011 20:09:49 +0000 (16:09 -0400)
The AR9330 1.0 and 1.1 are using the same revision,
thus it is not possible to distinguish the two chips.
The platform setup code can distinguish the chips based
on the SoC revision.

Add a callback function to ath9k_platform_data in order
to allow getting the revision number from the platform code.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/hw.h
drivers/net/wireless/ath/ath9k/init.c
include/linux/ath9k_platform.h

index a3881b64f76674c595569f53357b063f90a4a394..9840e00510842ec4467da8e4e502b09050963f89 100644 (file)
@@ -251,6 +251,15 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah)
        case AR5416_AR9100_DEVID:
                ah->hw_version.macVersion = AR_SREV_VERSION_9100;
                break;
+       case AR9300_DEVID_AR9330:
+               ah->hw_version.macVersion = AR_SREV_VERSION_9330;
+               if (ah->get_mac_revision) {
+                       ah->hw_version.macRev = ah->get_mac_revision();
+               } else {
+                       val = REG_READ(ah, AR_SREV);
+                       ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
+               }
+               return;
        case AR9300_DEVID_AR9340:
                ah->hw_version.macVersion = AR_SREV_VERSION_9340;
                val = REG_READ(ah, AR_SREV);
index 14c5857a020c2969683455eb225bcba5db0ebb43..0749fa8c3a589ced6e0b9bbabecef76094323152 100644 (file)
@@ -862,6 +862,7 @@ struct ath_hw {
        u32 ent_mode;
 
        bool is_clk_25mhz;
+       int (*get_mac_revision)(void);
 };
 
 struct ath_bus_ops {
index d4b166cfdf6047935b6faad502ef59fae2f1d64a..661211291773f227e508e3d15e7536bf14bbf55b 100644 (file)
@@ -574,6 +574,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
                sc->sc_ah->gpio_val = pdata->gpio_val;
                sc->sc_ah->led_pin = pdata->led_pin;
                ah->is_clk_25mhz = pdata->is_clk_25mhz;
+               ah->get_mac_revision = pdata->get_mac_revision;
        }
 
        common = ath9k_hw_common(ah);
index 60a7c49dcb49f8f3b526a2234e109b1c5d822edb..c207607acada48a6763aa88fea889fa2fc749e0e 100644 (file)
@@ -30,6 +30,7 @@ struct ath9k_platform_data {
        u32 gpio_val;
 
        bool is_clk_25mhz;
+       int (*get_mac_revision)(void);
 };
 
 #endif /* _LINUX_ATH9K_PLATFORM_H */