This adds support for using an external power amplifier as found in the ALL0258N by merging the vendor-supplied changes in a non-intrusive way. Please let me know if you see anything which would prevent this from being included.
Signed-off-by: Daniel Golle <dgo...@allnet.de> Index: package/mac80211/patches/950-ath9k_ar9285_external_pa.patch =================================================================== --- /dev/null (revision 0) +++ package/mac80211/patches/950-ath9k_ar9285_external_pa.patch (working copy) @@ -0,0 +1,87 @@ +--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c +@@ -564,7 +564,7 @@ static inline void ar9285_hw_pa_cal(stru + + /* PA CAL is not needed for high power solution */ + if (ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE) == +- AR5416_EEP_TXGAIN_HIGH_POWER) ++ AR5416_EEP_TXGAIN_HIGH_POWER && ! ah->has_external_pa) + return; + + for (i = 0; i < ARRAY_SIZE(regList); i++) +--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c +@@ -262,7 +262,12 @@ static void ar9002_hw_init_mode_gain_reg + } else if (AR_SREV_9280_20(ah)) { + ar9280_20_hw_init_txgain_ini(ah); + } else if (AR_SREV_9285_12_OR_LATER(ah)) { +- u32 txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE); ++ u32 txgain_type; ++ if (ah->has_external_pa) { ++ txgain_type = AR5416_EEP_TXGAIN_HIGH_POWER; ++ } else { ++ txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE); ++ } + + /* txgain table */ + if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER) { +--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c +@@ -520,8 +520,12 @@ static void ath9k_hw_set_4k_power_per_ra + (tpScaleReductionTable[(regulatory->tp_scale)] * 2); + } + +- scaledPower = min(powerLimit, maxRegAllowedPower); +- scaledPower = max((u16)0, scaledPower); ++ if ( ah->has_external_pa ) { ++ scaledPower = max((u16)0, powerLimit); ++ } else { ++ scaledPower = min(powerLimit, maxRegAllowedPower); ++ scaledPower = max((u16)0, scaledPower); ++ } + + numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40; + pCtlMode = ctlModesFor11g; +@@ -594,7 +598,11 @@ static void ath9k_hw_set_4k_power_per_ra + } + } + +- minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); ++ if ( ah->has_external_pa ) { ++ minCtlPower = scaledPower; ++ } else { ++ minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower); ++ } + + switch (pCtlMode[ctlMode]) { + case CTL_11B: +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -870,6 +870,7 @@ struct ath_hw { + /* Enterprise mode cap */ + u32 ent_mode; + ++ bool has_external_pa; + bool is_clk_25mhz; + int (*get_mac_revision)(void); + int (*external_reset)(void); +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -549,6 +549,7 @@ static int ath9k_init_softc(u16 devid, s + sc->sc_ah->gpio_val = pdata->gpio_val; + sc->sc_ah->led_pin = pdata->led_pin; + ah->is_clk_25mhz = pdata->is_clk_25mhz; ++ ah->has_external_pa = pdata->has_external_pa; + ah->get_mac_revision = pdata->get_mac_revision; + ah->external_reset = pdata->external_reset; + } +--- a/include/linux/ath9k_platform.h ++++ b/include/linux/ath9k_platform.h +@@ -29,6 +29,7 @@ struct ath9k_platform_data { + u32 gpio_mask; + u32 gpio_val; + ++ bool has_external_pa; + bool is_clk_25mhz; + int (*get_mac_revision)(void); + int (*external_reset)(void); Index: target/linux/ar71xx/files/include/linux/ath9k_platform.h =================================================================== --- target/linux/ar71xx/files/include/linux/ath9k_platform.h (revision 28237) +++ target/linux/ar71xx/files/include/linux/ath9k_platform.h (working copy) @@ -29,6 +29,7 @@ u32 gpio_mask; u32 gpio_val; + bool has_external_pa; bool is_clk_25mhz; int (*get_mac_revision)(void); int (*external_reset)(void); Index: target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-pci.c =================================================================== --- target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-pci.c (revision 28237) +++ target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-pci.c (working copy) @@ -20,6 +20,7 @@ static struct ath9k_platform_data ap91_wmac_data = { .led_pin = -1, + .has_external_pa = 0, }; static char ap91_wmac_mac[6]; @@ -47,6 +48,11 @@ ap91_wmac_data.led_pin = pin; } +__init void ap91_pci_setup_wmac_external_pa(bool has_external_pa) +{ + ap91_wmac_data.has_external_pa = has_external_pa; +} + __init void ap91_pci_setup_wmac_gpio(u32 mask, u32 val) { ap91_wmac_data.gpio_mask = mask; _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel