[U-Boot] [PATCH 4/6] net: sunxi-emac: Add read_rom_hwaddr net_op hook
Olliver Schinagl
oliver at schinagl.nl
Fri Nov 25 16:38:36 CET 2016
Add the read_rom_hwaddr net_op hook so that it can be called from boards
to read the mac from a ROM chip.
Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
---
drivers/net/sunxi_emac.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
index bba8630..7d45f8b 100644
--- a/drivers/net/sunxi_emac.c
+++ b/drivers/net/sunxi_emac.c
@@ -565,6 +565,21 @@ static int sunxi_emac_eth_write_hwaddr(struct udevice *dev)
return _sunxi_write_hwaddr(priv, pdata->enetaddr);
}
+__weak int sunxi_emac_board_read_rom_hwaddr(unsigned char *enetaddr, int id)
+{
+ return -ENOSYS;
+}
+
+static int sunxi_emac_eth_read_rom_hwaddr(struct udevice *dev)
+{
+ struct eth_pdata *pdata = dev_get_platdata(dev);
+
+ if (!dev)
+ return -ENOSYS;
+
+ return sunxi_emac_board_read_rom_hwaddr(pdata->enetaddr, dev->seq);
+}
+
static int sunxi_emac_eth_probe(struct udevice *dev)
{
struct eth_pdata *pdata = dev_get_platdata(dev);
@@ -582,6 +597,7 @@ static const struct eth_ops sunxi_emac_eth_ops = {
.recv = sunxi_emac_eth_recv,
.stop = sunxi_emac_eth_stop,
.write_hwaddr = sunxi_emac_eth_write_hwaddr,
+ .read_rom_hwaddr = sunxi_emac_eth_read_rom_hwaddr,
};
static int sunxi_emac_eth_ofdata_to_platdata(struct udevice *dev)
--
2.10.2
More information about the U-Boot
mailing list