mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 21:52:04 +00:00
r8152: Use MAC address from device tree if available
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 <treding@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0531b0357b
commit
acb6d3771a
@ -1504,15 +1504,19 @@ static int determine_ethernet_addr(struct r8152 *tp, struct sockaddr *sa)
|
|||||||
|
|
||||||
sa->sa_family = dev->type;
|
sa->sa_family = dev->type;
|
||||||
|
|
||||||
if (tp->version == RTL_VER_01) {
|
ret = eth_platform_get_mac_address(&dev->dev, sa->sa_data);
|
||||||
ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data);
|
if (ret < 0) {
|
||||||
} else {
|
if (tp->version == RTL_VER_01) {
|
||||||
/* if device doesn't support MAC pass through this will
|
ret = pla_ocp_read(tp, PLA_IDR, 8, sa->sa_data);
|
||||||
* be expected to be non-zero
|
} else {
|
||||||
*/
|
/* if device doesn't support MAC pass through this will
|
||||||
ret = vendor_mac_passthru_addr_read(tp, sa);
|
* be expected to be non-zero
|
||||||
if (ret < 0)
|
*/
|
||||||
ret = pla_ocp_read(tp, PLA_BACKUP, 8, sa->sa_data);
|
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) {
|
if (ret < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user