1 /* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2025, STMicroelectronics - All Rights Reserved
4  *
5  * Configuration settings for the STMicroelectonics STM32MP23x boards
6  */
7 
8 #ifndef __CONFIG_STM32MP23_ST_COMMON_H__
9 #define __CONFIG_STM32MP23_ST_COMMON_H__
10 
11 #define STM32MP_BOARD_EXTRA_ENV \
12 	"usb_pgood_delay=2000\0" \
13 	"console=ttySTM0\0"
14 
15 #include <configs/stm32mp23_common.h>
16 
17 #ifdef CFG_EXTRA_ENV_SETTINGS
18 /*
19  * default bootcmd for stm32mp23 STMicroelectronics boards:
20  * for serial/usb: execute the stm32prog command
21  * for mmc boot (eMMC, SD card), distro boot on the same mmc device
22  * for nand or spi-nand boot, distro boot with ubifs on UBI partition or
23  * sdcard
24  * for nor boot, distro boot on SD card = mmc0 ONLY !
25  */
26 #define ST_STM32MP23_BOOTCMD "bootcmd_stm32mp=" \
27 	"echo \"Boot over ${boot_device}${boot_instance}!\";" \
28 	"if test ${boot_device} = serial || test ${boot_device} = usb;" \
29 	"then stm32prog ${boot_device} ${boot_instance}; " \
30 	"else " \
31 		"run env_check;" \
32 		"if test ${boot_device} = mmc;" \
33 		"then env set boot_targets \"mmc${boot_instance}\"; fi;" \
34 		"if test ${boot_device} = nand ||" \
35 		  " test ${boot_device} = spi-nand ;" \
36 		"then env set boot_targets ubifs0 mmc0; fi;" \
37 		"if test ${boot_device} = nor;" \
38 		"then env set boot_targets mmc0; fi;" \
39 		"run distro_bootcmd;" \
40 	"fi;\0"
41 
42 #undef CFG_EXTRA_ENV_SETTINGS
43 #define CFG_EXTRA_ENV_SETTINGS \
44 	STM32MP_MEM_LAYOUT \
45 	ST_STM32MP23_BOOTCMD \
46 	BOOTENV \
47 	STM32MP_EXTRA \
48 	STM32MP_BOARD_EXTRA_ENV
49 
50 #endif
51 #endif
52