diff mbox series

[32/34] board: atmel: sama7g5ek: add support for MAC address retreival

Message ID 20201203092850.7909-33-eugen.hristev@microchip.com
State Superseded
Delegated to: Eugen Hristev
Headers show
Series Sama7g5 Evaluation Kit support | expand

Commit Message

Eugen Hristev Dec. 3, 2020, 9:28 a.m. UTC
Obtain two MAC addresses from the two EEPROMs and configure the two
available Ethernet interfaces accordingly.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 board/atmel/sama7g5ek/sama7g5ek.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/board/atmel/sama7g5ek/sama7g5ek.c b/board/atmel/sama7g5ek/sama7g5ek.c
index 1d7a01593d..ed1cf80da7 100644
--- a/board/atmel/sama7g5ek/sama7g5ek.c
+++ b/board/atmel/sama7g5ek/sama7g5ek.c
@@ -46,6 +46,19 @@  int board_early_init_f(void)
 	return 0;
 }
 
+#define MAC24AA_MAC_OFFSET     0xfa
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_I2C_EEPROM
+	at91_set_ethaddr(MAC24AA_MAC_OFFSET);
+	at91_set_eth1addr(MAC24AA_MAC_OFFSET);
+#endif
+	return 0;
+}
+#endif
+
 int board_init(void)
 {
 	/* address of boot parameters */
@@ -61,8 +74,3 @@  int dram_init(void)
 	return 0;
 }
 
-int misc_init_r(void)
-{
-	return 0;
-}
-