diff options
Diffstat (limited to 'board/ti/j721e/evm.c')
-rw-r--r-- | board/ti/j721e/evm.c | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index a1e8fe59c4d..ebaa6faa931 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -28,6 +28,8 @@ #define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \ board_ti_k3_is("J721EX-PM2-SOM")) +#define board_is_j7200_som() board_ti_k3_is("J7200X-PM1-SOM") + /* Max number of MAC addresses that are parsed/processed per daughter card */ #define DAUGHTER_CARD_NO_OF_MAC_ADDR 8 @@ -87,19 +89,53 @@ 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,j721e-ospi"); + fdt_setprop(blob, offset, "status", "disabled", + sizeof("disabled")); + } +} +#endif + #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) { int ret; - ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000", "sram@70000000"); + ret = fdt_fixup_msmc_ram(blob, "/bus@100000", "sram@70000000"); + if (ret < 0) + ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000", + "sram@70000000"); if (ret) printf("%s: fixing up msmc ram failed %d\n", __func__, ret); + detect_enable_hyperflash(blob); + return ret; } #endif +#ifdef CONFIG_TI_I2C_BOARD_DETECT int do_board_detect(void) { int ret; @@ -135,6 +171,8 @@ static void setup_board_eeprom_env(void) if (board_is_j721e_som()) name = "j721e"; + else if (board_is_j7200_som()) + name = "j7200"; else printf("Unidentified board claims %s in eeprom header\n", board_ti_get_name()); @@ -336,14 +374,17 @@ static int probe_daughtercards(void) return 0; } +#endif int board_late_init(void) { - setup_board_eeprom_env(); - setup_serial(); + if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) { + setup_board_eeprom_env(); + setup_serial(); - /* Check for and probe any plugged-in daughtercards */ - probe_daughtercards(); + /* Check for and probe any plugged-in daughtercards */ + probe_daughtercards(); + } return 0; } @@ -355,7 +396,10 @@ void spl_board_init(void) int ret; #endif - probe_daughtercards(); + if ((IS_ENABLED(CONFIG_TARGET_J721E_A72_EVM) || + IS_ENABLED(CONFIG_TARGET_J7200_A72_EVM)) && + IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) + probe_daughtercards(); #ifdef CONFIG_ESM_K3 if (board_ti_k3_is("J721EX-PM2-SOM")) { |