r8152: Use MAC address from device tree if available
Subsystems (5)
PATCH 1/1 r8152: Use MAC address from device tree if available
From: Thierry Reding <[email protected]>
If a MAC address was passed via the device tree node for the r8152 device, use it and fall back to reading from EEPROM otherwise. This is useful for devices where the r8152 EEPROM was not programmed with a valid MAC address, or if users want to explicitly set a MAC address in the bootloader and pass that to the kernel.
--- drivers/net/usb/r8152.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/net/usb/r8152.c +13 -9
@@ -1504,15 +1504,19 @@ static int determine_ethernet_addr(struct r8152 *tp, struct sockaddr *sa) sa->sa_family = dev->type; -if (tp->version ==RTL_VER_01 ) { - ret =pla_ocp_read (tp,PLA_IDR ,8 , sa->sa_data); - }else { -/* if device doesn't support MAC pass through this will -* be expected to be non-zero -*/ - ret =vendor_mac_passthru_addr_read (tp, sa); -if (ret <0 ) - ret =pla_ocp_read (tp,PLA_BACKUP ,8 , sa->sa_data); + ret =eth_platform_get_mac_address (&dev->dev, sa->sa_data); +if (ret <0 ) { +if (tp->version ==RTL_VER_01 ) { + ret =pla_ocp_read (tp,PLA_IDR ,8 , sa->sa_data); + }else { +/* if device doesn't support MAC pass through this will +* be expected to be non-zero +*/ + ret =vendor_mac_passthru_addr_read (tp, sa); +if (ret <0 ) + ret =pla_ocp_read (tp,PLA_BACKUP ,8 , + sa->sa_data); + } }if (ret <0 ) {
Signature · 1 line
2.24.1
David Miller
maintainerFrom: Thierry Reding <[email protected]>
Date: Thu, 14 May 2020 14:38:48 +0200
Quoted 9 lines
From: Thierry Reding <[email protected]>
If a MAC address was passed via the device tree node for the r8152 device, use it and fall back to reading from EEPROM otherwise. This is useful for devices where the r8152 EEPROM was not programmed with a valid MAC address, or if users want to explicitly set a MAC address in the bootloader and pass that to the kernel.
Signed-off-by Thierry Reding <[email protected]>
Yep, that looks good, applied.
Thank you.