diff mbox

[U-Boot,1/2] net: export eth_setenv_enetaddr_by_index() to net.h

Message ID 1458299892-30818-2-git-send-email-rogerq@ti.com
State Accepted
Commit 5350bc8f65a96d7f3c2519ae2d76cafea875103a
Delegated to: Tom Rini
Headers show

Commit Message

Roger Quadros March 18, 2016, 11:18 a.m. UTC
Some TI boards (e.g. IDK) have 4 to 6 ethernet ports and
this function is handy at board.c to configure the
MAC address of the ports.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 include/net.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Tom Rini March 18, 2016, 1:26 p.m. UTC | #1
On Fri, Mar 18, 2016 at 01:18:11PM +0200, Roger Quadros wrote:

> Some TI boards (e.g. IDK) have 4 to 6 ethernet ports and
> this function is handy at board.c to configure the
> MAC address of the ports.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini March 27, 2016, 10:27 p.m. UTC | #2
On Fri, Mar 18, 2016 at 01:18:11PM +0200, Roger Quadros wrote:

> Some TI boards (e.g. IDK) have 4 to 6 ethernet ports and
> this function is handy at board.c to configure the
> MAC address of the ports.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/include/net.h b/include/net.h
index a739f45..03ae232 100644
--- a/include/net.h
+++ b/include/net.h
@@ -237,6 +237,23 @@  void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
 int eth_getenv_enetaddr(const char *name, uchar *enetaddr);
 int eth_setenv_enetaddr(const char *name, const uchar *enetaddr);
 
+/**
+ * eth_setenv_enetaddr_by_index() - set the MAC address envrionment variable
+ *
+ * This sets up an environment variable with the given MAC address (@enetaddr).
+ * The environment variable to be set is defined by <@base_name><@index>addr.
+ * If @index is 0 it is omitted. For common Ethernet this means ethaddr,
+ * eth1addr, etc.
+ *
+ * @base_name:  Base name for variable, typically "eth"
+ * @index:      Index of interface being updated (>=0)
+ * @enetaddr:   Pointer to MAC address to put into the variable
+ * @return 0 if OK, other value on error
+ */
+int eth_setenv_enetaddr_by_index(const char *base_name, int index,
+				 uchar *enetaddr);
+
+
 /*
  * Get the hardware address for an ethernet interface .
  * Args: