ce3ebcc2a69243a1caec2ae145057c91c69b4802
[openwrt/openwrt.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 --- a/drivers/net/wireless/ath/ath10k/core.c
20 +++ b/drivers/net/wireless/ath/ath10k/core.c
21 @@ -8,6 +8,7 @@
22 #include <linux/module.h>
23 #include <linux/firmware.h>
24 #include <linux/of.h>
25 +#include <linux/of_net.h>
26 #include <linux/property.h>
27 #include <linux/dmi.h>
28 #include <linux/ctype.h>
29 @@ -3243,6 +3244,8 @@ static int ath10k_core_probe_fw(struct a
30
31 device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
32
33 + of_get_mac_address(ar->dev->of_node, ar->mac_addr);
34 +
35 ret = ath10k_core_init_firmware_features(ar);
36 if (ret) {
37 ath10k_err(ar, "fatal problem with firmware features: %d\n",