board: atmel: sama7g5ek: add support for MAC address retreival
authorEugen Hristev <eugen.hristev@microchip.com>
Fri, 31 Jul 2020 12:20:56 +0000 (15:20 +0300)
committerEugen Hristev <eugen.hristev@microchip.com>
Thu, 7 Jan 2021 07:44:16 +0000 (09:44 +0200)
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

index 42b032c..b5cece0 100644 (file)
@@ -46,6 +46,19 @@ int board_early_init_f(void)
        return 0;
 }
 
+#define MAC24AA_MAC_OFFSET     0xfa
+
+#if (IS_ENABLED(CONFIG_MISC_INIT_R))
+int misc_init_r(void)
+{
+#if (IS_ENABLED(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;
-}
-