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@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Brian Norris 2018-08-28 19:48:17 +03:00 committed by Kalle Valo
parent 9cac6a9b62
commit 9d5804662c
2 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/property.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
@ -2617,6 +2618,8 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
ath10k_debug_print_board_info(ar); ath10k_debug_print_board_info(ar);
} }
device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
ret = ath10k_core_init_firmware_features(ar); ret = ath10k_core_init_firmware_features(ar);
if (ret) { if (ret) {
ath10k_err(ar, "fatal problem with firmware features: %d\n", ath10k_err(ar, "fatal problem with firmware features: %d\n",

View File

@ -5455,7 +5455,8 @@ int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb)
arg.mac_addr, arg.mac_addr,
__le32_to_cpu(arg.status)); __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); complete(&ar->wmi.unified_ready);
return 0; return 0;
} }