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 <oli...@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

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to