From 4c8dd973ef8e76f9fc622f0baab981769c89b601 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 9 Oct 2021 20:51:21 +0200 Subject: ath9k: OF: qca,disable-(2|5)ghz => ieee80211-freq-limit OpenWrt maintains two special out-of-tree DT properties: "qca,disable-5ghz" and "qca,disable-2ghz". These are implemented in a mac80211 ath9k patch "550-ath9k-disable-bands-via-dt.patch". With the things being what they are, now might be a good point to switch the devices to the generic and upstream "ieee80211-freq-limit" property. This property is much broader and works differently. Instead of disabling the drivers logic which would add the affected band and channels. It now disables all channels which are not within the specified frequency range. Reviewed-by: Martin Blumenstingl Tested-by: Martin Blumenstingl # HH5A Signed-off-by: Christian Lamparter --- ...rt-DT-ieee80211-freq-limit-property-to-li.patch | 29 ++++++++++++++++++++++ .../ath9k/550-ath9k-disable-bands-via-dt.patch | 15 ----------- .../mac80211/patches/ath9k/552-ath9k-ahb_of.patch | 8 +----- 3 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath9k/040-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch delete mode 100644 package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch (limited to 'package/kernel/mac80211/patches/ath9k') diff --git a/package/kernel/mac80211/patches/ath9k/040-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch b/package/kernel/mac80211/patches/ath9k/040-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch new file mode 100644 index 0000000000..4142cb6ffd --- /dev/null +++ b/package/kernel/mac80211/patches/ath9k/040-ath9k-support-DT-ieee80211-freq-limit-property-to-li.patch @@ -0,0 +1,29 @@ +From 03469e79fee9e8e908dae3bd1a80bcd9a66f2a88 Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +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 +Signed-off-by: Kalle Valo +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 +@@ -1094,6 +1094,8 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, + 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/550-ath9k-disable-bands-via-dt.patch b/package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch deleted file mode 100644 index d1593339d2..0000000000 --- a/package/kernel/mac80211/patches/ath9k/550-ath9k-disable-bands-via-dt.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -625,6 +625,12 @@ static int ath9k_of_init(struct ath_soft - - ath_dbg(common, CONFIG, "parsing configuration from OF node\n"); - -+ if (of_property_read_bool(np, "qca,disable-2ghz")) -+ ah->disable_2ghz = true; -+ -+ if (of_property_read_bool(np, "qca,disable-5ghz")) -+ ah->disable_5ghz = true; -+ - if (of_property_read_bool(np, "qca,no-eeprom")) { - /* ath9k-eeprom--.bin */ - scnprintf(eeprom_name, sizeof(eeprom_name), 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 2552bbc7a1..fce6db2167 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -16,7 +16,7 @@ static const struct platform_device_id ath9k_platform_id_table[] = { { -@@ -69,6 +77,242 @@ static const struct ath_bus_ops ath_ahb_ +@@ -69,6 +77,236 @@ static const struct ath_bus_ops ath_ahb_ .eeprom_read = ath_ahb_eeprom_read, }; @@ -218,12 +218,6 @@ + else + pdata->led_pin = -1; + -+ if (of_property_read_bool(pdev->dev.of_node, "qca,disable-2ghz")) -+ pdata->disable_2ghz = true; -+ -+ if (of_property_read_bool(pdev->dev.of_node, "qca,disable-5ghz")) -+ pdata->disable_5ghz = true; -+ + if (of_property_read_bool(pdev->dev.of_node, "qca,tx-gain-buffalo")) + pdata->tx_gain_buffalo = true; + -- cgit v1.2.3