aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2021-04-03 00:31:08 +0200
committerPetr Štetiar <ynezz@true.cz>2021-07-19 14:51:22 +0200
commit985954ccbd11ba716dc0569c5101583a4a74b215 (patch)
treebea6de5c9df5e943f57ce3dabd04db8c411b121f /package
parent3a94c2ca5cf7c11ca150fa3ae884e7be8d07a281 (diff)
downloadupstream-985954ccbd11ba716dc0569c5101583a4a74b215.tar.gz
upstream-985954ccbd11ba716dc0569c5101583a4a74b215.tar.bz2
upstream-985954ccbd11ba716dc0569c5101583a4a74b215.zip
kernel: add ath10k support for of_get_mac_address
ath10k doesn't currently support the standard function to get mac-address from the dts. Add this for both ath10k and ath10k-ct Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'package')
-rw-r--r--package/kernel/ath10k-ct/patches/203-ath10k-Try-to-get-mac-address-from-dts.patch59
-rw-r--r--package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch59
2 files changed, 118 insertions, 0 deletions
diff --git a/package/kernel/ath10k-ct/patches/203-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/ath10k-ct/patches/203-ath10k-Try-to-get-mac-address-from-dts.patch
new file mode 100644
index 0000000000..dbaef20b98
--- /dev/null
+++ b/package/kernel/ath10k-ct/patches/203-ath10k-Try-to-get-mac-address-from-dts.patch
@@ -0,0 +1,59 @@
+From 22fb5991a44c78ff18ec0082dc90c809356eb893 Mon Sep 17 00:00:00 2001
+From: Ansuel Smith <ansuelsmth@gmail.com>
+Date: Sun, 27 Sep 2020 19:23:35 +0200
+Subject: [PATCH 1/2] ath10k: Try to get mac-address from dts
+
+Most of embedded device that have the ath10k wifi integrated store the
+mac-address in nvmem partitions. Try to fetch the mac-address using the
+standard 'of_get_mac_address' than in all the check also try to fetch the
+address using the nvmem api searching for a defined 'mac-address' cell.
+Mac-address defined in the dts have priority than any other address found.
+
+Tested-on: QCA9984 hw1.0 PCI 10.4
+
+Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
+---
+ ath10k-5.10/core.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/ath10k-5.10/core.c b/ath10k-5.10/core.c
+index 5f4e12196..9ed7b9883 100644
+--- a/ath10k-5.10/core.c
++++ b/ath10k-5.10/core.c
+@@ -8,6 +8,9 @@
+ #include <linux/module.h>
+ #include <linux/firmware.h>
+ #include <linux/of.h>
++#include <linux/of_net.h>
++#include <linux/of_platform.h>
++#include <linux/property.h>
+ #include <linux/property.h>
+ #include <linux/dmi.h>
+ #include <linux/ctype.h>
+@@ -2961,8 +2963,12 @@ EXPORT_SYMBOL(ath10k_core_stop);
+ static int ath10k_core_probe_fw(struct ath10k *ar)
+ {
+ struct bmi_target_info target_info;
++ const char *mac;
+ int ret = 0;
+
++ /* register the platform to be found by the of api */
++ of_platform_device_create(ar->dev->of_node, NULL, NULL);
++
+ ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL);
+ if (ret) {
+ ath10k_err(ar, "could not power on hif bus (%d)\n", ret);
+@@ -3062,6 +3068,10 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
+
+ device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
+
++ mac = of_get_mac_address(ar->dev->of_node);
++ if (!IS_ERR(mac))
++ ether_addr_copy(ar->mac_addr, mac);
++
+ ret = ath10k_core_init_firmware_features(ar);
+ if (ret) {
+ ath10k_err(ar, "fatal problem with firmware features: %d\n",
+--
+2.27.0
+
diff --git a/package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch b/package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch
new file mode 100644
index 0000000000..94eac3fa4a
--- /dev/null
+++ b/package/kernel/mac80211/patches/ath/984-ath10k-Try-to-get-mac-address-from-dts.patch
@@ -0,0 +1,59 @@
+From 22fb5991a44c78ff18ec0082dc90c809356eb893 Mon Sep 17 00:00:00 2001
+From: Ansuel Smith <ansuelsmth@gmail.com>
+Date: Sun, 27 Sep 2020 19:23:35 +0200
+Subject: [PATCH 1/2] ath10k: Try to get mac-address from dts
+
+Most of embedded device that have the ath10k wifi integrated store the
+mac-address in nvmem partitions. Try to fetch the mac-address using the
+standard 'of_get_mac_address' than in all the check also try to fetch the
+address using the nvmem api searching for a defined 'mac-address' cell.
+Mac-address defined in the dts have priority than any other address found.
+
+Tested-on: QCA9984 hw1.0 PCI 10.4
+
+Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
+---
+ drivers/net/wireless/ath/ath10k/core.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
+index 5f4e12196..9ed7b9883 100644
+--- a/drivers/net/wireless/ath/ath10k/core.c
++++ b/drivers/net/wireless/ath/ath10k/core.c
+@@ -8,6 +8,9 @@
+ #include <linux/module.h>
+ #include <linux/firmware.h>
+ #include <linux/of.h>
++#include <linux/of_net.h>
++#include <linux/of_platform.h>
++#include <linux/property.h>
+ #include <linux/property.h>
+ #include <linux/dmi.h>
+ #include <linux/ctype.h>
+@@ -2961,8 +2963,12 @@ EXPORT_SYMBOL(ath10k_core_stop);
+ static int ath10k_core_probe_fw(struct ath10k *ar)
+ {
+ struct bmi_target_info target_info;
++ const char *mac;
+ int ret = 0;
+
++ /* register the platform to be found by the of api */
++ of_platform_device_create(ar->dev->of_node, NULL, NULL);
++
+ ret = ath10k_hif_power_up(ar, ATH10K_FIRMWARE_MODE_NORMAL);
+ if (ret) {
+ ath10k_err(ar, "could not power on hif bus (%d)\n", ret);
+@@ -3062,6 +3068,10 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
+
+ device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
+
++ mac = of_get_mac_address(ar->dev->of_node);
++ if (!IS_ERR(mac))
++ ether_addr_copy(ar->mac_addr, mac);
++
+ ret = ath10k_core_init_firmware_features(ar);
+ if (ret) {
+ ath10k_err(ar, "fatal problem with firmware features: %d\n",
+--
+2.27.0
+