aboutsummaryrefslogtreecommitdiff
path: root/board/ti/panda/panda.c
diff options
context:
space:
mode:
authorJohn Rigby <john.rigby@linaro.org>2011-07-24 23:24:26 -0600
committerJohn Rigby <john.rigby@linaro.org>2011-09-23 07:10:41 -0600
commitebd0bcde9a07290588947c23b028b0d61f891c40 (patch)
tree097705c9fd6a2e203be95471ce9d17d14a45a6fb /board/ti/panda/panda.c
parent56bfeb78692fcea766f1296d977a6bec22fcfc82 (diff)
OMAP4 Panda: Generate a unique usbethaddr
The panda board has a usb nic but the nic has no rom. Use the die-id to generate a unique address. This is derived from an RFC kernel patch by Andy Green that does the same thing: https://patchwork.kernel.org/patch/660541/ [RFC PATCH 1/2] OMAP2+: add cpu id register to MAC address helper Signed-off-by: John Rigby <john.rigby@linaro.org>
Diffstat (limited to 'board/ti/panda/panda.c')
-rw-r--r--board/ti/panda/panda.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index e60a2e267..5fe01b176 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -48,8 +48,26 @@ int board_init(void)
return 0;
}
+/*
+ * Panda has a usb nic with no ethernet rom so generate a macaddr
+ * from the SOC die-id and set the usbethaddr env var to that
+ * value.
+ */
int board_eth_init(bd_t *bis)
{
+ u8 macaddr[6];
+ char usbethaddr[20];
+
+ /*
+ * NB: The 1 here has been found to generate an address
+ * consistent with the kernel.
+ */
+ omap4_die_id_to_ethernet_mac(macaddr, 1);
+ sprintf (usbethaddr, "%02X:%02X:%02X:%02X:%02X:%02X",
+ macaddr[0], macaddr[1],
+ macaddr[2], macaddr[3],
+ macaddr[4], macaddr[5]) ;
+ setenv ("usbethaddr", usbethaddr);
return 0;
}