public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb: eth: asix88179: add ability to modify MAC address
@ 2015-01-08 12:58 Rene Griessl
  2015-01-10  0:43 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Rene Griessl @ 2015-01-08 12:58 UTC (permalink / raw)
  To: u-boot

Here is the promised patch, that enables U-Boot to modify the MAC
address of the AX88179.
Tested on RECS5250 (similar to Arndale5250)

Signed-off-by: Rene Griessl <rgriessl@cit-ec.uni-bielefeld.de>
---
 drivers/usb/eth/asix88179.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c
index b8ca720..b551540 100644
--- a/drivers/usb/eth/asix88179.c
+++ b/drivers/usb/eth/asix88179.c
@@ -271,6 +271,22 @@ static int asix_read_mac(struct eth_device *eth)
 	return 0;
 }
 
+static int asix_write_mac(struct eth_device *eth)
+{
+	struct ueth_data *dev = (struct ueth_data *)eth->priv;
+	int ret;
+	u8 buf[ETH_ALEN];
+
+	memcpy(buf, eth->enetaddr, ETH_ALEN);
+
+	ret = asix_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN,
+				 ETH_ALEN, buf);
+	if (ret < 0)
+		debug("Failed to set MAC address: %02x\n", ret);
+
+	return ret;
+}
+
 static int asix_basic_reset(struct ueth_data *dev)
 {
 	struct asix_private *dev_priv = (struct asix_private *)dev->dev_priv;
@@ -686,6 +702,7 @@ int ax88179_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
 	eth->send = asix_send;
 	eth->recv = asix_recv;
 	eth->halt = asix_halt;
+	eth->write_hwaddr = asix_write_mac;
 	eth->priv = ss;
 
 	if (asix_basic_reset(ss))
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-10  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 12:58 [U-Boot] [PATCH] usb: eth: asix88179: add ability to modify MAC address Rene Griessl
2015-01-10  0:43 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox