1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2019 DENX Software Engineering
4  * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
5  *
6  * Copyright (C) 2018 DENX Software Engineering
7  * Måns Rullgård, DENX Software Engineering, mans@mansr.com
8  *
9  * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
10  * on behalf of DENX Software Engineering GmbH
11  */
12 #ifndef __CONFIGS_XEA_H__
13 #define __CONFIGS_XEA_H__
14 
15 #include <linux/sizes.h>
16 
17 #define CONFIG_TIMESTAMP		/* Print image info with timestamp */
18 
19 /* SPL */
20 #define CONFIG_SPL_STACK		0x20000
21 
22 #define CONFIG_SYS_SPL_ARGS_ADDR	0x44000000
23 
24 #define CONFIG_SYS_SPI_KERNEL_OFFS	SZ_1M
25 #define CONFIG_SYS_SPI_ARGS_OFFS	SZ_512K
26 #define CONFIG_SYS_SPI_ARGS_SIZE	SZ_32K
27 
28 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	(SZ_512K / 0x200)
29 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	(SZ_32K / 0x200)
30 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	(SZ_1M / 0x200)
31 
32 #ifndef CONFIG_SPL_BUILD
33 #define CONFIG_SPI_FLASH_MTD
34 #endif
35 
36 /* Memory configuration */
37 #define PHYS_SDRAM_1			0x40000000	/* Base address */
38 #define PHYS_SDRAM_1_SIZE		0x10000000	/* Max 256 MB RAM */
39 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
40 
41 /* Environment */
42 
43 /* Booting Linux */
44 #define CONFIG_BOOTFILE		"uImage"
45 #define CONFIG_BOOTCOMMAND	"run ${bootpri} ; run ${bootsec}"
46 #define CONFIG_LOADADDR		0x42000000
47 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
48 
49 /* Extra Environment */
50 #define CONFIG_HOSTNAME		"xea"
51 
52 #define CONFIG_EXTRA_ENV_SETTINGS					\
53 	"bootmode=update\0"						\
54 	"bootpri=mmc_mmc\0"						\
55 	"bootsec=sf_swu\0"						\
56 	"consdev=ttyAMA0\0"						\
57 	"baudrate=115200\0"						\
58 	"dtbaddr=0x44000000\0"						\
59 	"dtbfile=imx28-xea.dtb\0"					\
60 	"rootdev=/dev/mmcblk0p2\0"					\
61 	"netdev=eth0\0"							\
62 	"rdaddr=0x43000000\0"						\
63 	"swufile=swupdate.img\0"					\
64 	"sf_kernel_offset=0x100000\0"					\
65 	"sf_kernel_size=0x400000\0"					\
66 	"sf_swu_offset=0x500000\0"					\
67 	"sf_swu_size=0x800000\0"					\
68 	"rootpath=/opt/eldk-5.5/armv5te/rootfs-qte-sdk\0"		\
69 	"do_update_mmc="						\
70 		"if mmc rescan ; then "					\
71 		"mmc dev 0 ${update_mmc_part} ; "			\
72 		"if dhcp ${hostname}/${update_filename} ; then "	\
73 		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
74 		"setexpr fw_sz ${fw_sz} + 1 ; "				\
75 		"mmc write ${loadaddr} ${update_offset} ${fw_sz} ; "	\
76 		"fi ; "							\
77 		"fi\0"							\
78 	"do_update_sf="							\
79 		"if sf probe ; then "					\
80 		"if dhcp ${hostname}/${update_filename} ; then "	\
81 		"sf erase ${update_offset} +${filesize} ; "		\
82 		"sf write ${loadaddr} ${update_offset} ${filesize} ; "	\
83 		"fi ; "							\
84 		"fi\0"							\
85 	"update_spl_filename=u-boot.sb\0"				\
86 	"update_spl="							\
87 		"setenv update_filename ${update_spl_filename} ; "	\
88 		"setenv update_offset 0 ; "				\
89 		"run do_update_sf\0"					\
90 	"update_uboot_filename=u-boot.img\0"				\
91 	"update_uboot="							\
92 		"setenv update_filename ${update_uboot_filename} ; "	\
93 		"setenv update_offset 0x10000 ; "			\
94 		"run do_update_sf ; "					\
95 		"setenv update_mmc_part 1 ; "				\
96 		"setenv update_offset 0 ; "				\
97 		"run do_update_mmc\0"					\
98 	"update_kernel_filename=uImage\0"				\
99 	"update_kernel="						\
100 		"setenv update_mmc_part 1 ; "				\
101 		"setenv update_filename ${update_kernel_filename} ; "	\
102 		"setenv update_offset 0x800 ; "				\
103 		"run do_update_mmc ; "					\
104 		"setenv update_filename ${dtbfile} ; "			\
105 		"setenv update_offset 0x400 ; "				\
106 		"run do_update_mmc\0"					\
107 	"update_sfkernel="						\
108 		"setenv update_filename fitImage ; "			\
109 		"setenv update_offset ${sf_kernel_offset} ; "		\
110 		"run do_update_sf\0"					\
111 	"update_swu="							\
112 		"setenv update_filename ${swufile} ; "			\
113 		"setenv update_offset ${sf_swu_offset} ; "		\
114 		"run do_update_sf\0"					\
115 	"addcons="							\
116 		"setenv bootargs ${bootargs} "				\
117 		"console=${consdev},${baudrate}\0"			\
118 	"addip="							\
119 		"setenv bootargs ${bootargs} "				\
120 		"ip=${ipaddr}:${serverip}:${gatewayip}:"		\
121 			"${netmask}:${hostname}:${netdev}:off\0"	\
122 	"addmisc="							\
123 		"setenv bootargs ${bootargs} ${miscargs}\0"		\
124 	"addargs=run addcons addmisc\0"					\
125 	"mmcload="							\
126 		"mmc rescan ; "						\
127 		"mmc dev 0 1 ; "					\
128 		"mmc read ${loadaddr} 0x800 0x2000 ; "			\
129 		"mmc read ${dtbaddr} 0x400 0x80\0"			\
130 	"netload="							\
131 		"dhcp ${loadaddr} ${hostname}/${bootfile} ; "		\
132 		"tftp ${dtbaddr} ${hostname}/${dtbfile}\0"		\
133 	"sfload="							\
134 		"sf probe ; "						\
135 		"sf read ${loadaddr} ${sf_kernel_offset} ${sf_kernel_size}\0" \
136 	"usbload="							\
137 		"usb start ; "						\
138 		"load usb 0:1 ${loadaddr} ${bootfile}\0"		\
139 	"miscargs=panic=1\0"						\
140 	"mmcargs=setenv bootargs root=${rootdev} rw rootwait\0"		\
141 	"nfsargs="							\
142 		"setenv bootargs root=/dev/nfs rw "			\
143 			"nfsroot=${serverip}:${rootpath},v3,tcp\0"	\
144 	"mmc_mmc="							\
145 		"if run mmcload mmcargs addargs ; then "		\
146 		"bootm ${loadaddr} - ${dtbaddr} ; "			\
147 		"fi\0"							\
148 	"mmc_nfs="							\
149 		"if run mmcload nfsargs addip addargs ; then "		\
150 		"bootm ${loadaddr} - ${dtbaddr} ; "			\
151 		"fi\0"							\
152 	"sf_mmc="							\
153 		"if run sfload mmcargs addargs ; then "			\
154 		"bootm ${loadaddr} - ${dtbaddr} ; "			\
155 		"fi\0"							\
156 	"sf_swu="							\
157 		"if run sfload ; then "					\
158 		"sf read ${rdaddr} ${sf_swu_offset} ${sf_swu_size} ; "	\
159 		"setenv bootargs root=/dev/ram0 rw ; "			\
160 		"run addargs ; "					\
161 		"bootm ${loadaddr} ${rdaddr} ; "		\
162 		"fi\0"							\
163 	"net_mmc="							\
164 		"if run netload mmcargs addargs ; then "		\
165 		"bootm ${loadaddr} - ${dtbaddr} ; "			\
166 		"fi\0"							\
167 	"net_nfs="							\
168 		"if run netload nfsargs addip addargs ; then "		\
169 		"bootm ${loadaddr} - ${dtbaddr} ; "			\
170 		"fi\0"							\
171 	"prebootcmd="							\
172 		"if test \"${envsaved}\" != y ; then ; "		\
173 		"setenv envsaved y ; "					\
174 		"saveenv ; "						\
175 		"fi ; "							\
176 		"if test \"${bootmode}\" = normal ; then "		\
177 		"setenv bootdelay 0 ; "					\
178 		"setenv bootpri mmc_mmc ; "				\
179 		"elif test \"${bootmode}\" = devel ; then "		\
180 		"setenv bootdelay 3 ; "					\
181 		"setenv bootpri net_mmc ; "				\
182 		"else "							\
183 		"if test \"${bootmode}\" != update ; then "		\
184 		"echo Warning: unknown bootmode \"${bootmode}\" ; "	\
185 		"fi ; "							\
186 		"setenv bootdelay 1 ; "					\
187 		"setenv bootpri sf_swu ; "				\
188 		"fi\0"
189 
190 /* The rest of the configuration is shared */
191 #include <configs/mxs.h>
192 
193 #endif /* __CONFIGS_XEA_H__ */
194