diff mbox series

[U-Boot,RESEND,v3,19/19] dra7: Allow selecting a new dtb after board detection.

Message ID 1544190655-4405-20-git-send-email-jjhiblot@ti.com
State Awaiting Upstream
Delegated to: Heiko Schocher
Headers show
Series DM_I2C_COMPAT removal for all ti platforms | expand

Commit Message

Jean-Jacques Hiblot Dec. 7, 2018, 1:50 p.m. UTC
The DRA7 platforms requires that the dtb used in the SPL really matches the
platform  to have the best MMC performances.
To detect the board type/version an I2C EEPROM is read. This requires that
DM is initialized before the detection. As a consequence we must reset the
DM after the board detection is a new dtb would better match the platform.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

---

Changes in v3: None
Changes in v2: None

 arch/arm/mach-omap2/hwinit-common.c | 20 ++++++++++++++++++++
 configs/dra7xx_evm_defconfig        |  2 ++
 2 files changed, 22 insertions(+)

Comments

Tom Rini Dec. 7, 2018, 2:21 p.m. UTC | #1
On Fri, Dec 07, 2018 at 02:50:55PM +0100, Jean-Jacques Hiblot wrote:

> The DRA7 platforms requires that the dtb used in the SPL really matches the
> platform  to have the best MMC performances.
> To detect the board type/version an I2C EEPROM is read. This requires that
> DM is initialized before the detection. As a consequence we must reset the
> DM after the board detection is a new dtb would better match the platform.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> 

Reviewed-by: Tom Rini <trini@konsulko.com>
Heiko Schocher Dec. 10, 2018, 6:25 a.m. UTC | #2
Hello Jean-Jacques,

Am 07.12.2018 um 14:50 schrieb Jean-Jacques Hiblot:
> The DRA7 platforms requires that the dtb used in the SPL really matches the
> platform  to have the best MMC performances.
> To detect the board type/version an I2C EEPROM is read. This requires that
> DM is initialized before the detection. As a consequence we must reset the
> DM after the board detection is a new dtb would better match the platform.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> 
> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>   arch/arm/mach-omap2/hwinit-common.c | 20 ++++++++++++++++++++
>   configs/dra7xx_evm_defconfig        |  2 ++
>   2 files changed, 22 insertions(+)

Thanks for resending!

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko Schocher
diff mbox series

Patch

diff --git a/arch/arm/mach-omap2/hwinit-common.c b/arch/arm/mach-omap2/hwinit-common.c
index d0781d7..772b4c4 100644
--- a/arch/arm/mach-omap2/hwinit-common.c
+++ b/arch/arm/mach-omap2/hwinit-common.c
@@ -12,6 +12,7 @@ 
  */
 #include <common.h>
 #include <debug_uart.h>
+#include <fdtdec.h>
 #include <spl.h>
 #include <asm/arch/sys_proto.h>
 #include <linux/sizes.h>
@@ -19,6 +20,7 @@ 
 #include <asm/omap_common.h>
 #include <linux/compiler.h>
 #include <asm/system.h>
+#include <dm/root.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -171,6 +173,10 @@  void __weak init_package_revision(void)
  */
 void early_system_init(void)
 {
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
+	int ret;
+	int rescan;
+#endif
 	init_omap_revision();
 	hw_data_init();
 	init_package_revision();
@@ -186,6 +192,7 @@  void early_system_init(void)
 	do_io_settings();
 #endif
 	setup_early_clocks();
+
 #ifdef CONFIG_SPL_BUILD
 	/*
 	 * Save the boot parameters passed from romcode.
@@ -197,6 +204,19 @@  void early_system_init(void)
 #endif
 	do_board_detect();
 
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
+	/*
+	 * Board detection has been done.
+	 * Let us see if another dtb wouldn't be a better match
+	 * for our board
+	 */
+	ret = fdtdec_resetup(&rescan);
+	if (!ret && rescan) {
+		dm_uninit();
+		dm_init_and_scan(true);
+	}
+#endif
+
 	vcores_init();
 #ifdef CONFIG_DEBUG_UART_OMAP
 	debug_uart_init();
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index a57dc07..2ea1d59 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -34,11 +34,13 @@  CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="dra7-evm"
 CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm dra76-evm"
 CONFIG_SPL_MULTI_DTB_FIT=y
+CONFIG_SPL_MULTI_DTB_FIT_UNCOMPRESS_SZ=0x9000
 CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
 CONFIG_DM=y
 CONFIG_SPL_DM=y
+CONFIG_SPL_DM_DEVICE_REMOVE=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SPL_SYSCON=y