Commit 40ecdbc6489297f80ca0f624c735d055088594ae

Authored by Jean-Jacques Hiblot
Committed by Heiko Schocher
1 parent c483f4cec0

dra7: Allow selecting a new dtb after board detection.

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>
Reviewed-by: Heiko Schocher <hs@denx.de>

Showing 2 changed files with 22 additions and 0 deletions Side-by-side Diff

arch/arm/mach-omap2/hwinit-common.c
... ... @@ -12,6 +12,7 @@
12 12 */
13 13 #include <common.h>
14 14 #include <debug_uart.h>
  15 +#include <fdtdec.h>
15 16 #include <spl.h>
16 17 #include <asm/arch/sys_proto.h>
17 18 #include <linux/sizes.h>
... ... @@ -19,6 +20,7 @@
19 20 #include <asm/omap_common.h>
20 21 #include <linux/compiler.h>
21 22 #include <asm/system.h>
  23 +#include <dm/root.h>
22 24  
23 25 DECLARE_GLOBAL_DATA_PTR;
24 26  
... ... @@ -171,6 +173,10 @@
171 173 */
172 174 void early_system_init(void)
173 175 {
  176 +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
  177 + int ret;
  178 + int rescan;
  179 +#endif
174 180 init_omap_revision();
175 181 hw_data_init();
176 182 init_package_revision();
... ... @@ -186,6 +192,7 @@
186 192 do_io_settings();
187 193 #endif
188 194 setup_early_clocks();
  195 +
189 196 #ifdef CONFIG_SPL_BUILD
190 197 /*
191 198 * Save the boot parameters passed from romcode.
... ... @@ -196,6 +203,19 @@
196 203 spl_early_init();
197 204 #endif
198 205 do_board_detect();
  206 +
  207 +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
  208 + /*
  209 + * Board detection has been done.
  210 + * Let us see if another dtb wouldn't be a better match
  211 + * for our board
  212 + */
  213 + ret = fdtdec_resetup(&rescan);
  214 + if (!ret && rescan) {
  215 + dm_uninit();
  216 + dm_init_and_scan(true);
  217 + }
  218 +#endif
199 219  
200 220 vcores_init();
201 221 #ifdef CONFIG_DEBUG_UART_OMAP
configs/dra7xx_evm_defconfig
... ... @@ -34,11 +34,13 @@
34 34 CONFIG_DEFAULT_DEVICE_TREE="dra7-evm"
35 35 CONFIG_OF_LIST="dra7-evm dra72-evm dra72-evm-revc dra71-evm dra76-evm"
36 36 CONFIG_SPL_MULTI_DTB_FIT=y
  37 +CONFIG_SPL_MULTI_DTB_FIT_UNCOMPRESS_SZ=0x9000
37 38 CONFIG_OF_SPL_REMOVE_PROPS="clocks clock-names interrupt-parent"
38 39 CONFIG_ENV_IS_IN_MMC=y
39 40 CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
40 41 CONFIG_DM=y
41 42 CONFIG_SPL_DM=y
  43 +CONFIG_SPL_DM_DEVICE_REMOVE=y
42 44 CONFIG_SPL_DM_SEQ_ALIAS=y
43 45 CONFIG_SPL_REGMAP=y
44 46 CONFIG_SPL_SYSCON=y