ath5k: Identify RF2413 and deal with PHY_SPENDING
authorNick Kossifidis <mickflemm@gmail.com>
Thu, 28 Feb 2008 19:49:05 +0000 (14:49 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 7 Mar 2008 21:02:58 +0000 (16:02 -0500)
 * Attach RF2413.

 * Propertly handle different AR5K_PHY_SPENDING settings for each RF
chip by adding a field in ath5k_hw. This way we won't have to check
inside hw_reset (see next patch).

Changes-licensed-under: ISC
Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath5k/ath5k.h
drivers/net/wireless/ath5k/hw.c
drivers/net/wireless/ath5k/reg.h

index 25c8e989d700f0ac4bd93a5b227f61bdea8aa6b8..c0b65961f55f169847ef73223a5b6ea9ed975807 100644 (file)
@@ -966,6 +966,7 @@ struct ath5k_hw {
        u16                     ah_phy_revision;
        u16                     ah_radio_5ghz_revision;
        u16                     ah_radio_2ghz_revision;
+       u32                     ah_phy_spending;
 
        enum ath5k_version      ah_version;
        enum ath5k_radio        ah_radio;
index eec2b806a0de27dc99cc68a2035a3dc115c78bff..f4d383e956a00a9b274ffaa1d02ec1596566308a 100644 (file)
@@ -208,7 +208,7 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
 
        /* Identify single chip solutions */
        if((srev <= AR5K_SREV_VER_AR5414) &&
-       (srev >= AR5K_SREV_VER_AR2424)) {
+       (srev >= AR5K_SREV_VER_AR2413)) {
                ah->ah_single_chip = true;
        } else {
                ah->ah_single_chip = false;
@@ -223,10 +223,33 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
                ah->ah_radio = AR5K_RF5110;
        } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112) {
                ah->ah_radio = AR5K_RF5111;
-       } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) {
+               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111;
+       } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC0) {
+
                ah->ah_radio = AR5K_RF5112;
+
+               if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) {
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
+               } else {
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
+               }
+
+       } else if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_SC1) {
+               ah->ah_radio = AR5K_RF2413;
+               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
        } else {
+
                ah->ah_radio = AR5K_RF5413;
+
+               if (ah->ah_mac_srev <= AR5K_SREV_VER_AR5424 &&
+                       ah->ah_mac_srev >= AR5K_SREV_VER_AR2424)
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5424;
+               else if (ah->ah_mac_srev >= AR5K_SREV_VER_AR2425)
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
+               else
+                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112A;
+
+
        }
 
        ah->ah_phy = AR5K_PHY(0);
index 2f41c83986026d4b27887d9329678e01ae3d7d4d..30629b3e37c25039fd61661c5b861c2a09e3aeba 100644 (file)
@@ -1923,7 +1923,9 @@ after DFS is enabled */
 #define AR5K_PHY_SDELAY_32MHZ          0x000000ff
 #define AR5K_PHY_SPENDING              0x99f8
 #define AR5K_PHY_SPENDING_RF5111       0x00000018
-#define AR5K_PHY_SPENDING_RF5112       0x00000014
+#define AR5K_PHY_SPENDING_RF5112       0x00000014 /* <- i 've only seen this on 2425 dumps ! */
+#define AR5K_PHY_SPENDING_RF5112A      0x0000000e /* but since i only have 5112A-based chips */
+#define AR5K_PHY_SPENDING_RF5424       0x00000012 /* to test it might be also for old 5112.  */
 
 /*
  * Misc PHY/radio registers [5110 - 5111]