[U-Boot] [PATCH 4/4] usb: net: smsc95xx: attempt to fix enetaddr loading

Mike Frysinger vapier at gentoo.org
Fri Nov 11 01:11:07 CET 2011


The previous commit (79ad54400932d6484178a GCC4.6: Squash warnings in
smsc95xx.c) broke loading of enetaddr into the hardware.  It changed
the semantics from reading 4 bytes to 1 byte.

Use the new enetaddr members instead to load the values out of memory.
I don't have any hardware to test with, but it *looks* correct, and we
know the current code is def broken ...

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 drivers/usb/eth/smsc95xx.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 7ee4f87..f43b4b5 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -372,26 +372,20 @@ static int smsc95xx_init_mac_address(struct eth_device *eth,
 static int smsc95xx_write_hwaddr(struct eth_device *eth)
 {
 	struct ueth_data *dev = (struct ueth_data *)eth->priv;
-	u32 addr_lo, addr_hi;
 	int ret;
 
 	/* set hardware address */
 	debug("** %s()\n", __func__);
-	addr_lo = cpu_to_le32(*eth->enetaddr);
-	addr_hi = cpu_to_le16(*((u16 *)(eth->enetaddr + 4)));
-	ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
+	ret = smsc95xx_write_reg(dev, ADDRL, eth->enetaddr32);
 	if (ret < 0) {
 		debug("Failed to write ADDRL: %d\n", ret);
 		return ret;
 	}
 
-	ret = smsc95xx_write_reg(dev, ADDRH, addr_hi);
+	ret = smsc95xx_write_reg(dev, ADDRH, eth->enetaddr16[2]);
 	if (ret < 0)
 		return ret;
-	debug("MAC %02x:%02x:%02x:%02x:%02x:%02x\n",
-		eth->enetaddr[0], eth->enetaddr[1],
-		eth->enetaddr[2], eth->enetaddr[3],
-		eth->enetaddr[4], eth->enetaddr[5]);
+	debug("MAC %pM\n", eth->enetaddr);
 	dev->have_hwaddr = 1;
 	return 0;
 }
-- 
1.7.6.1



More information about the U-Boot mailing list