ath9k_hw: add common channel select helpers for ar900[23]
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Thu, 15 Apr 2010 21:38:32 +0000 (17:38 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 16 Apr 2010 19:43:23 +0000 (15:43 -0400)
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9002_phy.c
drivers/net/wireless/ath/ath9k/phy.h

index 87541a8440c0b9256c189cee368c768a8222437a..1f8ac0ae471a1ef670f42a243ae89f023d9e7f9f 100644 (file)
@@ -83,7 +83,7 @@ static int ar9002_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
                bMode = 1;
                fracMode = 1;
                aModeRefSel = 0;
-               channelSel = (freq * 0x10000) / 15;
+               channelSel = CHANSEL_2G(freq);
 
                if (AR_SREV_9287_11_OR_LATER(ah)) {
                        if (freq == 2484) {
@@ -126,7 +126,7 @@ static int ar9002_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
                         */
                        fracMode = 1;
                        refDivA = 1;
-                       channelSel = (freq * 0x8000) / 15;
+                       channelSel = CHANSEL_5G(freq);
 
                        /* RefDivA setting */
                        REG_RMW_FIELD(ah, AR_AN_SYNTH9,
index b90815205a14f941d82c3d7ccbffbd31ba43a9b8..7d397fd7bd187d53e0272b89b5599a784c80ae13 100644 (file)
 #ifndef PHY_H
 #define PHY_H
 
+#define CHANSEL_DIV            15
+#define CHANSEL_2G(_freq)      (((_freq) * 0x10000) / CHANSEL_DIV)
+#define CHANSEL_5G(_freq)      (((_freq) * 0x8000) / CHANSEL_DIV)
+
 #define AR_PHY_BASE     0x9800
 #define AR_PHY(_n)      (AR_PHY_BASE + ((_n)<<2))