]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: phytec: common: k3: Set MAC
authorDaniel Schultz <d.schultz@phytec.de>
Wed, 22 May 2024 06:18:26 +0000 (23:18 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 7 Jun 2024 20:01:53 +0000 (14:01 -0600)
Read the EEPROM API v3 content and set all available
MAC-Addresses to the environment.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
board/phytec/common/k3/board.c

index 9cb168c36cbaff9b10905c0b8d20080c80023d44..f21e154d4fe038b3e899ef09849895a0a1d0a1d3 100644 (file)
@@ -8,6 +8,8 @@
 #include <spl.h>
 #include <asm/arch/hardware.h>
 
+#include "../am6_som_detection.h"
+
 #if IS_ENABLED(CONFIG_ENV_IS_IN_FAT) || IS_ENABLED(CONFIG_ENV_IS_IN_MMC)
 int mmc_get_env_dev(void)
 {
@@ -68,6 +70,27 @@ int board_late_init(void)
                break;
        };
 
+       if (IS_ENABLED(CONFIG_PHYTEC_SOM_DETECTION_BLOCKS)) {
+               struct phytec_api3_element *block_element;
+               struct phytec_eeprom_data data;
+               int ret;
+
+               ret = phytec_eeprom_data_setup(&data, 0, EEPROM_ADDR);
+               if (ret || !data.valid)
+                       return 0;
+
+               PHYTEC_API3_FOREACH_BLOCK(block_element, &data) {
+                       switch (block_element->block_type) {
+                       case PHYTEC_API3_BLOCK_MAC:
+                               phytec_blocks_add_mac_to_env(block_element);
+                               break;
+                       default:
+                               debug("%s: Unknown block type %i\n", __func__,
+                                     block_element->block_type);
+                       }
+               }
+       }
+
        return 0;
 }
 #endif