1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Configuration header file for K3 AM62Ax SoC family
4  *
5  * Copyright (C) 2022 Texas Instruments Incorporated - https://www.ti.com/
6  */
7 
8 #ifndef __CONFIG_AM62AX_EVM_H
9 #define __CONFIG_AM62AX_EVM_H
10 
11 #include <linux/sizes.h>
12 #include <environment/ti/mmc.h>
13 #include <environment/ti/k3_dfu.h>
14 
15 /* DDR Configuration */
16 #define CFG_SYS_SDRAM_BASE1		0x880000000
17 
18 #define PARTS_DEFAULT \
19 	/* Linux partitions */ \
20 	"name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0" \
21 
22 /* U-Boot general configuration */
23 #define EXTRA_ENV_AM62A7_BOARD_SETTINGS					\
24 	"default_device_tree=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"	\
25 	"findfdt="							\
26 		"setenv name_fdt ${default_device_tree};"		\
27 		"setenv fdtfile ${name_fdt}\0"				\
28 	"name_kern=Image\0"						\
29 	"console=ttyS2,115200n8\0"					\
30 	"args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 "	\
31 		"${mtdparts}\0"						\
32 	"run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
33 
34 /* U-Boot MMC-specific configuration */
35 #define EXTRA_ENV_AM62A7_BOARD_SETTINGS_MMC				\
36 	"boot=mmc\0"							\
37 	"mmcdev=1\0"							\
38 	"bootpart=1:2\0"						\
39 	"bootdir=/boot\0"						\
40 	"rd_spec=-\0"							\
41 	"init_mmc=run args_all args_mmc\0"				\
42 	"get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${name_fdt}\0" \
43 	"get_overlay_mmc="						\
44 		"fdt address ${fdtaddr};"				\
45 		"fdt resize 0x100000;"					\
46 		"for overlay in $name_overlays;"			\
47 		"do;"							\
48 		"load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "	\
49 		"fdt apply ${dtboaddr};"				\
50 		"done;\0"						\
51 	"get_kern_mmc=load mmc ${bootpart} ${loadaddr} "		\
52 		"${bootdir}/${name_kern}\0"				\
53 	"get_fit_mmc=load mmc ${bootpart} ${addr_fit} "			\
54 		"${bootdir}/${name_fit}\0"				\
55 	"partitions=" PARTS_DEFAULT
56 
57 #define BOOTENV_DEV_TI_MMC(devtypeu, devtypel, instance)		\
58 	DEFAULT_MMC_TI_ARGS						\
59 	EXTRA_ENV_AM62A7_BOARD_SETTINGS_MMC				\
60 	"bootcmd_ti_mmc="						\
61 		"run findfdt; run envboot; run init_mmc;"		\
62 		"if test ${boot_fit} -eq 1; then;"			\
63 			"run get_fit_mmc; run get_overlaystring;"	\
64 			"run run_fit;"					\
65 		"else;"							\
66 			"run get_kern_mmc; run get_fdt_mmc;"		\
67 			"run get_overlay_mmc;"				\
68 			"run run_kern;"					\
69 		"fi;\0"
70 
71 #define BOOTENV_DEV_NAME_TI_MMC(devtyeu, devtypel, instance)		\
72 	"ti_mmc "
73 
74 #if IS_ENABLED(CONFIG_CMD_MMC)
75 	#define BOOT_TARGET_MMC(func)					\
76 		func(TI_MMC, ti_mmc, na)
77 #else
78 	#define BOOT_TARGET_MMC(func)
79 #endif /* IS_ENABLED(CONFIG_CMD_MMC) */
80 
81 #define BOOT_TARGET_DEVICES(func)					\
82 	BOOT_TARGET_MMC(func)
83 
84 #include <config_distro_bootcmd.h>
85 
86 /* Incorporate settings into the U-Boot environment */
87 #define CFG_EXTRA_ENV_SETTINGS					\
88 	BOOTENV
89 
90 /* Now for the remaining common defines */
91 #include <configs/ti_armv7_common.h>
92 
93 #endif /* __CONFIG_AM62A7_EVM_H */
94