fix ht/40 configuration for ar9331 (hornet).

The synth programming here requires the real centre frequency,
which for HT20 channels is the normal channel, but HT40 is
/not/ the primary channel.  Everything else was using 'freq',
which is the correct centre frequency, but the hornet config
was using 'ichan' to do the lookup which was also the primary
channel.

So, modify the HAL call that does the mapping to take a frequency
in MHz and return the channel number.

Tested:

* Carambola 2, AR9331, tested both HT/20 and HT/40 operation.
This commit is contained in:
Adrian Chadd 2015-11-30 06:26:59 +00:00
parent c00c4e46e3
commit ff066b54ec
3 changed files with 19 additions and 8 deletions

View File

@ -99,7 +99,6 @@ ar9300_set_channel(struct ath_hal *ah, struct ieee80211_channel *chan)
ar9300_get_channel_centers(ah, chan, &centers);
freq = centers.synth_center;
if (freq < 4800) { /* 2 GHz, fractional mode */
b_mode = 1; /* 2 GHz */
@ -116,7 +115,19 @@ ar9300_set_channel(struct ath_hal *ah, struct ieee80211_channel *chan)
#endif
uint32_t i;
i = ath_hal_mhz2ieee_2ghz(ah, ichan);
/*
* Pay close attention to this bit!
*
* We need to map the actual desired synth frequency to
* one of the channel select array entries.
*
* For HT20, it'll align with the channel we select.
*
* For HT40 though it won't - the centre frequency
* will not be the frequency of chan->ic_freq or ichan->freq;
* it needs to be whatever frequency maps to 'freq'.
*/
i = ath_hal_mhz2ieee_2ghz(ah, freq);
HALASSERT(i > 0 && i <= 14);
if (clk_25mhz) {
channel_sel = ar9300_chansel_xtal_25M[i - 1];

View File

@ -1431,15 +1431,15 @@ ath_hal_EepromDataRead(struct ath_hal *ah, u_int off, uint16_t *data)
* This is the unmapped frequency which is programmed into the hardware.
*/
int
ath_hal_mhz2ieee_2ghz(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *ichan)
ath_hal_mhz2ieee_2ghz(struct ath_hal *ah, int freq)
{
if (ichan->channel == 2484)
if (freq == 2484)
return 14;
if (ichan->channel < 2484)
return ((int) ichan->channel - 2407) / 5;
if (freq < 2484)
return ((int) freq - 2407) / 5;
else
return 15 + ((ichan->channel - 2512) / 20);
return 15 + ((freq - 2512) / 20);
}
/*

View File

@ -1031,7 +1031,7 @@ ath_hal_getantennaallowed(struct ath_hal *ah,
/*
* Map the given 2GHz channel to an IEEE number.
*/
extern int ath_hal_mhz2ieee_2ghz(struct ath_hal *, HAL_CHANNEL_INTERNAL *);
extern int ath_hal_mhz2ieee_2ghz(struct ath_hal *, int freq);
/*
* Clear the channel survey data.