ti: j721e: enable hyperflash spl fixup for j721e

On j721e, its not possible to use OSPI0 and HBMC simultaneously as they
are muxed within the Flash Subsystem hence disable HBMC by default and
keep OSPI enabled. Bootloader will fixup DT when it detects HyperFlash
mux selection instead of OSPI.

Also updated detect_enable_hyperflash to use correct GPIO when checking
hypermux selection state:
* J7200 - hypermux sel connected to WKUP_GPIO0_6
* J721E - hypermux·sel·connected·to·WKUP_GPIO0_8

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
This commit is contained in:
Vaishnav Achath 2022-05-09 11:50:16 +05:30 committed by Tom Rini
parent d45ccab483
commit 66a33f41e9

View file

@ -109,11 +109,12 @@ int board_fit_config_name_match(const char *name)
static void __maybe_unused detect_enable_hyperflash(void *blob)
{
struct gpio_desc desc = {0};
char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
if (dm_gpio_lookup_name("6", &desc))
if (dm_gpio_lookup_name(hypermux_sel_gpio, &desc))
return;
if (dm_gpio_request(&desc, "6"))
if (dm_gpio_request(&desc, hypermux_sel_gpio))
return;
if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN))
@ -132,7 +133,8 @@ static void __maybe_unused detect_enable_hyperflash(void *blob)
}
#endif
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TARGET_J7200_A72_EVM)
#if defined(CONFIG_SPL_BUILD) && (defined(CONFIG_TARGET_J7200_A72_EVM) || defined(CONFIG_TARGET_J7200_R5_EVM) || \
defined(CONFIG_TARGET_J721E_A72_EVM) || defined(CONFIG_TARGET_J721E_R5_EVM))
void spl_perform_fixups(struct spl_image_info *spl_image)
{
detect_enable_hyperflash(spl_image->fdt_addr);
@ -490,6 +492,41 @@ int board_late_init(void)
}
#endif
static int __maybe_unused detect_SW3_1_state(void)
{
if (IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) {
struct gpio_desc desc = {0};
int ret;
char *hypermux_sel_gpio = (board_is_j721e_som()) ? "8" : "6";
ret = dm_gpio_lookup_name(hypermux_sel_gpio, &desc);
if (ret) {
printf("error getting GPIO lookup name: %d\n", ret);
return ret;
}
ret = dm_gpio_request(&desc, hypermux_sel_gpio);
if (ret) {
printf("error requesting GPIO: %d\n", ret);
goto err_free_gpio;
}
ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN);
if (ret) {
printf("error setting direction flag of GPIO: %d\n", ret);
goto err_free_gpio;
}
ret = dm_gpio_get_value(&desc);
if (ret < 0)
printf("error getting value of GPIO: %d\n", ret);
err_free_gpio:
dm_gpio_free(desc.dev, &desc);
return ret;
}
}
void spl_board_init(void)
{
#if defined(CONFIG_ESM_K3) || defined(CONFIG_ESM_PMIC)
@ -522,4 +559,18 @@ void spl_board_init(void)
printf("ESM PMIC init failed: %d\n", ret);
}
#endif
if ((IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM) || IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM)) &&
IS_ENABLED(CONFIG_HBMC_AM654)) {
struct udevice *dev;
int ret;
ret = detect_SW3_1_state();
if (ret == 1) {
ret = uclass_get_device_by_driver(UCLASS_MTD,
DM_DRIVER_GET(hbmc_am654),
&dev);
if (ret)
debug("Failed to probe hyperflash\n");
}
}
}