5f427f6b8fbfd22f4e5f820cf7781ad0398d7b10
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / ath10k / 984-ath10k-Try-to-get-mac-address-from-dts.patch
1 From 22fb5991a44c78ff18ec0082dc90c809356eb893 Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Sun, 27 Sep 2020 19:23:35 +0200
4 Subject: [PATCH 1/2] ath10k: Try to get mac-address from dts
5
6 Most of embedded device that have the ath10k wifi integrated store the
7 mac-address in nvmem partitions. Try to fetch the mac-address using the
8 standard 'of_get_mac_address' than in all the check also try to fetch the
9 address using the nvmem api searching for a defined 'mac-address' cell.
10 Mac-address defined in the dts have priority than any other address found.
11
12 Tested-on: QCA9984 hw1.0 PCI 10.4
13
14 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
15 ---
16 drivers/net/wireless/ath/ath10k/core.c | 10 ++++++++++
17 1 file changed, 10 insertions(+)
18
19 diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
20 index 5f4e12196..9ed7b9883 100644
21 --- a/drivers/net/wireless/ath/ath10k/core.c
22 +++ b/drivers/net/wireless/ath/ath10k/core.c
23 @@ -8,6 +8,7 @@
24 #include <linux/module.h>
25 #include <linux/firmware.h>
26 #include <linux/of.h>
27 +#include <linux/of_net.h>
28 #include <linux/property.h>
29 #include <linux/dmi.h>
30 #include <linux/ctype.h>
31 @@ -3062,6 +3068,8 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
32
33 device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
34
35 + of_get_mac_address(ar->dev->of_node, ar->mac_addr);
36 +
37 ret = ath10k_core_init_firmware_features(ar);
38 if (ret) {
39 ath10k_err(ar, "fatal problem with firmware features: %d\n",
40 --
41 2.27.0
42