aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2019-04-16 18:20:29 +0200
committerJoe Hershberger <joe.hershberger@ni.com>2019-05-14 14:43:33 -0500
commitb6054b5351d1737307128bdfac65b834fbc6607a (patch)
treee2543dcf69a32752a49d6feefc46d59f983fdcb1 /drivers
parent6845b368f17e7bfb7f6d683cfd4e0faa75877145 (diff)
downloadu-boot-b6054b5351d1737307128bdfac65b834fbc6607a.zip
u-boot-b6054b5351d1737307128bdfac65b834fbc6607a.tar.gz
u-boot-b6054b5351d1737307128bdfac65b834fbc6607a.tar.bz2
net: rtl8169: Implement ->hwaddr_write() callback
Implement this callback that allows the MAC address to be set for the Ethernet card. This is necessary in order for the device to be able to receive packets for the MAC address that U-Boot advertises. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/rtl8169.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index a78f3d2..27e27b3 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -941,6 +941,23 @@ static void rtl_halt(struct eth_device *dev)
}
#endif
+#ifdef CONFIG_DM_ETH
+static int rtl8169_write_hwaddr(struct udevice *dev)
+{
+ struct eth_pdata *plat = dev_get_platdata(dev);
+ unsigned int i;
+
+ RTL_W8(Cfg9346, Cfg9346_Unlock);
+
+ for (i = 0; i < MAC_ADDR_LEN; i++)
+ RTL_W8(MAC0 + i, plat->enetaddr[i]);
+
+ RTL_W8(Cfg9346, Cfg9346_Lock);
+
+ return 0;
+}
+#endif
+
/**************************************************************************
INIT - Look for an adapter, this routine's visible to the outside
***************************************************************************/
@@ -1195,6 +1212,7 @@ static const struct eth_ops rtl8169_eth_ops = {
.send = rtl8169_eth_send,
.recv = rtl8169_eth_recv,
.stop = rtl8169_eth_stop,
+ .write_hwaddr = rtl8169_write_hwaddr,
};
static const struct udevice_id rtl8169_eth_ids[] = {