Commit d3c2be90 authored by Tomislav Požega's avatar Tomislav Požega Committed by Kalle Valo

ath9k: drop redundant code in ar9003_hw_set_channel

AR9330, AR9485, AR9531, AR9550, AR9561 and AR9565 all use same
channel set register configuration which allows for small code
size reduction.
Signed-off-by: default avatarTomislav Požega <pozega.tomislav@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent b50fd29c
...@@ -157,7 +157,9 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -157,7 +157,9 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
freq = centers.synth_center; freq = centers.synth_center;
if (freq < 4800) { /* 2 GHz, fractional mode */ if (freq < 4800) { /* 2 GHz, fractional mode */
if (AR_SREV_9330(ah)) { if (AR_SREV_9330(ah) || AR_SREV_9485(ah) ||
AR_SREV_9531(ah) || AR_SREV_9550(ah) ||
AR_SREV_9561(ah) || AR_SREV_9565(ah)) {
if (ah->is_clk_25mhz) if (ah->is_clk_25mhz)
div = 75; div = 75;
else else
...@@ -166,16 +168,6 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -166,16 +168,6 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
channelSel = (freq * 4) / div; channelSel = (freq * 4) / div;
chan_frac = (((freq * 4) % div) * 0x20000) / div; chan_frac = (((freq * 4) % div) * 0x20000) / div;
channelSel = (channelSel << 17) | chan_frac; channelSel = (channelSel << 17) | chan_frac;
} else if (AR_SREV_9485(ah) || AR_SREV_9565(ah)) {
/*
* freq_ref = 40 / (refdiva >> amoderefsel);
* where refdiva=1 and amoderefsel=0
* ndiv = ((chan_mhz * 4) / 3) / freq_ref;
* chansel = int(ndiv), chanfrac = (ndiv - chansel) * 0x20000
*/
channelSel = (freq * 4) / 120;
chan_frac = (((freq * 4) % 120) * 0x20000) / 120;
channelSel = (channelSel << 17) | chan_frac;
} else if (AR_SREV_9340(ah)) { } else if (AR_SREV_9340(ah)) {
if (ah->is_clk_25mhz) { if (ah->is_clk_25mhz) {
channelSel = (freq * 2) / 75; channelSel = (freq * 2) / 75;
...@@ -184,16 +176,6 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) ...@@ -184,16 +176,6 @@ static int ar9003_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
} else { } else {
channelSel = CHANSEL_2G(freq) >> 1; channelSel = CHANSEL_2G(freq) >> 1;
} }
} else if (AR_SREV_9550(ah) || AR_SREV_9531(ah) ||
AR_SREV_9561(ah)) {
if (ah->is_clk_25mhz)
div = 75;
else
div = 120;
channelSel = (freq * 4) / div;
chan_frac = (((freq * 4) % div) * 0x20000) / div;
channelSel = (channelSel << 17) | chan_frac;
} else { } else {
channelSel = CHANSEL_2G(freq); channelSel = CHANSEL_2G(freq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment