diff options
author | Apurva Nandan <a-nandan@ti.com> | 2023-10-07 04:29:39 +0530 |
---|---|---|
committer | Udit Kumar <u-kumar1@ti.com> | 2023-10-07 13:47:53 +0530 |
commit | 7c37b21c99887a99fff1a6589e13a3d53237d83b (patch) | |
tree | 253fde40fa921c0ff545161f354c0494a8960ec3 /board/ti/j721s2/evm.c | |
parent | 0be2deaeaa9ce5be4fe226abb915e529b11c6dea (diff) |
board: ti: j721s2: Use IS_ENABLED in place of #if
IS_ENABLED is the recommendation for checking CONFIG flags.
Use it instead of #if, and drop redundant checking of DM_GPIO
and OF_LIBFDT. #if defined(CONFIG_SPL_BUILD) can't be removed
from spl_perform_fixups, as it results in compile error.
Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Diffstat (limited to 'board/ti/j721s2/evm.c')
-rw-r--r-- | board/ti/j721s2/evm.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c index 301e11231d..f5586d070b 100644 --- a/board/ti/j721s2/evm.c +++ b/board/ti/j721s2/evm.c @@ -73,43 +73,41 @@ int dram_init_banksize(void) return 0; } -#if CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(OF_LIBFDT) /* Enables the spi-nand dts node, if onboard mux is set to spinand */ static void __maybe_unused detect_enable_spinand(void *blob) { - struct gpio_desc desc = {0}; - char *ospi_mux_sel_gpio = "6"; - int nand_offset, nor_offset; - - if (dm_gpio_lookup_name(ospi_mux_sel_gpio, &desc)) - return; - - if (dm_gpio_request(&desc, ospi_mux_sel_gpio)) - return; - - if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN)) - return; - - nand_offset = fdt_node_offset_by_compatible(blob, -1, "spi-nand"); - nor_offset = fdt_node_offset_by_compatible(blob, - fdt_parent_offset(blob, nand_offset), - "jedec,spi-nor"); - - if (dm_gpio_get_value(&desc)) { - fdt_status_okay(blob, nand_offset); - fdt_del_node(blob, nor_offset); - } else { - fdt_del_node(blob, nand_offset); + if (IS_ENABLED(CONFIG_DM_GPIO) && IS_ENABLED(CONFIG_OF_LIBFDT)) { + struct gpio_desc desc = {0}; + char *ospi_mux_sel_gpio = "6"; + int nand_offset, nor_offset; + + if (dm_gpio_lookup_name(ospi_mux_sel_gpio, &desc)) + return; + + if (dm_gpio_request(&desc, ospi_mux_sel_gpio)) + return; + + if (dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN)) + return; + + nand_offset = fdt_node_offset_by_compatible(blob, -1, "spi-nand"); + nor_offset = fdt_node_offset_by_compatible(blob, + fdt_parent_offset(blob, nand_offset), + "jedec,spi-nor"); + + if (dm_gpio_get_value(&desc)) { + fdt_status_okay(blob, nand_offset); + fdt_del_node(blob, nor_offset); + } else { + fdt_del_node(blob, nand_offset); + } } } -#endif -#if defined(CONFIG_SPL_BUILD) && (defined(CONFIG_TARGET_J721S2_A72_EVM) || \ - defined(CONFIG_TARGET_J721S2_R5_EVM)) +#if defined(CONFIG_SPL_BUILD) void spl_perform_fixups(struct spl_image_info *spl_image) { - if (IS_ENABLED(CONFIG_DM_GPIO) && IS_ENABLED(CONFIG_OF_LIBFDT)) - detect_enable_spinand(spl_image->fdt_addr); + detect_enable_spinand(spl_image->fdt_addr); } #endif @@ -125,8 +123,7 @@ int ft_board_setup(void *blob, struct bd_info *bd) if (ret) printf("%s: fixing up msmc ram failed %d\n", __func__, ret); - if (IS_ENABLED(CONFIG_DM_GPIO) && IS_ENABLED(CONFIG_OF_LIBFDT)) - detect_enable_spinand(blob); + detect_enable_spinand(blob); return ret; } |