brcmfmac: firmware: Allow platform to override macaddr
authorHector Martin <marcan@marcan.st>
Thu, 23 Dec 2021 13:32:08 +0000 (22:32 +0900)
committerHector Martin <marcan@marcan.st>
Sat, 19 Feb 2022 08:17:02 +0000 (17:17 +0900)
commitbcd3c1c000fc718c34a6b7ad99f1af8d69d6059e
treeaa9cd48c3a96f7c9cd9f6c599818c4a5c82ee978
parent54238fa801068b0ccb58fcc0a84180912fd095c2
brcmfmac: firmware: Allow platform to override macaddr

On Device Tree platforms, it is customary to be able to set the MAC
address via the Device Tree, as it is often stored in system firmware.
This is particularly relevant for Apple ARM64 platforms, where this
information comes from system configuration and passed through by the
bootloader into the DT.

Implement support for this by fetching the platform MAC address and
adding or replacing the macaddr= property in nvram. This becomes the
dongle's default MAC address.

On platforms with an SROM MAC address, this overrides it. On platforms
without one, such as Apple ARM64 devices, this is required for the
firmware to boot (it will fail if it does not have a valid MAC at all).

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c