This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VM: OSPI0: Boot hang at A72 SPL with OSPI boot

Part Number: TDA4VM

I am using a custom board with TDA4VM. Boot hang at A72 SPL with OSPI boot. Traces below:

U-Boot SPL 2019.01-dirty (Jan 21 2021 - 06:14:16 +0000)
SYSFW ABI: 2.9 (firmware rev 0x0013 '19.12.1-v2019.12a (Terrific Lla')
Reading on-board EEPROM at 0x50 failed 1
Trying to boot from SPI
Loading Environment from MMC... spl: unsupported mmc boot device.
sdhci@4f80000 - probe failed: -19
spl: unsupported mmc boot device.
sdhci@4fb0000 - probe failed: -19
*** Warning - No MMC card found, using default environment

Loading rproc fw image from device size= 4294967295
Loading rproc fw image from device size= 0
Starting ATF on ARM64 core...

NOTICE: BL31: v2.2(release):ti2019.05-rc1
NOTICE: BL31: Built : 14:31:40, Nov 2 2020
I/TC:
I/TC: OP-TEE version: ti2019.05-rc1-dev (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #1 Mon Nov 2 14:45:40 UTC 2020 aarch64
I/TC: Initialized

U-Boot SPL 2019.01-g350f3927b8 (Jan 14 2021 - 14:58:01 +0000)
Reading on-board EEPROM at 0x50 failed 1
Trying to boot from SPI
Invalid bus 0 (err=-19)
SPI probe failed.
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

When booted using MMC-SD the kernel does not probe OSPI. What is the issue?

  • As per J721e board design WKUP_GPIO0_8 ball G27 acts as a mux between OSPI0/Hyperflash.
    They are mutually exclusive.

    In case wkup_gpio0_8 needs to be pulled high on custom boards, u-boot assumes OSPI is disabled & enable Hyper flash
    & end up with OSPI Boot hang.

    It is due to the detect_enable_hyperflash function in board/ti/j721e/evm.c:

    The function checks for the value of wkup_gpio0_8. In case it is high, the above function disables the OSPI0
    and related child nodes from the device tree of the next stage of boot.

    Example: R5 SPL disables the OSPI0 node for A72 and so on. U-boot ends up disabling the OSPI0 node for kernel DTB.
    This causes issues at several levels, Including OSPI boot to and kernel not having access to OSPI.

    Below patch [1] fixes that by not overriding the DTB.

    diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
    index fa27eea271..5a93861dce 100644
    --- a/board/ti/j721e/evm.c
    +++ b/board/ti/j721e/evm.c
    @@ -92,39 +92,6 @@ int board_fit_config_name_match(const char *name)
     }
     #endif
    
    -#if defined(CONFIG_DM_GPIO) && defined(CONFIG_OF_LIBFDT)
    -/* Returns 1, if onboard mux is set to hyperflash */
    -static void __maybe_unused detect_enable_hyperflash(void *blob)
    -{
    -       struct gpio_desc desc = {0};
    -
    -       if (dm_gpio_lookup_name("8", &desc))
    -               return;
    -       if (dm_gpio_request(&desc, "8"))
    -               return;
    -       if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN))
    -               return;
    -
    -       if (dm_gpio_get_value(&desc)) {
    -               int offset;
    -
    -               do_fixup_by_compat(blob, "ti,j721e-hbmc", "status",
    -                                  "okay", sizeof("okay"), 0);
    -               offset = fdt_node_offset_by_compatible(blob, -1,
    -                                                      "ti,j721e-ospi");
    -               fdt_setprop(blob, offset, "status", "disabled",
    -                           sizeof("disabled"));
    -       }
    -}
    -#endif
    -
    -#if CONFIG_IS_ENABLED(LOAD_FIT)
    -void spl_perform_fixups(struct spl_image_info *spl_image)
    -{
    -       detect_enable_hyperflash(spl_image->fdt_addr);
    -}
    -#endif
    -
     #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
     int ft_board_setup(void *blob, bd_t *bd)
     {
    @@ -134,8 +101,6 @@ int ft_board_setup(void *blob, bd_t *bd)
            if (ret)
                    printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
    
    -       detect_enable_hyperflash(blob);
    -
            return ret;
     }
     #endif
    

    J7200 Patch:

    Similar to TDA4VM/J721e the J7200 also has similar detection logic with WKUP_GPIO0_6 acting as a mux between OSPI0 & Hyperflash.
    In case that is pulled high as per custom board design then one can apply the below patch to get OSPI functional:

    diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
    index 4d321ba1cd..07a5a72149 100644
    --- a/board/ti/j721e/evm.c
    +++ b/board/ti/j721e/evm.c
    @@ -97,41 +97,6 @@ int board_fit_config_name_match(const char *name)
     }
     #endif
     
    -#if CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(OF_LIBFDT)
    -/* Returns 1, if onboard mux is set to hyperflash */
    -static void __maybe_unused detect_enable_hyperflash(void *blob)
    -{
    -	struct gpio_desc desc = {0};
    -
    -	if (dm_gpio_lookup_name("6", &desc))
    -		return;
    -
    -	if (dm_gpio_request(&desc, "6"))
    -		return;
    -
    -	if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN))
    -		return;
    -
    -	if (dm_gpio_get_value(&desc)) {
    -		int offset;
    -
    -		do_fixup_by_compat(blob, "ti,am654-hbmc", "status",
    -				   "okay", sizeof("okay"), 0);
    -		offset = fdt_node_offset_by_compatible(blob, -1,
    -						       "ti,am654-ospi");
    -		fdt_setprop(blob, offset, "status", "disabled",
    -			    sizeof("disabled"));
    -	}
    -}
    -#endif
    -
    -#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TARGET_J7200_A72_EVM)
    -void spl_perform_fixups(struct spl_image_info *spl_image)
    -{
    -	detect_enable_hyperflash(spl_image->fdt_addr);
    -}
    -#endif
    -
     #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
     int ft_board_setup(void *blob, bd_t *bd)
     {
    @@ -144,8 +109,6 @@ int ft_board_setup(void *blob, bd_t *bd)
     	if (ret)
     		printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
     
    -	detect_enable_hyperflash(blob);
    -
     	return ret;
     }
     #endif
    

    Best Regards,
    Keerthy