diff mbox

[U-Boot,PATCHv2,13/21] net: sunxi_emac: Write HW address via net_ops hook

Message ID 20170410153356.2664-14-oliver@schinagl.nl
State Superseded
Delegated to: Joe Hershberger
Headers show

Commit Message

Olliver Schinagl April 10, 2017, 3:33 p.m. UTC
Expose the write_hwaddr net_ops hook to write the Ethernet address.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
 drivers/net/sunxi_emac.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox

Patch

diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
index 99339db4bf..0dc37de242 100644
--- a/drivers/net/sunxi_emac.c
+++ b/drivers/net/sunxi_emac.c
@@ -565,11 +565,23 @@  static int sunxi_emac_eth_probe(struct udevice *dev)
 	return sunxi_emac_init_phy(priv, dev);
 }
 
+static int sunxi_emac_eth_write_hwaddr(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+	struct emac_eth_dev *priv = dev_get_priv(dev);
+
+	if (!pdata)
+		return -ENOSYS;
+
+	return _sunxi_write_hwaddr(priv, pdata->enetaddr);
+}
+
 static const struct eth_ops sunxi_emac_eth_ops = {
 	.start			= sunxi_emac_eth_start,
 	.send			= sunxi_emac_eth_send,
 	.recv			= sunxi_emac_eth_recv,
 	.stop			= sunxi_emac_eth_stop,
+	.write_hwaddr		= sunxi_emac_eth_write_hwaddr,
 };
 
 static int sunxi_emac_eth_ofdata_to_platdata(struct udevice *dev)