diff mbox series

[v2,08/10] ARM: mvebu: clearfog: run-time selection of DT file

Message ID efa37fd13898d5e88fe6c14696014770d7073bf1.1579522639.git.baruch@tkos.co.il
State Accepted
Commit 867572f09ebe6349937b9614f1863a9111aa8f8e
Headers show
Series ARM: clearfog: add run-time board detect | expand

Commit Message

Baruch Siach Jan. 20, 2020, 12:20 p.m. UTC
Set the kernel device-tree file (fdtfile environment variable) based on
run-time detection of the platform.

Reviewed-by: Stefan Roese <sr at denx.de>
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
 arch/arm/mach-mvebu/Kconfig        |  1 +
 board/solidrun/clearfog/clearfog.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index fdd39685b75d..bc5eaa5a7679 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -91,6 +91,7 @@  choice
 config TARGET_CLEARFOG
 	bool "Support ClearFog"
 	select 88F6820
+	select BOARD_LATE_INIT
 
 config TARGET_HELIOS4
 	bool "Support Helios4"
diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c
index 8050cca55ab7..e178b06cd34d 100644
--- a/board/solidrun/clearfog/clearfog.c
+++ b/board/solidrun/clearfog/clearfog.c
@@ -175,3 +175,17 @@  int board_eth_init(bd_t *bis)
 	cpu_eth_init(bis); /* Built in controller(s) come first */
 	return pci_eth_init(bis);
 }
+
+int board_late_init(void)
+{
+	cf_read_tlv_data();
+
+	if (sr_product_is(&cf_tlv_data, "Clearfog Base"))
+		env_set("fdtfile", "armada-388-clearfog-base.dtb");
+	else if (sr_product_is(&cf_tlv_data, "Clearfog GTR S4"))
+		env_set("fdtfile", "armada-385-clearfog-gtr-s4.dtb");
+	else if (sr_product_is(&cf_tlv_data, "Clearfog GTR L8"))
+		env_set("fdtfile", "armada-385-clearfog-gtr-l8.dtb");
+
+	return 0;
+}