board: sama5d4_xplained: Set mac address from eeprom
authorWenyou Yang <wenyou.yang@microchip.com>
Fri, 1 Sep 2017 08:26:18 +0000 (16:26 +0800)
committerTom Rini <trini@konsulko.com>
Mon, 11 Sep 2017 20:23:08 +0000 (16:23 -0400)
Add the code to set the ethernet mac address from eeprom by using
the common code from the common folder.

Signed-off-by: Wenyou Yang <wenyou.yang@microchip.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/dts/at91-sama5d4_xplained.dts
board/atmel/sama5d4_xplained/sama5d4_xplained.c
configs/sama5d4_xplained_mmc_defconfig
configs/sama5d4_xplained_nandflash_defconfig
configs/sama5d4_xplained_spiflash_defconfig
include/configs/sama5d4_xplained.h

index ca6aff28e58167744dbd38fee76ec06ade5ee3ab..0592b31b91733ef846dacdebc083175dd395b2e0 100644 (file)
 
                        i2c0: i2c@f8014000 {
                                status = "okay";
+
+                               i2c_eeprom: i2c_eeprom@5c {
+                                       compatible = "atmel,24mac402";
+                                       reg = <0x5c>;
+                               };
                        };
 
                        macb0: ethernet@f8020000 {
index 854afcb6224a00cb293ada60ea62ca538caaf0f9..248a31b8c4f5133050e7db9aa74ca7c2a562f2e2 100644 (file)
@@ -192,6 +192,18 @@ int board_early_init_f(void)
 }
 #endif
 
+#define AT24MAC_MAC_OFFSET     0x9a
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_I2C_EEPROM
+       at91_set_ethaddr(AT24MAC_MAC_OFFSET);
+#endif
+       return 0;
+}
+#endif
+
 int board_init(void)
 {
        /* adress of boot parameters */
index 0c2b63dab91f157bcaf6bd6daa33216a774f7cc5..ffc01f4384faf62ec25aced3471b36f3ecabaee6 100644 (file)
@@ -47,6 +47,9 @@ CONFIG_AT91_UTMI=y
 CONFIG_AT91_H32MX=y
 CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_DM_SPI_FLASH=y
index 3a2dcb12b9888d85f353a733195be29556968146..3abfa4fb9472bd6ee28d2e50f833fb9e954d0097 100644 (file)
@@ -44,6 +44,9 @@ CONFIG_AT91_UTMI=y
 CONFIG_AT91_H32MX=y
 CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_DM_SPI_FLASH=y
index d82a4cddf2aaf98a5fb865f77c4344f9c9c03ea7..d8a126ce1b2548a65fb86952b231ee590d4cee9c 100644 (file)
@@ -46,6 +46,9 @@ CONFIG_AT91_UTMI=y
 CONFIG_AT91_H32MX=y
 CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_DM_SPI_FLASH=y
index c8462b0b6485e7ce9b6bfb4976e49b133488cd50..08f865016da59735dbfc4dad0e58d1a9007880dd 100644 (file)
@@ -12,6 +12,8 @@
 
 #include "at91-sama5_common.h"
 
+#define CONFIG_MISC_INIT_R
+
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS           1
 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS