1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Configuration header file for Verdin AM62 SoM
4  *
5  * Copyright 2023 Toradex - https://www.toradex.com/
6  */
7 
8 #ifndef __VERDIN_AM62_H
9 #define __VERDIN_AM62_H
10 
11 #define RAMDISK_ADDR_R		0x90300000
12 #define SCRIPTADDR		0x90280000
13 
14 /* DDR Configuration */
15 #define CFG_SYS_SDRAM_BASE	0x80000000
16 #define CFG_SYS_SDRAM_SIZE	SZ_2G /* Maximum supported size, auto-detection is used */
17 
18 #define MEM_LAYOUT_ENV_SETTINGS \
19 	"fdt_addr_r=0x90200000\0" \
20 	"kernel_addr_r=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
21 	"kernel_comp_addr_r=0x80200000\0" \
22 	"kernel_comp_size=0x08000000\0" \
23 	"ramdisk_addr_r=" __stringify(RAMDISK_ADDR_R) "\0" \
24 	"scriptaddr=" __stringify(SCRIPTADDR) "\0"
25 
26 #if CONFIG_TARGET_VERDIN_AM62_A53
27 /* Enable Distro Boot */
28 #define BOOT_TARGET_DEVICES(func) \
29 	func(MMC, mmc, 1) \
30 	func(MMC, mmc, 0) \
31 	func(DHCP, dhcp, na)
32 #include <config_distro_bootcmd.h>
33 #else /* CONFIG_TARGET_VERDIN_AM62_A53 */
34 #define BOOTENV \
35 	""
36 #endif /* CONFIG_TARGET_VERDIN_AM62_A53 */
37 
38 #define EXTRA_ENV_DFUARGS \
39 	"dfu_alt_info_ram=" \
40 	"tispl.bin ram 0x80080000 0x200000;" \
41 	"u-boot.img ram 0x81000000 0x400000;" \
42 	"loadaddr ram " __stringify(CONFIG_SYS_LOAD_ADDR) " 0x80000;" \
43 	"scriptaddr ram " __stringify(SCRIPTADDR) " 0x80000;" \
44 	"ramdisk_addr_r ram " __stringify(RAMDISK_ADDR_R) " 0x8000000\0"
45 
46 /* Incorporate settings into the U-Boot environment */
47 #define CFG_EXTRA_ENV_SETTINGS \
48 	BOOTENV \
49 	EXTRA_ENV_DFUARGS \
50 	MEM_LAYOUT_ENV_SETTINGS \
51 	"boot_script_dhcp=boot.scr\0" \
52 	"console=ttyS2\0" \
53 	"fdt_board=dev\0" \
54 	"update_tiboot3=askenv confirm Did you load tiboot3.bin (y/N)?; " \
55 		"if test \"$confirm\" = \"y\"; then " \
56 		"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
57 		"${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0 " \
58 		"${blkcnt}; fi\0" \
59 	"update_tispl=askenv confirm Did you load tispl.bin (y/N)?; " \
60 		"if test \"$confirm\" = \"y\"; then " \
61 		"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
62 		"${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x400 " \
63 		"${blkcnt}; fi\0" \
64 	"update_uboot=askenv confirm Did you load u-boot.img (y/N)?; " \
65 		"if test \"$confirm\" = \"y\"; then " \
66 		"setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt " \
67 		"${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x1400 " \
68 		"${blkcnt}; fi\0"
69 
70 #endif /* __VERDIN_AM62_H */
71