diff mbox series

[1/2] mac80211: convert UniFi Outdoor+ HSR support to OF

Message ID 20210123005854.576853-1-mail@david-bauer.net
State Accepted
Delegated to: David Bauer
Headers show
Series [1/2] mac80211: convert UniFi Outdoor+ HSR support to OF | expand

Commit Message

David Bauer Jan. 23, 2021, 12:58 a.m. UTC
Enable support for the Ubiquiti UniFi Outdoor+ RF filter via
device-tree. The old way of using platform data is not required anymore,
as it was only used on the now removed ar71xx target.

Signed-off-by: David Bauer <mail@david-bauer.net>
---
 .../ath/551-ath9k_ubnt_uap_plus_hsr.patch     | 35 ++++++-------------
 .../files/include/linux/ath9k_platform.h      |  2 --
 2 files changed, 10 insertions(+), 27 deletions(-)

Comments

Matthias Schiffer Jan. 23, 2021, 1:22 p.m. UTC | #1
On 1/23/21 1:58 AM, David Bauer wrote:
> Enable support for the Ubiquiti UniFi Outdoor+ RF filter via
> device-tree. The old way of using platform data is not required anymore,
> as it was only used on the now removed ar71xx target.
> 
> Signed-off-by: David Bauer <mail@david-bauer.net>
> ---
>   .../ath/551-ath9k_ubnt_uap_plus_hsr.patch     | 35 ++++++-------------
>   .../files/include/linux/ath9k_platform.h      |  2 --
>   2 files changed, 10 insertions(+), 27 deletions(-)
> 
> diff --git a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
> index 4454baeef1..24cffb0e0e 100644
> --- a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
> +++ b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
> @@ -1,27 +1,26 @@
>   --- a/drivers/net/wireless/ath/ath9k/channel.c
>   +++ b/drivers/net/wireless/ath/ath9k/channel.c
> -@@ -15,6 +15,8 @@
> +@@ -15,6 +15,7 @@
>     */
>    
>    #include "ath9k.h"
> -+#include <linux/ath9k_platform.h>
>   +#include "hsr.h"
>    
>    /* Set/change channels.  If the channel is really being changed, it's done
>     * by reseting the chip.  To accomplish this we must first cleanup any pending
> -@@ -22,6 +24,7 @@
> +@@ -22,6 +23,7 @@
>     */
>    static int ath_set_channel(struct ath_softc *sc)
>    {
> -+	struct ath9k_platform_data *pdata = sc->dev->platform_data;
> ++	struct device_node *np = sc->dev->of_node;
>    	struct ath_hw *ah = sc->sc_ah;
>    	struct ath_common *common = ath9k_hw_common(ah);
>    	struct ieee80211_hw *hw = sc->hw;
> -@@ -42,6 +45,11 @@ static int ath_set_channel(struct ath_so
> +@@ -42,6 +44,11 @@ static int ath_set_channel(struct ath_so
>    	ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
>    		chan->center_freq, chandef->width);
>    
> -+	if (pdata && pdata->ubnt_hsr) {
> ++	if (of_property_read_bool(np, "ath9k,ubnt-hsr")) {

The vendor prefix should be "ubnt", not "ath9k"
(see Documentation/devicetree/bindings/vendor-prefixes.yaml for the
official list.)


>   +		ath9k_hsr_enable(ah, chandef->width, chan->center_freq);
>   +		ath9k_hsr_status(ah);
>   +	}
> @@ -332,30 +331,27 @@
>   +#endif /* HSR_H */
>   --- a/drivers/net/wireless/ath/ath9k/main.c
>   +++ b/drivers/net/wireless/ath/ath9k/main.c
> -@@ -16,8 +16,10 @@
> -

[...]
diff mbox series

Patch

diff --git a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
index 4454baeef1..24cffb0e0e 100644
--- a/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
+++ b/package/kernel/mac80211/patches/ath/551-ath9k_ubnt_uap_plus_hsr.patch
@@ -1,27 +1,26 @@ 
 --- a/drivers/net/wireless/ath/ath9k/channel.c
 +++ b/drivers/net/wireless/ath/ath9k/channel.c
-@@ -15,6 +15,8 @@
+@@ -15,6 +15,7 @@
   */
  
  #include "ath9k.h"
-+#include <linux/ath9k_platform.h>
 +#include "hsr.h"
  
  /* Set/change channels.  If the channel is really being changed, it's done
   * by reseting the chip.  To accomplish this we must first cleanup any pending
-@@ -22,6 +24,7 @@
+@@ -22,6 +23,7 @@
   */
  static int ath_set_channel(struct ath_softc *sc)
  {
-+	struct ath9k_platform_data *pdata = sc->dev->platform_data;
++	struct device_node *np = sc->dev->of_node;
  	struct ath_hw *ah = sc->sc_ah;
  	struct ath_common *common = ath9k_hw_common(ah);
  	struct ieee80211_hw *hw = sc->hw;
-@@ -42,6 +45,11 @@ static int ath_set_channel(struct ath_so
+@@ -42,6 +44,11 @@ static int ath_set_channel(struct ath_so
  	ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
  		chan->center_freq, chandef->width);
  
-+	if (pdata && pdata->ubnt_hsr) {
++	if (of_property_read_bool(np, "ath9k,ubnt-hsr")) {
 +		ath9k_hsr_enable(ah, chandef->width, chan->center_freq);
 +		ath9k_hsr_status(ah);
 +	}
@@ -332,30 +331,27 @@ 
 +#endif /* HSR_H */
 --- a/drivers/net/wireless/ath/ath9k/main.c
 +++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -16,8 +16,10 @@
- 
- #include <linux/nl80211.h>
+@@ -18,6 +18,7 @@
  #include <linux/delay.h>
-+#include <linux/ath9k_platform.h>
  #include "ath9k.h"
  #include "btcoex.h"
 +#include "hsr.h"
  
  u8 ath9k_parse_mpdudensity(u8 mpdudensity)
  {
-@@ -649,6 +651,7 @@ void ath_reset_work(struct work_struct *
+@@ -649,6 +650,7 @@ void ath_reset_work(struct work_struct *
  static int ath9k_start(struct ieee80211_hw *hw)
  {
  	struct ath_softc *sc = hw->priv;
-+	struct ath9k_platform_data *pdata = sc->dev->platform_data;
++	struct device_node *np = sc->dev->of_node;
  	struct ath_hw *ah = sc->sc_ah;
  	struct ath_common *common = ath9k_hw_common(ah);
  	struct ieee80211_channel *curchan = sc->cur_chan->chandef.chan;
-@@ -727,6 +730,11 @@ static int ath9k_start(struct ieee80211_
+@@ -727,6 +729,11 @@ static int ath9k_start(struct ieee80211_
  					  AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  	}
  
-+	if (pdata && pdata->ubnt_hsr) {
++	if (of_property_read_bool(np, "ath9k,ubnt-hsr")) {
 +		ath9k_hsr_init(ah);
 +		ath9k_hsr_disable(ah);
 +	}
@@ -373,17 +369,6 @@ 
  
  ath9k-$(CPTCFG_ATH9K_DEBUGFS) += debug.o
  
---- a/include/linux/ath9k_platform.h
-+++ b/include/linux/ath9k_platform.h
-@@ -53,6 +53,8 @@ struct ath9k_platform_data {
- 	unsigned num_btns;
- 	const struct gpio_keys_button *btns;
- 	unsigned btn_poll_interval;
-+
-+	bool ubnt_hsr;
- };
- 
- #endif /* _LINUX_ATH9K_PLATFORM_H */
 --- a/local-symbols
 +++ b/local-symbols
 @@ -112,6 +112,7 @@ ATH9K_WOW=
diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
index f1f2ad419c..e210108568 100644
--- a/target/linux/generic/files/include/linux/ath9k_platform.h
+++ b/target/linux/generic/files/include/linux/ath9k_platform.h
@@ -53,8 +53,6 @@  struct ath9k_platform_data {
 	unsigned num_btns;
 	const struct gpio_keys_button *btns;
 	unsigned btn_poll_interval;
-
-	bool ubnt_hsr;
 };
 
 #endif /* _LINUX_ATH9K_PLATFORM_H */