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

Commit 3468968e authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville
Browse files

ath9k: allow disabling bands via platform data



Some devices have multiple bands enables in the EEPROM data, even though
they are only calibrated for one. Allow platform data to disable
unsupported bands.

Signed-off-by: default avatarGabor Juhos <juhosg@openwrt.org>
Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a59dadbe
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -2344,17 +2344,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah)
	}

	eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
	if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
		ath_err(common,
			"no band has been marked as supported in EEPROM\n");
		return -EINVAL;
	}

	if (eeval & AR5416_OPFLAGS_11A)
	if (eeval & AR5416_OPFLAGS_11A) {
		if (ah->disable_5ghz)
			ath_warn(common, "disabling 5GHz band\n");
		else
			pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
	}

	if (eeval & AR5416_OPFLAGS_11G)
	if (eeval & AR5416_OPFLAGS_11G) {
		if (ah->disable_2ghz)
			ath_warn(common, "disabling 2GHz band\n");
		else
			pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
	}

	if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) {
		ath_err(common, "both bands are disabled\n");
		return -EINVAL;
	}

	if (AR_SREV_9485(ah) ||
	    AR_SREV_9285(ah) ||
+2 −0
Original line number Diff line number Diff line
@@ -930,6 +930,8 @@ struct ath_hw {
	bool is_clk_25mhz;
	int (*get_mac_revision)(void);
	int (*external_reset)(void);
	bool disable_2ghz;
	bool disable_5ghz;

	const struct firmware *eeprom_blob;

+2 −0
Original line number Diff line number Diff line
@@ -531,6 +531,8 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
		ah->is_clk_25mhz = pdata->is_clk_25mhz;
		ah->get_mac_revision = pdata->get_mac_revision;
		ah->external_reset = pdata->external_reset;
		ah->disable_2ghz = pdata->disable_2ghz;
		ah->disable_5ghz = pdata->disable_5ghz;
		if (!pdata->endian_check)
			ah->ah_flags |= AH_NO_EEP_SWAP;
	}
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ struct ath9k_platform_data {
	bool endian_check;
	bool is_clk_25mhz;
	bool tx_gain_buffalo;
	bool disable_2ghz;
	bool disable_5ghz;

	int (*get_mac_revision)(void);
	int (*external_reset)(void);