diff options
Diffstat (limited to 'board/st/common/stm32mp_mtdparts.c')
-rw-r--r-- | board/st/common/stm32mp_mtdparts.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/board/st/common/stm32mp_mtdparts.c b/board/st/common/stm32mp_mtdparts.c index f074fc189d..8b636d62fa 100644 --- a/board/st/common/stm32mp_mtdparts.c +++ b/board/st/common/stm32mp_mtdparts.c @@ -11,7 +11,9 @@ #include <log.h> #include <mtd.h> #include <mtd_node.h> +#ifdef CONFIG_STM32MP15x_STM32IMAGE #include <tee.h> +#endif #include <asm/arch/stm32prog.h> #include <asm/arch/sys_proto.h> #include <asm/global_data.h> @@ -31,7 +33,9 @@ static void board_set_mtdparts(const char *dev, char *mtdids, char *mtdparts, const char *boot, +#ifdef CONFIG_STM32MP15x_STM32IMAGE const char *tee, +#endif const char *user) { /* mtdids: "<dev>=<dev>, ...." */ @@ -55,10 +59,12 @@ static void board_set_mtdparts(const char *dev, strncat(mtdparts, ",", MTDPARTS_LEN); } +#ifdef CONFIG_STM32MP15x_STM32IMAGE if (tee) { strncat(mtdparts, tee, MTDPARTS_LEN); strncat(mtdparts, ",", MTDPARTS_LEN); } +#endif strncat(mtdparts, user, MTDPARTS_LEN); } @@ -70,7 +76,10 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) static char parts[3 * MTDPARTS_LEN + 1]; static char ids[MTDIDS_LEN + 1]; static bool mtd_initialized; - bool tee, nor, nand, spinand, serial; + bool nor, nand, spinand, serial; +#ifdef CONFIG_STM32MP15x_STM32IMAGE + bool tee = false; +#endif if (mtd_initialized) { *mtdids = ids; @@ -78,7 +87,6 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) return; } - tee = false; nor = false; nand = false; spinand = false; @@ -89,7 +97,9 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) case BOOT_SERIAL_USB: serial = true; if (CONFIG_IS_ENABLED(CMD_STM32PROG)) { +#ifdef CONFIG_STM32MP15x_STM32IMAGE tee = stm32prog_get_tee_partitions(); +#endif nor = stm32prog_get_fsbl_nor(); } nand = true; @@ -108,9 +118,11 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) break; } +#ifdef CONFIG_STM32MP15x_STM32IMAGE if (!serial && CONFIG_IS_ENABLED(OPTEE) && tee_find_device(NULL, NULL, NULL, NULL)) tee = true; +#endif memset(parts, 0, sizeof(parts)); memset(ids, 0, sizeof(ids)); @@ -125,10 +137,11 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) if (nand) { mtd = get_mtd_device_nm("nand0"); if (!IS_ERR_OR_NULL(mtd)) { - const char *mtd_tee = CONFIG_MTDPARTS_NAND0_TEE; board_set_mtdparts("nand0", ids, parts, CONFIG_MTDPARTS_NAND0_BOOT, - !nor && tee ? mtd_tee : NULL, +#ifdef CONFIG_STM32MP15x_STM32IMAGE + !nor && tee ? CONFIG_MTDPARTS_NAND0_TEE : NULL, +#endif "-(UBI)"); put_mtd_device(mtd); } @@ -137,10 +150,11 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) if (spinand) { mtd = get_mtd_device_nm("spi-nand0"); if (!IS_ERR_OR_NULL(mtd)) { - const char *mtd_tee = CONFIG_MTDPARTS_SPINAND0_TEE; board_set_mtdparts("spi-nand0", ids, parts, CONFIG_MTDPARTS_SPINAND0_BOOT, - !nor && tee ? mtd_tee : NULL, +#ifdef CONFIG_STM32MP15x_STM32IMAGE + !nor && tee ? CONFIG_MTDPARTS_SPINAND0_TEE : NULL, +#endif "-(UBI)"); put_mtd_device(mtd); } @@ -148,10 +162,11 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts) if (nor) { if (!uclass_get_device(UCLASS_SPI_FLASH, 0, &dev)) { - const char *mtd_tee = CONFIG_MTDPARTS_NOR0_TEE; board_set_mtdparts("nor0", ids, parts, CONFIG_MTDPARTS_NOR0_BOOT, - tee ? mtd_tee : NULL, +#ifdef CONFIG_STM32MP15x_STM32IMAGE + tee ? CONFIG_MTDPARTS_NOR0_TEE : NULL, +#endif "-(nor_user)"); } } |