mac80211: convert UniFi Outdoor+ HSR support to OF

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>
This commit is contained in:
David Bauer 2021-01-07 01:03:05 +01:00
parent cbedb5de75
commit 0c499f6068
2 changed files with 10 additions and 27 deletions

View 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);
+ }
@ -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, "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=

View File

@ -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 */