U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Schultz <d.schultz@phytec.de>
To: <u-boot@lists.denx.de>, <upstream@lists.phytec.de>
Cc: Daniel Schultz <d.schultz@phytec.de>
Subject: [PATCH 5/6] board: phytec: common: k3: Set MAC
Date: Tue, 21 May 2024 23:18:26 -0700	[thread overview]
Message-ID: <20240522061827.601699-6-d.schultz@phytec.de> (raw)
In-Reply-To: <20240522061827.601699-1-d.schultz@phytec.de>

Read the EEPROM API v3 content and set all available
MAC-Addresses to the environment.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
 board/phytec/common/k3/board.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/board/phytec/common/k3/board.c b/board/phytec/common/k3/board.c
index 9cb168c36cb..f21e154d4fe 100644
--- a/board/phytec/common/k3/board.c
+++ b/board/phytec/common/k3/board.c
@@ -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
-- 
2.25.1


  parent reply	other threads:[~2024-05-22 14:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22  6:18 [PATCH 0/6] PHYTEC SOM Detection API v3 Daniel Schultz
2024-05-22  6:18 ` [PATCH 1/6] board: phytec: common: Move eeprom read to new function Daniel Schultz
2024-05-22  6:18 ` [PATCH 2/6] board: phytec: common: Define PHYTEC_API2_DATA_LEN Daniel Schultz
2024-05-22  6:18 ` [PATCH 3/6] board: phytec: common: Move API v2 init to new function Daniel Schultz
2024-05-22  6:18 ` [PATCH 4/6] board: phytec: common: Add API v3 Daniel Schultz
2024-05-22  6:18 ` Daniel Schultz [this message]
2024-05-22  8:38   ` [Upstream] [PATCH 5/6] board: phytec: common: k3: Set MAC Wadim Egorov
2024-05-22  6:18 ` [PATCH 6/6] configs: phycore_am62x_a53_defconfig: Enable CONFIG_ENV_OVERWRITE Daniel Schultz
2024-05-22  8:30   ` [Upstream] " Wadim Egorov
2024-05-22  8:46     ` Daniel Schultz
2024-05-22  8:28 ` [Upstream] [PATCH 0/6] PHYTEC SOM Detection API v3 Wadim Egorov
2024-06-07 22:03 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240522061827.601699-6-d.schultz@phytec.de \
    --to=d.schultz@phytec.de \
    --cc=u-boot@lists.denx.de \
    --cc=upstream@lists.phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox