1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2013 Marek Vasut <marex@denx.de>
4  */
5 #ifndef __CONFIGS_MX23_OLINUXINO_H__
6 #define __CONFIGS_MX23_OLINUXINO_H__
7 
8 /* System configurations */
9 #define CONFIG_MACH_TYPE	4105
10 
11 /* U-Boot Commands */
12 
13 /* Memory configuration */
14 #define PHYS_SDRAM_1			0x40000000	/* Base address */
15 #define PHYS_SDRAM_1_SIZE		0x08000000	/* Max 128 MB RAM */
16 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
17 
18 /* Environment */
19 #define CONFIG_ENV_OVERWRITE
20 
21 /* Environment is in MMC */
22 #if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC)
23 #define CONFIG_ENV_OFFSET	(256 * 1024)
24 #define CONFIG_ENV_SIZE		(16 * 1024)
25 #define CONFIG_SYS_MMC_ENV_DEV	0
26 #endif
27 
28 /* Status LED */
29 
30 /* USB */
31 #ifdef CONFIG_CMD_USB
32 #define CONFIG_EHCI_MXS_PORT0
33 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
34 #endif
35 
36 /* Ethernet */
37 
38 /* Booting Linux */
39 #define CONFIG_BOOTFILE		"uImage"
40 #define CONFIG_LOADADDR		0x42000000
41 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
42 
43 /* Extra Environment */
44 #define CONFIG_EXTRA_ENV_SETTINGS \
45 	"update_sd_firmware_filename=u-boot.sd\0" \
46 	"update_sd_firmware="		/* Update the SD firmware partition */ \
47 		"if mmc rescan ; then "	\
48 		"if tftp ${update_sd_firmware_filename} ; then " \
49 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
50 		"setexpr fw_sz ${fw_sz} + 1 ; "	\
51 		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
52 		"fi ; "	\
53 		"fi\0" \
54 	"script=boot.scr\0"	\
55 	"uimage=uImage\0" \
56 	"console=ttyAMA0\0" \
57 	"fdt_file=imx23-olinuxino.dtb\0" \
58 	"fdt_addr=0x41000000\0" \
59 	"boot_fdt=try\0" \
60 	"ip_dyn=yes\0" \
61 	"mmcdev=0\0" \
62 	"mmcpart=2\0" \
63 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
64 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
65 		"root=${mmcroot}\0" \
66 	"loadbootscript="  \
67 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
68 	"bootscript=echo Running bootscript from mmc ...; "	\
69 		"source\0" \
70 	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
71 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
72 	"mmcboot=echo Booting from mmc ...; " \
73 		"run mmcargs; " \
74 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
75 			"if run loadfdt; then " \
76 				"bootm ${loadaddr} - ${fdt_addr}; " \
77 			"else " \
78 				"if test ${boot_fdt} = try; then " \
79 					"bootm; " \
80 				"else " \
81 					"echo WARN: Cannot load the DT; " \
82 				"fi; " \
83 			"fi; " \
84 		"else " \
85 			"bootm; " \
86 		"fi;\0" \
87 	"netargs=setenv bootargs console=${console},${baudrate} " \
88 		"root=/dev/nfs " \
89 		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
90 	"netboot=echo Booting from net ...; " \
91 		"usb start; " \
92 		"run netargs; "	\
93 		"if test ${ip_dyn} = yes; then " \
94 			"setenv get_cmd dhcp; " \
95 		"else " \
96 			"setenv get_cmd tftp; " \
97 		"fi; " \
98 		"${get_cmd} ${uimage}; " \
99 		"if test ${boot_fdt} = yes; then " \
100 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
101 				"bootm ${loadaddr} - ${fdt_addr}; " \
102 			"else " \
103 				"if test ${boot_fdt} = try; then " \
104 					"bootm; " \
105 				"else " \
106 					"echo WARN: Cannot load the DT; " \
107 				"fi;" \
108 			"fi; " \
109 		"else " \
110 			"bootm; " \
111 		"fi;\0"
112 
113 #define CONFIG_BOOTCOMMAND \
114 	"mmc dev ${mmcdev}; if mmc rescan; then " \
115 		"if run loadbootscript; then " \
116 			"run bootscript; " \
117 		"else " \
118 			"if run loaduimage; then " \
119 				"run mmcboot; " \
120 			"else run netboot; " \
121 			"fi; " \
122 		"fi; " \
123 	"else run netboot; fi"
124 
125 /* The rest of the configuration is shared */
126 #include <configs/mxs.h>
127 
128 #endif /* __CONFIGS_MX23_OLINUXINO_H__ */
129