mac80211: convert UniFi Outdoor+ HSR support to OF
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath / 551-ath9k_ubnt_uap_plus_hsr.patch
index 4454baeef180d44f51c282ef4878e989c962a2c9..bc5c1ab4efe147c7149e3e4ff2f9268b45ec89de 100644 (file)
@@ -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, "ubnt,hsr")) {
 +              ath9k_hsr_enable(ah, chandef->width, chan->center_freq);
 +              ath9k_hsr_status(ah);
 +      }
 +#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, "ubnt,hsr")) {
 +              ath9k_hsr_init(ah);
 +              ath9k_hsr_disable(ah);
 +      }
  
  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=