aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorJun Yu <junyuu@chromium.org>2022-09-20 00:31:17 +0000
committerKalle Valo <quic_kvalo@quicinc.com>2022-09-22 10:33:27 +0300
commit176239a9a2e3c519923d7bd8bb205838d48c7a3c (patch)
tree6547e5a015b119a47f3d74f415162108792bf98b /drivers/net/wireless/ath
parentwifi: ath11k: add get_txpower mac ops (diff)
downloadlinux-dev-176239a9a2e3c519923d7bd8bb205838d48c7a3c.tar.xz
linux-dev-176239a9a2e3c519923d7bd8bb205838d48c7a3c.zip
wifi: ath11k: 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 ahb WCN6750). Use the generic device helper to retrieve the MAC address, and (if present) honor it above the MAC address advertised by the card. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Signed-off-by: Jun Yu <junyuu@chromium.org> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://lore.kernel.org/r/20220920003117.841442-1-junyuu@chromium.org
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath11k/mac.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 0c91a89c7807..2cd1e6f8b3c1 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9072,6 +9072,7 @@ int ath11k_mac_register(struct ath11k_base *ab)
struct ath11k_pdev *pdev;
int i;
int ret;
+ u8 mac_addr[ETH_ALEN] = {0};
if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))
return 0;
@@ -9084,13 +9085,18 @@ int ath11k_mac_register(struct ath11k_base *ab)
if (ret)
return ret;
+ device_get_mac_address(ab->dev, mac_addr);
+
for (i = 0; i < ab->num_radios; i++) {
pdev = &ab->pdevs[i];
ar = pdev->ar;
if (ab->pdevs_macaddr_valid) {
ether_addr_copy(ar->mac_addr, pdev->mac_addr);
} else {
- ether_addr_copy(ar->mac_addr, ab->mac_addr);
+ if (is_zero_ether_addr(mac_addr))
+ ether_addr_copy(ar->mac_addr, ab->mac_addr);
+ else
+ ether_addr_copy(ar->mac_addr, mac_addr);
ar->mac_addr[4] += i;
}