
Hi Yann,
On Fri, 5 Oct 2012 14:09:58 +0200, Yann Vernier yann.vernier@orsoc.se wrote:
Previously code to do this was in the Ethernet driver itself. Since it is board specific, moved it here, and altered it to support preset MAC from environment.
board/cm4008/cm4008.c | 12 ++++++++++++ board/cm41xx/cm41xx.c | 12 ++++++++++++ 2 files changed, 24 insertions(+)
diff --git a/board/cm4008/cm4008.c b/board/cm4008/cm4008.c index 6c0da9a..e14f8f4 100644 --- a/board/cm4008/cm4008.c +++ b/board/cm4008/cm4008.c @@ -75,10 +75,22 @@ int board_late_init (void) return 0; }
+#ifdef CONFIG_DRIVER_KS8695ETH int board_eth_init(bd_t *bis) {
- uchar enetaddr[6];
- const uchar * const fp=CONFIG_SYS_FLASH_BASE+0x1c000;
- /* read MAC address from flash */
- if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
memcpy(&enetaddr[0], fp, 6);
if (is_valid_ether_addr(enetaddr))
eth_setenv_enetaddr("ethaddr", enetaddr);
- }
- return ks8695_eth_initialize();
} +#endif
int board_init (void) { diff --git a/board/cm41xx/cm41xx.c b/board/cm41xx/cm41xx.c index 6aef617..771701d 100644 --- a/board/cm41xx/cm41xx.c +++ b/board/cm41xx/cm41xx.c @@ -75,10 +75,22 @@ int board_late_init (void) return 0; }
+#ifdef CONFIG_DRIVER_KS8695ETH int board_eth_init(bd_t *bis) {
- uchar enetaddr[6];
- const uchar * const fp=CONFIG_SYS_FLASH_BASE+0x1c000;
Magic number here.
- /* read MAC address from flash */
- if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
memcpy(&enetaddr[0], fp, 6);
if (is_valid_ether_addr(enetaddr))
eth_setenv_enetaddr("ethaddr", enetaddr);
- }
- return ks8695_eth_initialize();
} +#endif
int board_init (void) {
Amicalement,