aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>2016-11-26 01:01:12 +0100
committerMathias Kresin <dev@kresin.me>2016-11-29 21:40:16 +0100
commit1847248fc1560d10cb49c88b343598c9cb673f38 (patch)
treeb33dcd3f1425afb69cc565bd7625d51f27c86929
parenta15ea362d7279420d3b620412bbb007f9b02b77f (diff)
downloadupstream-1847248fc1560d10cb49c88b343598c9cb673f38.tar.gz
upstream-1847248fc1560d10cb49c88b343598c9cb673f38.tar.bz2
upstream-1847248fc1560d10cb49c88b343598c9cb673f38.zip
kernel: mac80211: backport ath9k device tree support patches
These patches add support for configuring ath9k based devices via devicetree. This was tested on PCI(e) based devices. This should work for AHB based devices as well (adding more AHB specific properties may still be needed) as soon as the ath79 platform is ready to populate the ath9k wmac via devicetree. This patchset was accepted upstream, more information can be found on the linux-wireless list: https://www.spinics.net/lists/linux-wireless/msg155474.html Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
-rw-r--r--package/kernel/mac80211/patches/326-Documentation-dt-net-add-ath9k-wireless-device-bindi.patch67
-rw-r--r--package/kernel/mac80211/patches/327-ath9k-add-a-helper-to-get-the-string-representation-.patch42
-rw-r--r--package/kernel/mac80211/patches/328-ath9k-parse-the-device-configuration-from-an-OF-node.patch85
3 files changed, 194 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/326-Documentation-dt-net-add-ath9k-wireless-device-bindi.patch b/package/kernel/mac80211/patches/326-Documentation-dt-net-add-ath9k-wireless-device-bindi.patch
new file mode 100644
index 0000000000..72a459c9e6
--- /dev/null
+++ b/package/kernel/mac80211/patches/326-Documentation-dt-net-add-ath9k-wireless-device-bindi.patch
@@ -0,0 +1,67 @@
+From b263e0bb9d4585ca3ec04d7257ca5308d21333bb Mon Sep 17 00:00:00 2001
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Date: Sun, 16 Oct 2016 22:59:05 +0200
+Subject: [PATCH 1/3] Documentation: dt: net: add ath9k wireless device binding
+
+Add documentation how devicetree can be used to configure ath9k based
+devices.
+
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Acked-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
+---
+ .../devicetree/bindings/net/wireless/qca,ath9k.txt | 48 ++++++++++++++++++++++
+ 1 file changed, 48 insertions(+)
+ create mode 100644 Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
+
+--- /dev/null
++++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
+@@ -0,0 +1,48 @@
++* Qualcomm Atheros ath9k wireless devices
++
++This node provides properties for configuring the ath9k wireless device. The
++node is expected to be specified as a child node of the PCI controller to
++which the wireless chip is connected.
++
++Required properties:
++- compatible: For PCI and PCIe devices this should be an identifier following
++ the format as defined in "PCI Bus Binding to Open Firmware"
++ Revision 2.1. One of the possible formats is "pciVVVV,DDDD"
++ where VVVV is the PCI vendor ID and DDDD is PCI device ID.
++ Typically QCA's PCI vendor ID 168c is used while the PCI device
++ ID depends on the chipset - see the following (possibly
++ incomplete) list:
++ - 0023 for AR5416
++ - 0024 for AR5418
++ - 0027 for AR9160
++ - 0029 for AR9220 and AR9223
++ - 002a for AR9280 and AR9283
++ - 002b for AR9285
++ - 002c for AR2427
++ - 002d for AR9227
++ - 002e for AR9287
++ - 0030 for AR9380, AR9381 and AR9382
++ - 0032 for AR9485
++ - 0033 for AR9580 and AR9590
++ - 0034 for AR9462
++ - 0036 for AR9565
++ - 0037 for AR9485
++- reg: Address and length of the register set for the device.
++
++Optional properties:
++- qca,no-eeprom: Indicates that there is no physical EEPROM connected to the
++ ath9k wireless chip (in this case the calibration /
++ EEPROM data will be loaded from userspace using the
++ kernel firmware loader).
++- mac-address: See ethernet.txt in the parent directory
++- local-mac-address: See ethernet.txt in the parent directory
++
++
++In this example, the node is defined as child node of the PCI controller:
++&pci0 {
++ wifi@168c,002d {
++ compatible = "pci168c,002d";
++ reg = <0x7000 0 0 0 0x1000>;
++ qca,no-eeprom;
++ };
++};
diff --git a/package/kernel/mac80211/patches/327-ath9k-add-a-helper-to-get-the-string-representation-.patch b/package/kernel/mac80211/patches/327-ath9k-add-a-helper-to-get-the-string-representation-.patch
new file mode 100644
index 0000000000..c191495b84
--- /dev/null
+++ b/package/kernel/mac80211/patches/327-ath9k-add-a-helper-to-get-the-string-representation-.patch
@@ -0,0 +1,42 @@
+From 25b8b2d57def4854558c135228a52326a7d346ad Mon Sep 17 00:00:00 2001
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Date: Sun, 16 Oct 2016 22:59:06 +0200
+Subject: [PATCH 2/3] ath9k: add a helper to get the string representation of
+ ath_bus_type
+
+This can be used when the ath_bus_type has to be presented in a log
+message or firmware filename.
+
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
+---
+ drivers/net/wireless/ath/ath.h | 6 ++++++
+ drivers/net/wireless/ath/main.c | 7 +++++++
+ 2 files changed, 13 insertions(+)
+
+--- a/drivers/net/wireless/ath/ath.h
++++ b/drivers/net/wireless/ath/ath.h
+@@ -327,4 +327,10 @@ static inline const char *ath_opmode_to_
+ }
+ #endif
+
++extern const char *ath_bus_type_strings[];
++static inline const char *ath_bus_type_to_string(enum ath_bus_type bustype)
++{
++ return ath_bus_type_strings[bustype];
++}
++
+ #endif /* ATH_H */
+--- a/drivers/net/wireless/ath/main.c
++++ b/drivers/net/wireless/ath/main.c
+@@ -90,3 +90,10 @@ void ath_printk(const char *level, const
+ va_end(args);
+ }
+ EXPORT_SYMBOL(ath_printk);
++
++const char *ath_bus_type_strings[] = {
++ [ATH_PCI] = "pci",
++ [ATH_AHB] = "ahb",
++ [ATH_USB] = "usb",
++};
++EXPORT_SYMBOL(ath_bus_type_strings);
diff --git a/package/kernel/mac80211/patches/328-ath9k-parse-the-device-configuration-from-an-OF-node.patch b/package/kernel/mac80211/patches/328-ath9k-parse-the-device-configuration-from-an-OF-node.patch
new file mode 100644
index 0000000000..b260858d45
--- /dev/null
+++ b/package/kernel/mac80211/patches/328-ath9k-parse-the-device-configuration-from-an-OF-node.patch
@@ -0,0 +1,85 @@
+From cea03be5a848823cb8052e2e7b93cb2249d5f60c Mon Sep 17 00:00:00 2001
+From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Date: Sun, 16 Oct 2016 22:59:07 +0200
+Subject: [PATCH 3/3] ath9k: parse the device configuration from an OF node
+
+This allows setting the MAC address and specifying that the firmware
+will be requested from userspace (because there might not be a hardware
+EEPROM connected to the chip) for ath9k based PCI devices using
+the device tree.
+
+There is some out-of-tree code to "convert devicetree to
+ath9k_platform_data" (for example in OpenWrt and LEDE) which becomes
+obsolete with this patch.
+
+Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
+---
+ drivers/net/wireless/ath/ath9k/init.c | 42 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
+
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -20,6 +20,8 @@
+ #include <linux/slab.h>
+ #include <linux/ath9k_platform.h>
+ #include <linux/module.h>
++#include <linux/of.h>
++#include <linux/of_net.h>
+ #include <linux/relay.h>
+ #include <net/ieee80211_radiotap.h>
+
+@@ -554,6 +556,42 @@ static int ath9k_init_platform(struct at
+ return 0;
+ }
+
++static int ath9k_of_init(struct ath_softc *sc)
++{
++ struct device_node *np = sc->dev->of_node;
++ struct ath_hw *ah = sc->sc_ah;
++ struct ath_common *common = ath9k_hw_common(ah);
++ enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
++ const char *mac;
++ char eeprom_name[100];
++ int ret;
++
++ if (!of_device_is_available(np))
++ return 0;
++
++ ath_dbg(common, CONFIG, "parsing configuration from OF node\n");
++
++ if (of_property_read_bool(np, "qca,no-eeprom")) {
++ /* ath9k-eeprom-<bus>-<id>.bin */
++ scnprintf(eeprom_name, sizeof(eeprom_name),
++ "ath9k-eeprom-%s-%s.bin",
++ ath_bus_type_to_string(bus_type), dev_name(ah->dev));
++
++ ret = ath9k_eeprom_request(sc, eeprom_name);
++ if (ret)
++ return ret;
++ }
++
++ mac = of_get_mac_address(np);
++ if (mac)
++ ether_addr_copy(common->macaddr, mac);
++
++ ah->ah_flags &= ~AH_USE_EEPROM;
++ ah->ah_flags |= AH_NO_EEP_SWAP;
++
++ return 0;
++}
++
+ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
+ const struct ath_bus_ops *bus_ops)
+ {
+@@ -610,6 +648,10 @@ static int ath9k_init_softc(u16 devid, s
+ if (ret)
+ return ret;
+
++ ret = ath9k_of_init(sc);
++ if (ret)
++ return ret;
++
+ if (ath9k_led_active_high != -1)
+ ah->config.led_active_high = ath9k_led_active_high == 1;
+