diff options
Diffstat (limited to 'package/kernel/mac80211/patches/ath9k')
16 files changed, 28 insertions, 391 deletions
diff --git a/package/kernel/mac80211/patches/ath9k/040-v5.16-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch b/package/kernel/mac80211/patches/ath9k/040-v5.16-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch deleted file mode 100644 index 7d44681760..0000000000 --- a/package/kernel/mac80211/patches/ath9k/040-v5.16-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 03469e79fee9e8e908dae3bd1a80bcd9a66f2a88 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter <chunkeey@gmail.com> -Date: Mon, 11 Oct 2021 18:18:00 +0300 -Subject: ath9k: support DT ieee80211-freq-limit property to limit channels - -The common DT property can be used to limit the available channels -but ath9k has to manually call wiphy_read_of_freq_limits(). - -I would have put this into ath9k_of_init(). But it didn't work there. -The reason is that in ath9k_of_init() the channels and bands are not yet -registered in the wiphy struct. So there isn't any channel to flag as -disabled. - -Signed-off-by: Christian Lamparter <chunkeey@gmail.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> -Link: https://lore.kernel.org/r/20211009212847.1781986-1-chunkeey@gmail.com ---- ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1038,6 +1038,8 @@ int ath9k_init_device(u16 devid, struct - ARRAY_SIZE(ath9k_tpt_blink)); - #endif - -+ wiphy_read_of_freq_limits(hw->wiphy); -+ - /* Register with mac80211 */ - error = ieee80211_register_hw(hw); - if (error) diff --git a/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch b/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch index 7405e594fe..3eb57bb1cf 100644 --- a/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch +++ b/package/kernel/mac80211/patches/ath9k/401-ath9k_blink_default.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -47,7 +47,7 @@ int ath9k_modparam_nohwcrypt; +@@ -48,7 +48,7 @@ int ath9k_modparam_nohwcrypt; module_param_named(nohwcrypt, ath9k_modparam_nohwcrypt, int, 0444); MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption"); diff --git a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch index b355e8372f..b2f2763e8e 100644 --- a/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch +++ b/package/kernel/mac80211/patches/ath9k/410-ath9k_allow_adhoc_and_ap.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -826,6 +826,7 @@ static const struct ieee80211_iface_limi +@@ -882,6 +882,7 @@ static const struct ieee80211_iface_limi BIT(NL80211_IFTYPE_AP) }, { .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) }, diff --git a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch index 284c88ff49..f424ca530b 100644 --- a/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch +++ b/package/kernel/mac80211/patches/ath9k/450-ath9k-enabled-MFP-capability-unconditionally.patch @@ -14,7 +14,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net> --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -907,6 +907,7 @@ static void ath9k_set_hw_capab(struct at +@@ -963,6 +963,7 @@ static void ath9k_set_hw_capab(struct at ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING); ieee80211_hw_set(hw, SUPPORT_FAST_XMIT); ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS); @@ -22,7 +22,7 @@ Signed-off-by: David Bauer <mail@david-bauer.net> if (ath9k_ps_enable) ieee80211_hw_set(hw, SUPPORTS_PS); -@@ -919,9 +920,6 @@ static void ath9k_set_hw_capab(struct at +@@ -975,9 +976,6 @@ static void ath9k_set_hw_capab(struct at IEEE80211_RADIOTAP_MCS_HAVE_STBC; } diff --git a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch index 48ccc81308..e2bbb4a1b1 100644 --- a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1364,6 +1364,53 @@ void ath9k_deinit_debug(struct ath_softc +@@ -1413,6 +1413,53 @@ void ath9k_deinit_debug(struct ath_softc ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); } @@ -54,7 +54,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1383,6 +1430,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1432,6 +1479,8 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_tx99_init_debug(sc); ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); diff --git a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch index 6ab7972b55..740ddc39dc 100644 --- a/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch +++ b/package/kernel/mac80211/patches/ath9k/501-ath9k_ahb_init.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1122,25 +1122,25 @@ static int __init ath9k_init(void) +@@ -1178,25 +1178,25 @@ static int __init ath9k_init(void) { int error; diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index 126d1d5c62..0c8b6920c4 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1411,6 +1411,52 @@ static const struct file_operations fops +@@ -1460,6 +1460,52 @@ static const struct file_operations fops .owner = THIS_MODULE }; @@ -53,7 +53,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1432,6 +1478,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1481,6 +1527,8 @@ int ath9k_init_debug(struct ath_hw *ah) debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc, &fops_eeprom); diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index c161237827..1fe0041022 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -181,7 +181,7 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -1032,7 +1032,7 @@ int ath9k_init_device(u16 devid, struct +@@ -1088,7 +1088,7 @@ int ath9k_init_device(u16 devid, struct #ifdef CPTCFG_MAC80211_LEDS /* must be initialized before ieee80211_register_hw */ @@ -192,7 +192,7 @@ #endif --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1456,6 +1456,61 @@ static const struct file_operations fops +@@ -1505,6 +1505,61 @@ static const struct file_operations fops .llseek = default_llseek, }; @@ -254,7 +254,7 @@ int ath9k_init_debug(struct ath_hw *ah) { -@@ -1480,6 +1535,10 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1529,6 +1584,10 @@ int ath9k_init_debug(struct ath_hw *ah) &fops_eeprom); debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, sc, &fops_chanbw); diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 5b64f560fd..70f7ee3659 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1512,6 +1512,50 @@ static const struct file_operations fops +@@ -1561,6 +1561,50 @@ static const struct file_operations fops #endif @@ -51,7 +51,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1539,6 +1583,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1588,6 +1632,8 @@ int ath9k_init_debug(struct ath_hw *ah) debugfs_create_file("gpio_led", S_IWUSR, sc->debug.debugfs_phy, sc, &fops_gpio_led); #endif @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1077,6 +1085,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1079,6 +1087,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); diff --git a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch index ef4e659870..6acc864d1e 100644 --- a/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch +++ b/package/kernel/mac80211/patches/ath9k/543-ath9k_entropy_from_adc.patch @@ -18,7 +18,7 @@ void (*spectral_scan_trigger)(struct ath_hw *ah); --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c -@@ -1927,6 +1927,26 @@ void ar9003_hw_init_rate_txpower(struct +@@ -1918,6 +1918,26 @@ void ar9003_hw_init_rate_txpower(struct } } @@ -45,7 +45,7 @@ void ar9003_hw_attach_phy_ops(struct ath_hw *ah) { struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah); -@@ -1963,6 +1983,7 @@ void ar9003_hw_attach_phy_ops(struct ath +@@ -1954,6 +1974,7 @@ void ar9003_hw_attach_phy_ops(struct ath priv_ops->set_radar_params = ar9003_hw_set_radar_params; priv_ops->fast_chan_change = ar9003_hw_fast_chan_change; @@ -55,7 +55,7 @@ ops->spectral_scan_config = ar9003_hw_spectral_scan_config; --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -814,7 +814,8 @@ static void ath9k_init_txpower_limits(st +@@ -870,7 +870,8 @@ static void ath9k_init_txpower_limits(st if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); @@ -65,7 +65,7 @@ } static const struct ieee80211_iface_limit if_limits[] = { -@@ -992,6 +993,18 @@ static void ath9k_set_hw_capab(struct at +@@ -1048,6 +1049,18 @@ static void ath9k_set_hw_capab(struct at wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0); } @@ -84,7 +84,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -1039,6 +1052,8 @@ int ath9k_init_device(u16 devid, struct +@@ -1095,6 +1108,8 @@ int ath9k_init_device(u16 devid, struct wiphy_read_of_freq_limits(hw->wiphy); diff --git a/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch b/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch index 854bb3659a..d3bf07ff92 100644 --- a/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch +++ b/package/kernel/mac80211/patches/ath9k/545-ath9k_ani_ws_detect.patch @@ -79,7 +79,7 @@ static const u8 ofdm2pwr[] = { ALL_TARGET_LEGACY_6_24, ALL_TARGET_LEGACY_6_24, -@@ -1077,11 +1063,6 @@ static bool ar9003_hw_ani_control(struct +@@ -1068,11 +1054,6 @@ static bool ar9003_hw_ani_control(struct struct ath_common *common = ath9k_hw_common(ah); struct ath9k_channel *chan = ah->curchan; struct ar5416AniState *aniState = &ah->ani; @@ -91,7 +91,7 @@ s32 value, value2; switch (cmd & ah->ani_function) { -@@ -1095,61 +1076,6 @@ static bool ar9003_hw_ani_control(struct +@@ -1086,61 +1067,6 @@ static bool ar9003_hw_ani_control(struct */ u32 on = param ? 1 : 0; diff --git a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch index 6b5c0dc514..0fbc364c28 100644 --- a/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch +++ b/package/kernel/mac80211/patches/ath9k/551-ath9k_ubnt_uap_plus_hsr.patch @@ -371,7 +371,7 @@ --- a/local-symbols +++ b/local-symbols -@@ -133,6 +133,7 @@ ATH9K_WOW= +@@ -137,6 +137,7 @@ ATH9K_WOW= ATH9K_RFKILL= ATH9K_CHANNEL_CONTEXT= ATH9K_PCOEM= diff --git a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch index 7ce8bc5b82..57eef54e89 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -271,7 +271,7 @@ if (!dev_get_platdata(&pdev->dev)) { dev_err(&pdev->dev, "no platform data specified\n"); -@@ -122,13 +371,16 @@ static int ath_ahb_probe(struct platform +@@ -118,13 +367,16 @@ static int ath_ahb_probe(struct platform sc->mem = mem; sc->irq = irq; @@ -289,7 +289,7 @@ if (ret) { dev_err(&pdev->dev, "failed to initialize device\n"); goto err_irq; -@@ -159,6 +411,9 @@ static int ath_ahb_remove(struct platfor +@@ -155,6 +407,9 @@ static int ath_ahb_remove(struct platfor free_irq(sc->irq, sc); ieee80211_free_hw(sc->hw); } @@ -299,7 +299,7 @@ return 0; } -@@ -168,6 +423,9 @@ static struct platform_driver ath_ahb_dr +@@ -164,6 +419,9 @@ static struct platform_driver ath_ahb_dr .remove = ath_ahb_remove, .driver = { .name = "ath9k", diff --git a/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch b/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch index 80e0dc4c5e..6d1820ecb7 100644 --- a/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch +++ b/package/kernel/mac80211/patches/ath9k/553-ath9k_of_gpio_mask.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -644,6 +644,12 @@ static int ath9k_of_init(struct ath_soft +@@ -696,6 +696,12 @@ static int ath9k_of_init(struct ath_soft return 0; } @@ -13,7 +13,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, const struct ath_bus_ops *bus_ops) { -@@ -747,6 +753,9 @@ static int ath9k_init_softc(u16 devid, s +@@ -803,6 +809,9 @@ static int ath9k_init_softc(u16 devid, s if (ret) goto err_hw; diff --git a/package/kernel/mac80211/patches/ath9k/600-v5.16-ath9k-fetch-calibration-data-via-nvmem-subsystem.patch b/package/kernel/mac80211/patches/ath9k/600-v5.16-ath9k-fetch-calibration-data-via-nvmem-subsystem.patch deleted file mode 100644 index a250d2318e..0000000000 --- a/package/kernel/mac80211/patches/ath9k/600-v5.16-ath9k-fetch-calibration-data-via-nvmem-subsystem.patch +++ /dev/null @@ -1,154 +0,0 @@ -From dab16ef495dbb3cabb355b6c80f0771a4a25e35d Mon Sep 17 00:00:00 2001 -From: Christian Lamparter <chunkeey@gmail.com> -Date: Fri, 20 Aug 2021 22:44:52 +0200 -Subject: [PATCH] ath9k: fetch calibration data via nvmem subsystem - -On most embedded ath9k devices (like range extenders, -routers, accesspoints, ...) the calibration data is -stored in a MTD partitions named "ART", or "caldata"/ -"calibration". - -Ever since commit -4b361cfa8624 ("mtd: core: add OTP nvmem provider support") -all MTD partitions are all automatically available through -the nvmem subsystem. This allows drivers like ath9k to read -the necessary data without needing any userspace helpers -that would do this extraction. - -Signed-off-by: Christian Lamparter <chunkeey@gmail.com> ---- - -includes: - -From 57671351379b2051cfb07fc14e0bead9916a0880 Mon Sep 17 00:00:00 2001 -From: Dan Carpenter <dan.carpenter@oracle.com> -Date: Mon, 11 Oct 2021 18:18:01 +0300 -Subject: ath9k: fix an IS_ERR() vs NULL check - -The devm_kmemdup() function doesn't return error pointers, it returns -NULL on error. - -Fixes: eb3a97a69be8 ("ath9k: fetch calibration data via nvmem subsystem") -Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> -Signed-off-by: Kalle Valo <kvalo@codeaurora.org> -Link: https://lore.kernel.org/r/20211011123533.GA15188@kili - ---- - ---- a/drivers/net/wireless/ath/ath9k/eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c -@@ -135,13 +135,23 @@ static bool ath9k_hw_nvram_read_firmware - offset, data); - } - -+static bool ath9k_hw_nvram_read_nvmem(struct ath_hw *ah, off_t offset, -+ u16 *data) -+{ -+ return ath9k_hw_nvram_read_array(ah->nvmem_blob, -+ ah->nvmem_blob_len / sizeof(u16), -+ offset, data); -+} -+ - bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data) - { - struct ath_common *common = ath9k_hw_common(ah); - struct ath9k_platform_data *pdata = ah->dev->platform_data; - bool ret; - -- if (ah->eeprom_blob) -+ if (ah->nvmem_blob) -+ ret = ath9k_hw_nvram_read_nvmem(ah, off, data); -+ else if (ah->eeprom_blob) - ret = ath9k_hw_nvram_read_firmware(ah->eeprom_blob, off, data); - else if (pdata && !pdata->use_eeprom) - ret = ath9k_hw_nvram_read_pdata(pdata, off, data); ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -988,6 +988,8 @@ struct ath_hw { - bool disable_5ghz; - - const struct firmware *eeprom_blob; -+ u16 *nvmem_blob; /* devres managed */ -+ size_t nvmem_blob_len; - - struct ath_dynack dynack; - ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -22,6 +22,7 @@ - #include <linux/module.h> - #include <linux/of.h> - #include <linux/of_net.h> -+#include <linux/nvmem-consumer.h> - #include <linux/relay.h> - #include <linux/dmi.h> - #include <net/ieee80211_radiotap.h> -@@ -568,6 +569,57 @@ static void ath9k_eeprom_release(struct - release_firmware(sc->sc_ah->eeprom_blob); - } - -+static int ath9k_nvmem_request_eeprom(struct ath_softc *sc) -+{ -+ struct ath_hw *ah = sc->sc_ah; -+ struct nvmem_cell *cell; -+ void *buf; -+ size_t len; -+ int err; -+ -+ cell = devm_nvmem_cell_get(sc->dev, "calibration"); -+ if (IS_ERR(cell)) { -+ err = PTR_ERR(cell); -+ -+ /* nvmem cell might not be defined, or the nvmem -+ * subsystem isn't included. In this case, follow -+ * the established "just return 0;" convention of -+ * ath9k_init_platform to say: -+ * "All good. Nothing to see here. Please go on." -+ */ -+ if (err == -ENOENT || err == -EOPNOTSUPP) -+ return 0; -+ -+ return err; -+ } -+ -+ buf = nvmem_cell_read(cell, &len); -+ if (IS_ERR(buf)) -+ return PTR_ERR(buf); -+ -+ /* run basic sanity checks on the returned nvram cell length. -+ * That length has to be a multiple of a "u16" (i.e.: & 1). -+ * Furthermore, it has to be more than "let's say" 512 bytes -+ * but less than the maximum of AR9300_EEPROM_SIZE (16kb). -+ */ -+ if (((len & 1) == 1) || (len < 512) || (len >= AR9300_EEPROM_SIZE)) { -+ kfree(buf); -+ return -EINVAL; -+ } -+ -+ /* devres manages the calibration values release on shutdown */ -+ ah->nvmem_blob = (u16 *)devm_kmemdup(sc->dev, buf, len, GFP_KERNEL); -+ kfree(buf); -+ if (!ah->nvmem_blob) -+ return -ENOMEM; -+ -+ ah->nvmem_blob_len = len; -+ ah->ah_flags &= ~AH_USE_EEPROM; -+ ah->ah_flags |= AH_NO_EEP_SWAP; -+ -+ return 0; -+} -+ - static int ath9k_init_platform(struct ath_softc *sc) - { - struct ath9k_platform_data *pdata = sc->dev->platform_data; -@@ -710,6 +762,10 @@ static int ath9k_init_softc(u16 devid, s - if (ret) - return ret; - -+ ret = ath9k_nvmem_request_eeprom(sc); -+ if (ret) -+ return ret; -+ - if (ath9k_led_active_high != -1) - ah->config.led_active_high = ath9k_led_active_high == 1; - diff --git a/package/kernel/mac80211/patches/ath9k/601-v5.16-ath9k-owl-loader-fetch-pci-init-values-through-nvmem.patch b/package/kernel/mac80211/patches/ath9k/601-v5.16-ath9k-owl-loader-fetch-pci-init-values-through-nvmem.patch deleted file mode 100644 index 62c561d619..0000000000 --- a/package/kernel/mac80211/patches/ath9k/601-v5.16-ath9k-owl-loader-fetch-pci-init-values-through-nvmem.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 9bf31835f11aa3c4fe5a9c1f7462c199c5d8e7ca Mon Sep 17 00:00:00 2001 -From: Christian Lamparter <chunkeey@gmail.com> -Date: Sat, 21 Aug 2021 00:22:39 +0200 -Subject: [PATCH] ath9k: owl-loader: fetch pci init values through nvmem - -extends the owl loader to fetch important pci initialization -values - which are stored together with the calibration data - -through the nvmem subsystem. - -This allows for much faster WIFI/ath9k initializations on devices -that do not require to perform any post-processing (like XOR'ing/ -reversal or unpacking) since no userspace helper is required. - -Signed-off-by: Christian Lamparter <chunkeey@gmail.com> ---- - .../wireless/ath/ath9k/ath9k_pci_owl_loader.c | 105 +++++++++++++----- - 1 file changed, 76 insertions(+), 29 deletions(-) - ---- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c -+++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c -@@ -19,9 +19,14 @@ - #include <linux/delay.h> - #include <linux/platform_device.h> - #include <linux/ath9k_platform.h> -+#include <linux/nvmem-consumer.h> -+#include <linux/workqueue.h> - - struct owl_ctx { -+ struct pci_dev *pdev; - struct completion eeprom_load; -+ struct work_struct work; -+ struct nvmem_cell *cell; - }; - - #define EEPROM_FILENAME_LEN 100 -@@ -42,6 +47,12 @@ static int ath9k_pci_fixup(struct pci_de - u32 bar0; - bool swap_needed = false; - -+ /* also note that we are doing *u16 operations on the file */ -+ if (cal_len > 4096 || cal_len < 0x200 || (cal_len & 1) == 1) { -+ dev_err(&pdev->dev, "eeprom has an invalid size.\n"); -+ return -EINVAL; -+ } -+ - if (*cal_data != AR5416_EEPROM_MAGIC) { - if (*cal_data != swab16(AR5416_EEPROM_MAGIC)) { - dev_err(&pdev->dev, "invalid calibration data\n"); -@@ -99,38 +110,31 @@ static int ath9k_pci_fixup(struct pci_de - return 0; - } - --static void owl_fw_cb(const struct firmware *fw, void *context) -+static void owl_rescan(struct pci_dev *pdev) - { -- struct pci_dev *pdev = (struct pci_dev *)context; -- struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev); -- struct pci_bus *bus; -- -- complete(&ctx->eeprom_load); -- -- if (!fw) { -- dev_err(&pdev->dev, "no eeprom data received.\n"); -- goto release; -- } -- -- /* also note that we are doing *u16 operations on the file */ -- if (fw->size > 4096 || fw->size < 0x200 || (fw->size & 1) == 1) { -- dev_err(&pdev->dev, "eeprom file has an invalid size.\n"); -- goto release; -- } -- -- if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size)) -- goto release; -+ struct pci_bus *bus = pdev->bus; - - pci_lock_rescan_remove(); -- bus = pdev->bus; - pci_stop_and_remove_bus_device(pdev); - /* the device should come back with the proper - * ProductId. But we have to initiate a rescan. - */ - pci_rescan_bus(bus); - pci_unlock_rescan_remove(); -+} -+ -+static void owl_fw_cb(const struct firmware *fw, void *context) -+{ -+ struct owl_ctx *ctx = (struct owl_ctx *)context; -+ -+ complete(&ctx->eeprom_load); - --release: -+ if (fw) { -+ ath9k_pci_fixup(ctx->pdev, (const u16 *)fw->data, fw->size); -+ owl_rescan(ctx->pdev); -+ } else { -+ dev_err(&ctx->pdev->dev, "no eeprom data received.\n"); -+ } - release_firmware(fw); - } - -@@ -152,6 +156,43 @@ static const char *owl_get_eeprom_name(s - return eeprom_name; - } - -+static void owl_nvmem_work(struct work_struct *work) -+{ -+ struct owl_ctx *ctx = container_of(work, struct owl_ctx, work); -+ void *buf; -+ size_t len; -+ -+ complete(&ctx->eeprom_load); -+ -+ buf = nvmem_cell_read(ctx->cell, &len); -+ if (!IS_ERR(buf)) { -+ ath9k_pci_fixup(ctx->pdev, buf, len); -+ kfree(buf); -+ owl_rescan(ctx->pdev); -+ } else { -+ dev_err(&ctx->pdev->dev, "no nvmem data received.\n"); -+ } -+} -+ -+static int owl_nvmem_probe(struct owl_ctx *ctx) -+{ -+ int err; -+ -+ ctx->cell = devm_nvmem_cell_get(&ctx->pdev->dev, "calibration"); -+ if (IS_ERR(ctx->cell)) { -+ err = PTR_ERR(ctx->cell); -+ if (err == -ENOENT || err == -EOPNOTSUPP) -+ return 1; /* not present, try firmware_request */ -+ -+ return err; -+ } -+ -+ INIT_WORK(&ctx->work, owl_nvmem_work); -+ schedule_work(&ctx->work); -+ -+ return 0; -+} -+ - static int owl_probe(struct pci_dev *pdev, - const struct pci_device_id *id) - { -@@ -164,21 +205,27 @@ static int owl_probe(struct pci_dev *pde - - pcim_pin_device(pdev); - -- eeprom_name = owl_get_eeprom_name(pdev); -- if (!eeprom_name) { -- dev_err(&pdev->dev, "no eeprom filename found.\n"); -- return -ENODEV; -- } -- - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); - if (!ctx) - return -ENOMEM; - - init_completion(&ctx->eeprom_load); -+ ctx->pdev = pdev; - - pci_set_drvdata(pdev, ctx); -+ -+ err = owl_nvmem_probe(ctx); -+ if (err <= 0) -+ return err; -+ -+ eeprom_name = owl_get_eeprom_name(pdev); -+ if (!eeprom_name) { -+ dev_err(&pdev->dev, "no eeprom filename found.\n"); -+ return -ENODEV; -+ } -+ - err = request_firmware_nowait(THIS_MODULE, true, eeprom_name, -- &pdev->dev, GFP_KERNEL, pdev, owl_fw_cb); -+ &pdev->dev, GFP_KERNEL, ctx, owl_fw_cb); - if (err) - dev_err(&pdev->dev, "failed to request caldata (%d).\n", err); - |