diff options
author | Simon Glass <sjg@chromium.org> | 2011-06-13 23:13:10 (GMT) |
---|---|---|
committer | Remy Bohmer <linux@bohmer.net> | 2011-08-08 19:05:23 (GMT) |
commit | 7616e7850804c7c69e0a22c179dfcba9e8f3f587 (patch) | |
tree | 9626807ab58412177023ab6ad472448b932d412c /drivers/usb/eth/usb_ether.c | |
parent | 291391bed566a569a80b50c924a7c43747abc1b5 (diff) | |
download | u-boot-7616e7850804c7c69e0a22c179dfcba9e8f3f587.tar.xz |
Add Ethernet hardware MAC address framework to usbnet
Built-in Ethernet adapters support setting the mac address by means of a
ethaddr environment variable for each interface (ethaddr, eth1addr, eth2addr).
This adds similar support to the USB network side, using the names
usbethaddr, usbeth1addr, etc. They are kept separate since we don't want
a USB device taking the MAC address of a built-in device or vice versa.
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Eric BĂ©nard <eric@eukrea.com>
Diffstat (limited to 'drivers/usb/eth/usb_ether.c')
-rw-r--r-- | drivers/usb/eth/usb_ether.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c index 7b55da3..6565ea5 100644 --- a/drivers/usb/eth/usb_ether.c +++ b/drivers/usb/eth/usb_ether.c @@ -80,6 +80,7 @@ int is_eth_dev_on_usb_host(void) */ static void probe_valid_drivers(struct usb_device *dev) { + struct eth_device *eth; int j; for (j = 0; prob_dev[j].probe && prob_dev[j].get_info; j++) { @@ -88,9 +89,10 @@ static void probe_valid_drivers(struct usb_device *dev) /* * ok, it is a supported eth device. Get info and fill it in */ + eth = &usb_eth[usb_max_eth_dev].eth_dev; if (prob_dev[j].get_info(dev, &usb_eth[usb_max_eth_dev], - &usb_eth[usb_max_eth_dev].eth_dev)) { + eth)) { /* found proper driver */ /* register with networking stack */ usb_max_eth_dev++; @@ -100,7 +102,10 @@ static void probe_valid_drivers(struct usb_device *dev) * call since eth_current_changed (internally called) * relies on it */ - eth_register(&usb_eth[usb_max_eth_dev - 1].eth_dev); + eth_register(eth); + if (eth_write_hwaddr(eth, "usbeth", + usb_max_eth_dev - 1)) + puts("Warning: failed to set MAC address\n"); break; } } |