Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32c25464 authored by Pavel Roskin's avatar Pavel Roskin Committed by John W. Linville
Browse files

ath5k: eliminate CHANNEL_* macros, use AR5K_MODE_* in channel->hw_value



When checking for the band, use channel->band.

Change ath5k_hw_nic_wakeup() and ath5k_channel_ok() to take
ieee80211_channel.  Change ath5k_hw_radio_revision() to take
ieee80211_band.

Signed-off-by: default avatarPavel Roskin <proski@gnu.org>
Tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
Acked-by: default avatarNick Kossifidis <mickflemm@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8d44a823
Loading
Loading
Loading
Loading
+4 −28
Original line number Diff line number Diff line
@@ -685,30 +685,6 @@ struct ath5k_gain {
#define AR5K_SLOT_TIME_20	880
#define AR5K_SLOT_TIME_MAX	0xffff

/* channel_flags */
#define	CHANNEL_CW_INT	0x0008	/* Contention Window interference detected */
#define	CHANNEL_CCK	0x0020	/* CCK channel */
#define	CHANNEL_OFDM	0x0040	/* OFDM channel */
#define	CHANNEL_2GHZ	0x0080	/* 2GHz channel. */
#define	CHANNEL_5GHZ	0x0100	/* 5GHz channel */
#define	CHANNEL_PASSIVE	0x0200	/* Only passive scan allowed */
#define	CHANNEL_DYN	0x0400	/* Dynamic CCK-OFDM channel (for g operation) */

#define	CHANNEL_A	(CHANNEL_5GHZ | CHANNEL_OFDM)
#define	CHANNEL_B	(CHANNEL_2GHZ | CHANNEL_CCK)
#define	CHANNEL_G	(CHANNEL_2GHZ | CHANNEL_OFDM)

#define	CHANNEL_ALL	(CHANNEL_OFDM | CHANNEL_CCK | \
			 CHANNEL_2GHZ | CHANNEL_5GHZ)

#define CHANNEL_MODES		CHANNEL_ALL

/*
 * Used internally for ath5k_hw_reset_tx_queue().
 * Also see struct struct ieee80211_channel.
 */
#define IS_CHAN_B(_c)	((_c->hw_value & CHANNEL_B) != 0)

/*
 * The following structure is used to map 2GHz channels to
 * 5GHz Atheros channels.
@@ -965,7 +941,7 @@ enum ath5k_power_mode {
struct ath5k_capabilities {
	/*
	 * Supported PHY modes
	 * (ie. CHANNEL_A, CHANNEL_B, ...)
	 * (ie. AR5K_MODE_11A, AR5K_MODE_11B, ...)
	 */
	DECLARE_BITMAP(cap_mode, AR5K_MODE_MAX);

@@ -1335,7 +1311,7 @@ void ath5k_unregister_leds(struct ath5k_hw *ah);


/* Reset Functions */
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial);
int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, struct ieee80211_channel *channel);
int ath5k_hw_on_hold(struct ath5k_hw *ah);
int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
	   struct ieee80211_channel *channel, bool fast, bool skip_pcu);
@@ -1455,13 +1431,13 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);

/* PHY functions */
/* Misc PHY functions */
u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, unsigned int chan);
u16 ath5k_hw_radio_revision(struct ath5k_hw *ah, enum ieee80211_band band);
int ath5k_hw_phy_disable(struct ath5k_hw *ah);
/* Gain_F optimization */
enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah);
/* PHY/RF channel functions */
bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags);
bool ath5k_channel_ok(struct ath5k_hw *ah, struct ieee80211_channel *channel);
/* PHY calibration */
void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah);
int ath5k_hw_phy_calibrate(struct ath5k_hw *ah,
+5 −5
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
		goto err;

	/* Bring device out of sleep and reset its units */
	ret = ath5k_hw_nic_wakeup(ah, 0, true);
	ret = ath5k_hw_nic_wakeup(ah, NULL);
	if (ret)
		goto err;

@@ -153,7 +153,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
	ah->ah_phy_revision = ath5k_hw_reg_read(ah, AR5K_PHY_CHIP_ID) &
			0xffffffff;
	ah->ah_radio_5ghz_revision = ath5k_hw_radio_revision(ah,
			CHANNEL_5GHZ);
			IEEE80211_BAND_5GHZ);

	/* Try to identify radio chip based on its srev */
	switch (ah->ah_radio_5ghz_revision & 0xf0) {
@@ -161,14 +161,14 @@ int ath5k_hw_init(struct ath5k_hw *ah)
		ah->ah_radio = AR5K_RF5111;
		ah->ah_single_chip = false;
		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
							CHANNEL_2GHZ);
							IEEE80211_BAND_2GHZ);
		break;
	case AR5K_SREV_RAD_5112:
	case AR5K_SREV_RAD_2112:
		ah->ah_radio = AR5K_RF5112;
		ah->ah_single_chip = false;
		ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
							CHANNEL_2GHZ);
							IEEE80211_BAND_2GHZ);
		break;
	case AR5K_SREV_RAD_2413:
		ah->ah_radio = AR5K_RF2413;
