summaryrefslogtreecommitdiff
path: root/include/net.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-06-13 16:13:10 -0700
committerRemy Bohmer <linux@bohmer.net>2011-08-08 21:05:23 +0200
commit7616e7850804c7c69e0a22c179dfcba9e8f3f587 (patch)
tree9626807ab58412177023ab6ad472448b932d412c /include/net.h
parent291391bed566a569a80b50c924a7c43747abc1b5 (diff)
downloadu-boot-imx-7616e7850804c7c69e0a22c179dfcba9e8f3f587.zip
u-boot-imx-7616e7850804c7c69e0a22c179dfcba9e8f3f587.tar.gz
u-boot-imx-7616e7850804c7c69e0a22c179dfcba9e8f3f587.tar.bz2
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 'include/net.h')
-rw-r--r--include/net.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/include/net.h b/include/net.h
index 018a744..ce54825 100644
--- a/include/net.h
+++ b/include/net.h
@@ -128,7 +128,18 @@ extern int eth_get_dev_index (void); /* get the device index */
extern void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
extern int eth_getenv_enetaddr(char *name, uchar *enetaddr);
extern int eth_setenv_enetaddr(char *name, const uchar *enetaddr);
-extern int eth_getenv_enetaddr_by_index(int index, uchar *enetaddr);
+
+/*
+ * Get the hardware address for an ethernet interface .
+ * Args:
+ * base_name - base name for device (normally "eth")
+ * index - device index number (0 for first)
+ * enetaddr - returns 6 byte hardware address
+ * Returns:
+ * Return true if the address is valid.
+ */
+extern int eth_getenv_enetaddr_by_index(const char *base_name, int index,
+ uchar *enetaddr);
extern int usb_eth_initialize(bd_t *bi);
extern int eth_init(bd_t *bis); /* Initialize the device */
@@ -141,6 +152,18 @@ extern int eth_rx(void); /* Check for received packets */
extern void eth_halt(void); /* stop SCC */
extern char *eth_get_name(void); /* get name of current device */
+/*
+ * Set the hardware address for an ethernet interface based on 'eth%daddr'
+ * environment variable (or just 'ethaddr' if eth_number is 0).
+ * Args:
+ * base_name - base name for device (normally "eth")
+ * eth_number - value of %d (0 for first device of this type)
+ * Returns:
+ * 0 is success, non-zero is error status from driver.
+ */
+int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
+ int eth_number);
+
#ifdef CONFIG_MCAST_TFTP
int eth_mcast_join( IPaddr_t mcast_addr, u8 join);
u32 ether_crc (size_t len, unsigned char const *p);