diff mbox series

xilinx: common: Add support for SOC detection

Message ID 329a8da338927b082e26a958bf69bb18af072420.1662460837.git.michal.simek@amd.com
State Accepted
Commit 39d3c3cfaa4f5099a2d687de4530c9ca4bee256d
Delegated to: Michal Simek
Headers show
Series xilinx: common: Add support for SOC detection | expand

Commit Message

Michal Simek Sept. 6, 2022, 10:40 a.m. UTC
Code supports board detection based on information available in EEPROM in
legacy or FRU format. But this is not enough for emulation and simulation
systems which are lacking these identification EEPROMs. But SOC itself has
normally registers for SOC identification. Based on them it is possible to
compose detected name. That's why prepare infrastructure in common location
for SOC platform detection which is called before board platform detection.
SOC platform detection shouldn't detect real silicon and should fallback to
current existing mechanism to identify boards based on EEPROMs.

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 board/xilinx/common/board.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Michal Simek Sept. 12, 2022, 9:59 a.m. UTC | #1
Ășt 6. 9. 2022 v 12:40 odesĂ­latel Michal Simek <michal.simek@amd.com> napsal:
>
> Code supports board detection based on information available in EEPROM in
> legacy or FRU format. But this is not enough for emulation and simulation
> systems which are lacking these identification EEPROMs. But SOC itself has
> normally registers for SOC identification. Based on them it is possible to
> compose detected name. That's why prepare infrastructure in common location
> for SOC platform detection which is called before board platform detection.
> SOC platform detection shouldn't detect real silicon and should fallback to
> current existing mechanism to identify boards based on EEPROMs.
>
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
>
>  board/xilinx/common/board.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> index 5e3638636123..e1f71049603f 100644
> --- a/board/xilinx/common/board.c
> +++ b/board/xilinx/common/board.c
> @@ -585,8 +585,33 @@ bool __maybe_unused __weak board_detection(void)
>         return false;
>  }
>
> +bool __maybe_unused __weak soc_detection(void)
> +{
> +       return false;
> +}
> +
> +char * __maybe_unused __weak soc_name_decode(void)
> +{
> +       return NULL;
> +}
> +
>  int embedded_dtb_select(void)
>  {
> +       if (soc_detection()) {
> +               char *soc_local_name;
> +
> +               soc_local_name = soc_name_decode();
> +               if (soc_local_name) {
> +                       board_name = soc_local_name;
> +                       printf("Detected SOC name: %s\n", board_name);
> +
> +                       /* Time to change DTB on fly */
> +                       /* Both ways should work here */
> +                       /* fdtdec_resetup(&rescan); */
> +                       return fdtdec_setup();
> +               }
> +       }
> +
>         if (board_detection()) {
>                 char *board_local_name;
>
> --
> 2.36.1
>

Applied.
M
diff mbox series

Patch

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 5e3638636123..e1f71049603f 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -585,8 +585,33 @@  bool __maybe_unused __weak board_detection(void)
 	return false;
 }
 
+bool __maybe_unused __weak soc_detection(void)
+{
+	return false;
+}
+
+char * __maybe_unused __weak soc_name_decode(void)
+{
+	return NULL;
+}
+
 int embedded_dtb_select(void)
 {
+	if (soc_detection()) {
+		char *soc_local_name;
+
+		soc_local_name = soc_name_decode();
+		if (soc_local_name) {
+			board_name = soc_local_name;
+			printf("Detected SOC name: %s\n", board_name);
+
+			/* Time to change DTB on fly */
+			/* Both ways should work here */
+			/* fdtdec_resetup(&rescan); */
+			return fdtdec_setup();
+		}
+	}
+
 	if (board_detection()) {
 		char *board_local_name;