@@ -205,7 +205,7 @@ int ath5k_hw_init(struct ath5k_hw *ah)
			ah->ah_radio = AR5K_RF5111;
			ah->ah_single_chip = false;
			ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
								CHANNEL_2GHZ);
							IEEE80211_BAND_2GHZ);
		} else if (ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4) ||
			   ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4) ||
			   ah->ah_phy_revision == AR5K_SREV_PHY_2425) {
+7 −16
Original line number Diff line number Diff line
@@ -272,20 +272,18 @@ static unsigned int
ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
		unsigned int mode, unsigned int max)
{
	unsigned int count, size, chfreq, freq, ch;
	unsigned int count, size, freq, ch;
	enum ieee80211_band band;

	switch (mode) {
	case AR5K_MODE_11A:
		/* 1..220, but 2GHz frequencies are filtered by check_channel */
		size = 220;
		chfreq = CHANNEL_5GHZ;
		band = IEEE80211_BAND_5GHZ;
		break;
	case AR5K_MODE_11B:
	case AR5K_MODE_11G:
		size = 26;
		chfreq = CHANNEL_2GHZ;
		band = IEEE80211_BAND_2GHZ;
		break;
	default:
@@ -300,26 +298,19 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,
		if (freq == 0) /* mapping failed - not a standard channel */
			continue;

		/* Write channel info, needed for ath5k_channel_ok() */
		channels[count].center_freq = freq;
		channels[count].band = band;
		channels[count].hw_value = mode;

		/* Check if channel is supported by the chipset */
		if (!ath5k_channel_ok(ah, freq, chfreq))
		if (!ath5k_channel_ok(ah, &channels[count]))
			continue;

		if (!modparam_all_channels &&
		    !ath5k_is_standard_channel(ch, band))
			continue;

		/* Write channel info and increment counter */
		channels[count].center_freq = freq;
		channels[count].band = band;
		switch (mode) {
		case AR5K_MODE_11A:
		case AR5K_MODE_11G:
			channels[count].hw_value = chfreq | CHANNEL_OFDM;
			break;
		case AR5K_MODE_11B:
			channels[count].hw_value = CHANNEL_B;
		}

		count++;
	}

+4 −4
Original line number Diff line number Diff line
@@ -1780,12 +1780,12 @@ ath5k_eeprom_detach(struct ath5k_hw *ah)
int
ath5k_eeprom_mode_from_channel(struct ieee80211_channel *channel)
{
	switch (channel->hw_value & CHANNEL_MODES) {
	case CHANNEL_A:
	switch (channel->hw_value) {
	case AR5K_MODE_11A:
		return AR5K_EEPROM_MODE_11A;
	case CHANNEL_G:
	case AR5K_MODE_11G:
		return AR5K_EEPROM_MODE_11G;
	case CHANNEL_B:
	case AR5K_MODE_11B:
		return AR5K_EEPROM_MODE_11B;
	default:
		return -1;
+2 −2
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ unsigned int ath5k_hw_get_default_slottime(struct ath5k_hw *ah)
	case AR5K_BWMODE_DEFAULT:
	default:
		slot_time = AR5K_INIT_SLOT_TIME_DEFAULT;
		if ((channel->hw_value & CHANNEL_CCK) && !ah->ah_short_slot)
		if ((channel->hw_value == AR5K_MODE_11B) && !ah->ah_short_slot)
			slot_time = AR5K_INIT_SLOT_TIME_B;
		break;
	}
@@ -183,7 +183,7 @@ unsigned int ath5k_hw_get_default_sifs(struct ath5k_hw *ah)
	case AR5K_BWMODE_DEFAULT:
		sifs = AR5K_INIT_SIFS_DEFAULT_BG;
	default:
		if (channel->hw_value & CHANNEL_5GHZ)
		if (channel->band == IEEE80211_BAND_5GHZ)
			sifs = AR5K_INIT_SIFS_DEFAULT_A;
		break;
	}
Loading