[PATCH] ipq806x: R7800: mtd-mac-address test

Christian Lamparter chunkeey at gmail.com
Sat Dec 15 04:56:14 EST 2018


---
 ...76-ath10k-implement-set-base-macaddr.patch | 172 ++++++++++++++++++
 ...MAC-address-from-system-firmware-if-.patch |  48 +++++
 ...77-ath10k-implement-set-base-macaddr.patch | 172 ++++++++++++++++++
 ...MAC-address-from-system-firmware-if-.patch |  51 ++++++
 ...-call-of_get_mac_address-from-device.patch |  23 +++
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |   3 +-
 .../arch/arm/boot/dts/qcom-ipq8065-r7800.dts  |  34 +++-
 7 files changed, 499 insertions(+), 4 deletions(-)
 create mode 100644 package/kernel/ath10k-ct/patches/976-ath10k-implement-set-base-macaddr.patch
 create mode 100644 package/kernel/ath10k-ct/patches/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch
 create mode 100644 package/kernel/mac80211/patches/ath/977-ath10k-implement-set-base-macaddr.patch
 create mode 100644 package/kernel/mac80211/patches/ath/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch
 create mode 100644 target/linux/generic/hack-4.14/950-call-of_get_mac_address-from-device.patch

diff --git a/package/kernel/ath10k-ct/patches/976-ath10k-implement-set-base-macaddr.patch b/package/kernel/ath10k-ct/patches/976-ath10k-implement-set-base-macaddr.patch
new file mode 100644
index 0000000000..23495b17cf
--- /dev/null
+++ b/package/kernel/ath10k-ct/patches/976-ath10k-implement-set-base-macaddr.patch
@@ -0,0 +1,172 @@
+--- a/ath10k-4.19/core.c
++++ b/ath10k-4.19/core.c
+@@ -2938,6 +2938,13 @@ int ath10k_core_start(struct ath10k *ar,
+ 		goto err_hif_stop;
+ 	}
+ 
++	status = ath10k_wmi_pdev_set_base_macaddr(ar, ar->mac_addr);
++	if (status) {
++		ath10k_err(ar,
++			   "failed to set base mac address: %d\n", status);
++		goto err_hif_stop;
++	}
++
+ 	/* Some firmware revisions do not properly set up hardware rx filter
+ 	 * registers.
+ 	 *
+--- a/ath10k-4.19/wmi-ops.h
++++ b/ath10k-4.19/wmi-ops.h
+@@ -64,6 +64,8 @@ struct wmi_ops {
+ 
+ 	enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar);
+ 
++	struct sk_buff *(*gen_pdev_set_base_macaddr)(struct ath10k *ar,
++						     const u8 macaddr[ETH_ALEN]);
+ 	struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt);
+ 	struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar);
+ 	struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g,
+@@ -506,6 +508,22 @@ ath10k_wmi_pdev_set_regdomain(struct ath
+ }
+ 
+ static inline int
++ath10k_wmi_pdev_set_base_macaddr(struct ath10k *ar, const u8 macaddr[ETH_ALEN])
++{
++	struct sk_buff *skb;
++
++	if (!ar->wmi.ops->gen_pdev_set_base_macaddr)
++		return -EOPNOTSUPP;
++
++	skb = ar->wmi.ops->gen_pdev_set_base_macaddr(ar, macaddr);
++	if (IS_ERR(skb))
++		return PTR_ERR(skb);
++
++	return ath10k_wmi_cmd_send(ar, skb,
++				   ar->wmi.cmd->pdev_set_base_macaddr_cmdid);
++}
++
++static inline int
+ ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt)
+ {
+ 	struct sk_buff *skb;
+--- a/ath10k-4.19/wmi-tlv.c
++++ b/ath10k-4.19/wmi-tlv.c
+@@ -2221,6 +2221,29 @@ ath10k_wmi_tlv_op_gen_peer_create(struct
+ }
+ 
+ static struct sk_buff *
++ath10k_wmi_tlv_op_gen_pdev_set_base_macaddr(struct ath10k *ar,
++					    const u8 addr[ETH_ALEN])
++{
++	struct wmi_pdev_set_base_macaddr_cmd *cmd;
++	struct wmi_tlv *tlv;
++	struct sk_buff *skb;
++
++	skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd));
++	if (!skb)
++		return ERR_PTR(-ENOMEM);
++
++	tlv = (void *)skb->data;
++	tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_BASE_MACADDR_CMD);
++	tlv->len = __cpu_to_le16(sizeof(*cmd));
++	cmd = (void *)tlv->value;
++	ether_addr_copy(cmd->mac_addr.addr, addr);
++
++	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv set base macaddr\n");
++	return skb;
++}
++
++
++static struct sk_buff *
+ ath10k_wmi_tlv_op_gen_peer_delete(struct ath10k *ar, u32 vdev_id,
+ 				  const u8 peer_addr[ETH_ALEN])
+ {
+@@ -3921,6 +3944,8 @@ static const struct wmi_ops wmi_tlv_ops
+ 	.gen_pdev_resume = ath10k_wmi_tlv_op_gen_pdev_resume,
+ 	.gen_pdev_set_rd = ath10k_wmi_tlv_op_gen_pdev_set_rd,
+ 	.gen_pdev_set_param = ath10k_wmi_tlv_op_gen_pdev_set_param,
++	.gen_pdev_set_base_macaddr =
++			ath10k_wmi_tlv_op_gen_pdev_set_base_macaddr,
+ 	.gen_init = ath10k_wmi_tlv_op_gen_init,
+ 	.gen_start_scan = ath10k_wmi_tlv_op_gen_start_scan,
+ 	.gen_stop_scan = ath10k_wmi_tlv_op_gen_stop_scan,
+--- a/ath10k-4.19/wmi.c
++++ b/ath10k-4.19/wmi.c
+@@ -6545,6 +6545,25 @@ int ath10k_wmi_connect(struct ath10k *ar
+ }
+ 
+ static struct sk_buff *
++ath10k_wmi_op_gen_pdev_set_base_macaddr(struct ath10k *ar,
++					const u8 macaddr[ETH_ALEN])
++{
++	struct wmi_pdev_set_base_macaddr_cmd *cmd;
++	struct sk_buff *skb;
++
++	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
++	if (!skb)
++		return ERR_PTR(-ENOMEM);
++
++	cmd = (struct wmi_pdev_set_base_macaddr_cmd *)skb->data;
++	ether_addr_copy(cmd->mac_addr.addr, macaddr);
++
++	ath10k_dbg(ar, ATH10K_DBG_WMI,
++		   "wmi pdev basemac %pM\n", macaddr);
++	return skb;
++}
++
++static struct sk_buff *
+ ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g,
+ 			      u16 ctl2g, u16 ctl5g,
+ 			      enum wmi_dfs_region dfs_reg)
+@@ -9571,6 +9590,7 @@ static const struct wmi_ops wmi_ops = {
+ 	.gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
+ 	.gen_pdev_set_rd = ath10k_wmi_op_gen_pdev_set_rd,
+ 	.gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	.gen_init = ath10k_wmi_op_gen_init,
+ 	.gen_start_scan = ath10k_wmi_op_gen_start_scan,
+ 	.gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
+@@ -9648,6 +9668,7 @@ static const struct wmi_ops wmi_10_1_ops
+ 	.gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
+ 	.gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
+ 	.gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	.gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
+ 	.gen_vdev_create = ath10k_wmi_op_gen_vdev_create,
+ 	.gen_vdev_delete = ath10k_wmi_op_gen_vdev_delete,
+@@ -9704,6 +9725,7 @@ static const struct wmi_ops wmi_10_2_ops
+ 	.pull_fw_stats = ath10k_wmi_10_2_op_pull_fw_stats,
+ 	.gen_init = ath10k_wmi_10_2_op_gen_init,
+ 	.gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	/* .gen_pdev_get_temperature not implemented */
+ 
+ 	/* shared with 10.1 */
+@@ -9775,6 +9797,7 @@ static const struct wmi_ops wmi_10_2_4_o
+ 	.gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
+ 	.gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
+ 	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 
+ 	/* shared with 10.1 */
+ 	.map_svc = wmi_10x_svc_map,
+@@ -9917,6 +9940,7 @@ static const struct wmi_ops wmi_10_4_ops
+ 	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
+ 	.gen_echo = ath10k_wmi_op_gen_echo,
+ 	.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	.gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
+ 	.gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
+ };
+--- a/ath10k-4.19/wmi.h
++++ b/ath10k-4.19/wmi.h
+@@ -4190,6 +4190,10 @@ struct wmi_pdev_set_param_cmd {
+ 	__le32 param_value;
+ } __packed;
+ 
++struct wmi_pdev_set_base_macaddr_cmd {
++	struct wmi_mac_addr mac_addr;
++} __packed;
++
+ /* valid period is 1 ~ 60000ms, unit in millisecond */
+ #define WMI_PDEV_PARAM_CAL_PERIOD_MAX 60000
+ 
diff --git a/package/kernel/ath10k-ct/patches/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch b/package/kernel/ath10k-ct/patches/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch
new file mode 100644
index 0000000000..4da5df1f34
--- /dev/null
+++ b/package/kernel/ath10k-ct/patches/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch
@@ -0,0 +1,48 @@
+From 9d5804662ce1f9bdde0a14c3c40940acbbf09538 Mon Sep 17 00:00:00 2001
+From: Brian Norris <briannorris at chromium.org>
+Date: Tue, 28 Aug 2018 19:48:17 +0300
+Subject: [PATCH] ath10k: retrieve MAC address from system firmware if provided
+
+Devices may provide their own MAC address via system firmware (e.g.,
+device tree), especially in the case where the device doesn't have a
+useful EEPROM on which to store its MAC address (e.g., for integrated
+Wifi).
+
+Use the generic device helper to retrieve the MAC address, and (if
+present) honor it above the MAC address advertised by the card.
+
+Signed-off-by: Brian Norris <briannorris at chromium.org>
+Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
+---
+
+--- a/ath10k-4.19/core.c
++++ b/ath10k-4.19/core.c
+@@ -19,6 +19,7 @@
+ #include <linux/module.h>
+ #include <linux/firmware.h>
+ #include <linux/of.h>
++#include <linux/property.h>
+ #include <linux/dmi.h>
+ #include <linux/ctype.h>
+ #include <asm/byteorder.h>
+@@ -3276,6 +3277,8 @@ static int ath10k_core_probe_fw(struct a
+ 		ath10k_debug_print_board_info(ar);
+ 	}
+ 
++	device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); pr_info("MAC:ADDR %pM\n", ar->mac_addr);
++
+ 	ret = ath10k_core_init_firmware_features(ar);
+ 	if (ret) {
+ 		ath10k_err(ar, "fatal problem with firmware features: %d\n",
+--- a/ath10k-4.19/wmi.c
++++ b/ath10k-4.19/wmi.c
+@@ -5867,7 +5867,8 @@ int ath10k_wmi_event_ready(struct ath10k
+ 		   arg.mac_addr,
+ 		   __le32_to_cpu(arg.status));
+ 
+-	ether_addr_copy(ar->mac_addr, arg.mac_addr);
++	if (is_zero_ether_addr(ar->mac_addr))
++		ether_addr_copy(ar->mac_addr, arg.mac_addr);
+ 	complete(&ar->wmi.unified_ready);
+ 	return 0;
+ }
diff --git a/package/kernel/mac80211/patches/ath/977-ath10k-implement-set-base-macaddr.patch b/package/kernel/mac80211/patches/ath/977-ath10k-implement-set-base-macaddr.patch
new file mode 100644
index 0000000000..5ec2ff8981
--- /dev/null
+++ b/package/kernel/mac80211/patches/ath/977-ath10k-implement-set-base-macaddr.patch
@@ -0,0 +1,172 @@
+--- a/drivers/net/wireless/ath/ath10k/core.c
++++ b/drivers/net/wireless/ath/ath10k/core.c
+@@ -2398,6 +2398,13 @@ int ath10k_core_start(struct ath10k *ar,
+ 		goto err_hif_stop;
+ 	}
+ 
++	status = ath10k_wmi_pdev_set_base_macaddr(ar, ar->mac_addr);
++	if (status) {
++		ath10k_err(ar,
++			   "failed to set base mac address: %d\n", status);
++		goto err_hif_stop;
++	}
++
+ 	/* Some firmware revisions do not properly set up hardware rx filter
+ 	 * registers.
+ 	 *
+--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
++++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
+@@ -64,6 +64,8 @@ struct wmi_ops {
+ 
+ 	enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar);
+ 
++	struct sk_buff *(*gen_pdev_set_base_macaddr)(struct ath10k *ar,
++						     const u8 macaddr[ETH_ALEN]);
+ 	struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt);
+ 	struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar);
+ 	struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g,
+@@ -504,6 +506,22 @@ ath10k_wmi_pdev_set_regdomain(struct ath
+ }
+ 
+ static inline int
++ath10k_wmi_pdev_set_base_macaddr(struct ath10k *ar, const u8 macaddr[ETH_ALEN])
++{
++	struct sk_buff *skb;
++
++	if (!ar->wmi.ops->gen_pdev_set_base_macaddr)
++		return -EOPNOTSUPP;
++
++	skb = ar->wmi.ops->gen_pdev_set_base_macaddr(ar, macaddr);
++	if (IS_ERR(skb))
++		return PTR_ERR(skb);
++
++	return ath10k_wmi_cmd_send(ar, skb,
++				   ar->wmi.cmd->pdev_set_base_macaddr_cmdid);
++}
++
++static inline int
+ ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt)
+ {
+ 	struct sk_buff *skb;
+--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+@@ -2221,6 +2221,29 @@ ath10k_wmi_tlv_op_gen_peer_create(struct
+ }
+ 
+ static struct sk_buff *
++ath10k_wmi_tlv_op_gen_pdev_set_base_macaddr(struct ath10k *ar,
++					    const u8 addr[ETH_ALEN])
++{
++	struct wmi_pdev_set_base_macaddr_cmd *cmd;
++	struct wmi_tlv *tlv;
++	struct sk_buff *skb;
++
++	skb = ath10k_wmi_alloc_skb(ar, sizeof(*tlv) + sizeof(*cmd));
++	if (!skb)
++		return ERR_PTR(-ENOMEM);
++
++	tlv = (void *)skb->data;
++	tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_PDEV_SET_BASE_MACADDR_CMD);
++	tlv->len = __cpu_to_le16(sizeof(*cmd));
++	cmd = (void *)tlv->value;
++	ether_addr_copy(cmd->mac_addr.addr, addr);
++
++	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv set base macaddr\n");
++	return skb;
++}
++
++
++static struct sk_buff *
+ ath10k_wmi_tlv_op_gen_peer_delete(struct ath10k *ar, u32 vdev_id,
+ 				  const u8 peer_addr[ETH_ALEN])
+ {
+@@ -3921,6 +3944,8 @@ static const struct wmi_ops wmi_tlv_ops
+ 	.gen_pdev_resume = ath10k_wmi_tlv_op_gen_pdev_resume,
+ 	.gen_pdev_set_rd = ath10k_wmi_tlv_op_gen_pdev_set_rd,
+ 	.gen_pdev_set_param = ath10k_wmi_tlv_op_gen_pdev_set_param,
++	.gen_pdev_set_base_macaddr =
++			ath10k_wmi_tlv_op_gen_pdev_set_base_macaddr,
+ 	.gen_init = ath10k_wmi_tlv_op_gen_init,
+ 	.gen_start_scan = ath10k_wmi_tlv_op_gen_start_scan,
+ 	.gen_stop_scan = ath10k_wmi_tlv_op_gen_stop_scan,
+--- a/drivers/net/wireless/ath/ath10k/wmi.c
++++ b/drivers/net/wireless/ath/ath10k/wmi.c
+@@ -6127,6 +6127,25 @@ int ath10k_wmi_connect(struct ath10k *ar
+ }
+ 
+ static struct sk_buff *
++ath10k_wmi_op_gen_pdev_set_base_macaddr(struct ath10k *ar,
++					const u8 macaddr[ETH_ALEN])
++{
++	struct wmi_pdev_set_base_macaddr_cmd *cmd;
++	struct sk_buff *skb;
++
++	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
++	if (!skb)
++		return ERR_PTR(-ENOMEM);
++
++	cmd = (struct wmi_pdev_set_base_macaddr_cmd *)skb->data;
++	ether_addr_copy(cmd->mac_addr.addr, macaddr);
++
++	ath10k_dbg(ar, ATH10K_DBG_WMI,
++		   "wmi pdev basemac %pM\n", macaddr);
++	return skb;
++}
++
++static struct sk_buff *
+ ath10k_wmi_op_gen_pdev_set_rd(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g,
+ 			      u16 ctl2g, u16 ctl5g,
+ 			      enum wmi_dfs_region dfs_reg)
+@@ -8791,6 +8810,7 @@ static const struct wmi_ops wmi_ops = {
+ 	.gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
+ 	.gen_pdev_set_rd = ath10k_wmi_op_gen_pdev_set_rd,
+ 	.gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	.gen_init = ath10k_wmi_op_gen_init,
+ 	.gen_start_scan = ath10k_wmi_op_gen_start_scan,
+ 	.gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
+@@ -8850,6 +8870,7 @@ static const struct wmi_ops wmi_10_1_ops
+ 	.gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
+ 	.gen_start_scan = ath10k_wmi_10x_op_gen_start_scan,
+ 	.gen_peer_assoc = ath10k_wmi_10_1_op_gen_peer_assoc,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	/* .gen_pdev_get_temperature not implemented */
+ 
+ 	/* shared with main branch */
+@@ -8918,6 +8939,7 @@ static const struct wmi_ops wmi_10_2_ops
+ 	.pull_fw_stats = ath10k_wmi_10_2_op_pull_fw_stats,
+ 	.gen_init = ath10k_wmi_10_2_op_gen_init,
+ 	.gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	/* .gen_pdev_get_temperature not implemented */
+ 
+ 	/* shared with 10.1 */
+@@ -8989,6 +9011,7 @@ static const struct wmi_ops wmi_10_2_4_o
+ 	.gen_peer_assoc = ath10k_wmi_10_2_op_gen_peer_assoc,
+ 	.gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
+ 	.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 
+ 	/* shared with 10.1 */
+ 	.map_svc = wmi_10x_svc_map,
+@@ -9080,6 +9103,7 @@ static const struct wmi_ops wmi_10_4_ops
+ 	.gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
+ 	.gen_pdev_set_rd = ath10k_wmi_10x_op_gen_pdev_set_rd,
+ 	.gen_pdev_set_param = ath10k_wmi_op_gen_pdev_set_param,
++	.gen_pdev_set_base_macaddr = ath10k_wmi_op_gen_pdev_set_base_macaddr,
+ 	.gen_init = ath10k_wmi_10_4_op_gen_init,
+ 	.gen_start_scan = ath10k_wmi_op_gen_start_scan,
+ 	.gen_stop_scan = ath10k_wmi_op_gen_stop_scan,
+--- a/drivers/net/wireless/ath/ath10k/wmi.h
++++ b/drivers/net/wireless/ath/ath10k/wmi.h
+@@ -4085,6 +4085,10 @@ struct wmi_pdev_set_param_cmd {
+ 	__le32 param_value;
+ } __packed;
+ 
++struct wmi_pdev_set_base_macaddr_cmd {
++	struct wmi_mac_addr mac_addr;
++} __packed;
++
+ /* valid period is 1 ~ 60000ms, unit in millisecond */
+ #define WMI_PDEV_PARAM_CAL_PERIOD_MAX 60000
+ 
diff --git a/package/kernel/mac80211/patches/ath/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch b/package/kernel/mac80211/patches/ath/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch
new file mode 100644
index 0000000000..6795862145
--- /dev/null
+++ b/package/kernel/mac80211/patches/ath/998-ath10k-retrieve-MAC-address-from-system-firmware-if-.patch
@@ -0,0 +1,51 @@
+From 9d5804662ce1f9bdde0a14c3c40940acbbf09538 Mon Sep 17 00:00:00 2001
+From: Brian Norris <briannorris at chromium.org>
+Date: Tue, 28 Aug 2018 19:48:17 +0300
+Subject: [PATCH] ath10k: retrieve MAC address from system firmware if provided
+
+Devices may provide their own MAC address via system firmware (e.g.,
+device tree), especially in the case where the device doesn't have a
+useful EEPROM on which to store its MAC address (e.g., for integrated
+Wifi).
+
+Use the generic device helper to retrieve the MAC address, and (if
+present) honor it above the MAC address advertised by the card.
+
+Signed-off-by: Brian Norris <briannorris at chromium.org>
+Signed-off-by: Kalle Valo <kvalo at codeaurora.org>
+---
+ drivers/net/wireless/ath/ath10k/core.c | 3 +++
+ drivers/net/wireless/ath/ath10k/wmi.c  | 3 ++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/ath/ath10k/core.c
++++ b/drivers/net/wireless/ath/ath10k/core.c
+@@ -19,6 +19,7 @@
+ #include <linux/module.h>
+ #include <linux/firmware.h>
+ #include <linux/of.h>
++#include <linux/property.h>
+ #include <linux/dmi.h>
+ #include <linux/ctype.h>
+ #include <asm/byteorder.h>
+@@ -2619,6 +2620,8 @@ static int ath10k_core_probe_fw(struct a
+ 		ath10k_debug_print_board_info(ar);
+ 	}
+ 
++	device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr)); pr_info("MAC:ADDR %pM\n", ar->mac_addr);
++
+ 	ret = ath10k_core_init_firmware_features(ar);
+ 	if (ret) {
+ 		ath10k_err(ar, "fatal problem with firmware features: %d\n",
+--- a/drivers/net/wireless/ath/ath10k/wmi.c
++++ b/drivers/net/wireless/ath/ath10k/wmi.c
+@@ -5465,7 +5465,8 @@ int ath10k_wmi_event_ready(struct ath10k
+ 		   arg.mac_addr,
+ 		   __le32_to_cpu(arg.status));
+ 
+-	ether_addr_copy(ar->mac_addr, arg.mac_addr);
++	if (is_zero_ether_addr(ar->mac_addr))
++		ether_addr_copy(ar->mac_addr, arg.mac_addr);
+ 	complete(&ar->wmi.unified_ready);
+ 	return 0;
+ }
diff --git a/target/linux/generic/hack-4.14/950-call-of_get_mac_address-from-device.patch b/target/linux/generic/hack-4.14/950-call-of_get_mac_address-from-device.patch
new file mode 100644
index 0000000000..7e78ceea64
--- /dev/null
+++ b/target/linux/generic/hack-4.14/950-call-of_get_mac_address-from-device.patch
@@ -0,0 +1,23 @@
+--- a/drivers/base/property.c	2018-11-21 09:24:18.000000000 +0100
++++ b/drivers/base/property.c	2018-12-15 13:59:16.894896732 +0100
+@@ -19,6 +19,7 @@
+ #include <linux/property.h>
+ #include <linux/etherdevice.h>
+ #include <linux/phy.h>
++#include <linux/of_net.h>
+ 
+ struct property_set {
+ 	struct device *dev;
+@@ -1186,6 +1187,12 @@ void *device_get_mac_address(struct devi
+ {
+ 	char *res;
+ 
++	res = of_get_mac_address(dev->of_node);
++	if (res && (alen >= ETH_ALEN)) {
++		ether_addr_copy(addr, res);
++		return addr;
++	}
++
+ 	res = device_get_mac_addr(dev, "mac-address", addr, alen);
+ 	if (res)
+ 		return res;
diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index ba7a8e0b14..915c7df460 100644
--- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -88,8 +88,7 @@ case "$FIRMWARE" in
 		ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 12) +1)
 		;;
 	netgear,d7800 |\
-	netgear,r7500v2 |\
-	netgear,r7800)
+	netgear,r7500v2)
 		ath10kcal_extract "art" 4096 12064
 		ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 6) +1)
 		;;
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
index c4c9287942..614ab15df6 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
@@ -255,12 +255,42 @@
 		};
 
 		pcie0: pci at 1b500000 {
-			status = "ok";
+			status = "okay";
+
+			bridge at 0,0 {
+				reg = <0x00000000 0 0 0 0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				ranges;
+
+				wifi at 1,0 {
+					compatible = "pci168c,0046";
+					reg = <0x00010000 0 0 0 0>;
+
+					mtd-mac-address = <&art 6>;
+					mtd-mac-address-increment = <(1)>;
+				};
+			};
 		};
 
 		pcie1: pci at 1b700000 {
-			status = "ok";
+			status = "okay";
 			force_gen1 = <1>;
+
+			bridge at 0,0 {
+				reg = <0x00000000 0 0 0 0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				ranges;
+
+				wifi at 1,0 {
+					compatible = "pci168c,0046";
+					reg = <0x00010000 0 0 0 0>;
+
+					mtd-mac-address = <&art 6>;
+					mtd-mac-address-increment = <(2)>;
+				};
+			};
 		};
 
 		nand at 1ac00000 {
-- 
2.20.1






_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list