mvebu: add support for SolidRun ClearFog Pro
[openwrt/openwrt.git] / target / linux / mvebu / patches-6.1 / 701-mvpp2-read-mac-address-from-nvmem.patch
1 From: Tobias Schramm <tobias@t-sys.eu>
2 Subject: mvpp2: support fetching mac address from nvmem
3
4 The mvpp2 driver did not query nvmem for hardware mac addresses. This
5 patch adds querying of mac addresses stored in nvmem cells as a further
6 fallback option before assigning a random address.
7 Purposely added separately to fwnode_get_mac_address() above to maintain
8 existing behaviour with builtin adapter mac address still taking
9 precedence.
10
11 Signed-off-by: Tobias Schramm <tobias@t-sys.eu>
12 ---
13 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
14 +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
15 @@ -6134,6 +6134,12 @@ static void mvpp2_port_copy_mac_addr(str
16 }
17 }
18
19 + if (!of_get_mac_address(to_of_node(fwnode), hw_mac_addr)) {
20 + *mac_from = "nvmem cell";
21 + eth_hw_addr_set(dev, hw_mac_addr);
22 + return;
23 + }
24 +
25 *mac_from = "random";
26 eth_hw_addr_random(dev);
27 }