1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
10 #include "mx6_common.h"
13 #define CONFIG_CMD_SPL
14 #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
15 #define CONFIG_CMD_SPL_WRITE_SIZE (44 * SZ_1K)
17 /* Falcon Mode - MMC support */
18 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x3F00
19 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS \
20 (CONFIG_CMD_SPL_WRITE_SIZE / 512)
21 #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x100 /* 128KiB */
24 * display5 SPI-NOR memory layout
26 * The definition can be found in Kconfig's
27 * CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
29 * 0x000000 - 0x020000 : SPI.SPL (128KiB)
30 * 0x020000 - 0x120000 : SPI.u-boot (1MiB)
31 * 0x120000 - 0x130000 : SPI.u-boot-env1 (64KiB)
32 * 0x130000 - 0x140000 : SPI.u-boot-env2 (64KiB)
33 * 0x140000 - 0x540000 : SPI.swupdate-kernel-FIT (4MiB)
34 * 0x540000 - 0x1540000 : SPI.swupdate-initramfs (16MiB)
35 * 0x1540000 - 0x1640000 : SPI.factory (1MiB)
38 /* SPI Flash Configs */
39 #if defined(CONFIG_SPL_BUILD)
41 #undef CONFIG_DM_SPI_FLASH
44 /* Below values are "dummy" - only to avoid build break */
45 #define CONFIG_SYS_SPI_KERNEL_OFFS 0x150000
46 #define CONFIG_SYS_SPI_ARGS_OFFS 0x140000
47 #define CONFIG_SYS_SPI_ARGS_SIZE 0x10000
51 #define CONFIG_CMDLINE_TAG
52 #define CONFIG_SETUP_MEMORY_TAGS
53 #define CONFIG_INITRD_TAG
54 #define CONFIG_REVISION_TAG
56 /* Size of malloc() pool */
57 #define CONFIG_SYS_MALLOC_LEN (16 * 1024 * 1024)
59 #define CONFIG_MXC_UART_BASE UART5_BASE
62 #define CONFIG_I2C_MULTI_BUS
65 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
66 #define CONFIG_SYS_FSL_USDHC_NUM 2
68 /* allow to overwrite serial and ethaddr */
69 #define CONFIG_ENV_OVERWRITE
70 #define CONFIG_BAUDRATE 115200
72 #ifndef CONFIG_BOOTCOMMAND
73 #define CONFIG_BOOTCOMMAND "if run check_em_pad; then " \
75 "else if test ${BOOT_FROM} = FACTORY; then " \
82 #define PARTS_DEFAULT \
83 /* Linux partitions */ \
85 "uuid_disk=${uuid_gpt_disk};" \
86 "name=kernel_raw1,start=128K,size=8M,uuid=${uuid_gpt_kernel_raw1};" \
87 "name=rootfs1,size=1528M,uuid=${uuid_gpt_rootfs1};" \
88 "name=kernel_raw2,size=8M,uuid=${uuid_gpt_kernel_raw2};" \
89 "name=rootfs2,size=512M,uuid=${uuid_gpt_rootfs2};" \
90 "name=data,size=-,uuid=${uuid_gpt_data}\0"
92 #define SWUPDATE_RECOVERY_PROCEDURE \
93 "echo '#######################';" \
94 "echo '# RECOVERY SWUupdate #';" \
95 "echo '#######################';" \
96 "echo '#######################';" \
97 "echo '# GPT verify #';" \
98 "if gpt verify mmc ${mmcdev} ${partitions}; then " \
101 "echo '# FAILED ! #';" \
102 "echo '# GPT RESTORATION #';" \
103 "gpt write mmc ${mmcdev} ${partitions};" \
105 "echo '#######################';" \
106 "setenv loadaddr_swu_initramfs 0x14000000;" \
107 "setenv bootargs console=${console} " \
108 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
109 ":${hostname}::off root=/dev/ram rw;" \
111 "sf read ${loadaddr} swu-kernel;" \
112 "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \
113 "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
115 #define SETUP_BOOTARGS \
116 "run set_rootfs_part;" \
117 "setenv bootargs ${bootargs} console=${console} " \
118 "root=/dev/mmcblk${mmcdev}p${rootfs_part} " \
119 "rootwait rootfstype=ext4 rw; " \
120 "run set_kernel_part;" \
121 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
122 "mmc read ${loadaddr} ${lba_start} ${fitImg_fw_sz}; " \
123 "setenv fdt_conf imx6q-${board}-${display}.dtb; "
125 /* All the numbers are in LBAs */
126 #define __TFTP_UPDATE_KERNEL \
128 "if test ! -n ${kernel_part}; then " \
129 "setenv kernel_part ${kernel_part_active};" \
131 "if tftp ${loadaddr} ${kernel_file}; then " \
132 "setexpr fw_sz ${filesize} / 0x200; " \
133 "setexpr fw_sz ${fw_sz} + 1; " \
134 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
135 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
138 #define TFTP_UPDATE_KERNEL \
139 "setenv kernel_part ${kernel_part_active};" \
140 "run tftp_mmc_fitImg;" \
141 "setenv kernel_part ${kernel_part_backup};" \
142 "run tftp_mmc_fitImg;" \
144 #define __TFTP_UPDATE_ROOTFS \
146 "if test ! -n ${rootfs_part}; then " \
147 "setenv rootfs_part ${rootfs_part_active};" \
149 "if tftp ${loadaddr} ${rootfs_file}; then " \
150 "setexpr fw_sz ${filesize} / 0x200; " \
151 "setexpr fw_sz ${fw_sz} + 1; " \
152 "part start mmc ${mmcdev} ${rootfs_part} lba_start; " \
153 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
156 #define TFTP_UPDATE_ROOTFS \
157 "setenv rootfs_part ${rootfs_part_active};" \
158 "run tftp_mmc_rootfs;" \
159 "run tftp_mmc_rootfs_bkp;" \
162 #define TFTP_UPDATE_RECOVERY_SWU_KERNEL \
163 "tftp_sf_fitImg_SWU=" \
164 "if tftp ${loadaddr} ${kernel_file}; then " \
166 "sf erase swu-kernel +${filesize};" \
167 "sf write ${loadaddr} swu-kernel ${filesize};" \
170 #define TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
171 "swu_initramfs_file=swupdate-image-display5.ext4.gz.u-boot\0" \
172 "tftp_sf_initramfs_SWU=" \
173 "if tftp ${loadaddr} ${swu_initramfs_file}; then " \
175 "sf erase swu-initramfs +${filesize};" \
176 "sf write ${loadaddr} swu-initramfs ${filesize};" \
179 #define TFTP_UPDATE_BOOTLOADER \
180 "ubootfile=u-boot.img\0" \
181 "ubootfileSPL=SPL\0" \
183 "if tftp ${loadaddr} ${ubootfile}; then " \
185 "sf erase u-boot +${filesize};" \
186 "sf write ${loadaddr} u-boot ${filesize}" \
189 "if tftp ${loadaddr} ${ubootfileSPL}; then " \
191 "setexpr uboot_SPL_size ${filesize} + 0x400;" \
192 "sf erase 0x0 +${uboot_SPL_size};" \
193 "sf write ${loadaddr} 0x400 ${filesize};" \
196 #define TFTP_UPDATE_SPINOR \
197 "spinorfile=core-image-lwn-display5.spinor\0" \
198 "spinorsize=0x2000000\0" \
200 "if tftp ${loadaddr} ${spinorfile}; then " \
202 "sf erase 0x0 ${spinorsize};" \
203 "sf write ${loadaddr} 0x0 ${filesize};" \
206 #define CONFIG_EXTRA_ENV_SETTINGS \
208 "gpio_recovery=93\0" \
209 "check_em_pad=gpio input ${gpio_recovery};test $? -eq 0;\0" \
210 "display=tianma-tm070-800x480\0" \
213 "altbootcmd=run recovery\0" \
215 "baudrate=115200\0" \
216 "bootcmd=" CONFIG_BOOTCOMMAND "\0" \
220 "hostname=display5\0" \
221 "loadaddr=0x12000000\0" \
222 "fdtaddr=0x12800000\0" \
223 "console=ttymxc4,115200 quiet cma=256M\0" \
224 "fdtfile=imx6q-display5.dtb\0" \
225 "fdt_high=0xffffffff\0" \
226 "initrd_high=0xffffffff\0" \
227 "kernel_file=fitImage\0" \
228 "fitImg_fw_sz=0x2200\0" \
229 "up=run tftp_sf_SPL; run tftp_sf_uboot\0" \
231 "tftpboot ${loadaddr} ${kernel_file};\0" \
233 "setenv ipaddr 192.168.1.102;" \
234 "setenv gatewayip 192.168.1.1;" \
235 "setenv netmask 255.255.255.0;" \
236 "setenv serverip 192.168.1.2;" \
237 "echo BOOT: FACTORY (LEG);" \
239 "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \
241 "echo BOOT: RECOVERY: SWU;" \
242 "run boot_swu_recovery\0" \
244 "if run download_kernel; then " \
245 "setenv bootargs console=${console} " \
246 "root=/dev/mmcblk0p2 rootwait;" \
247 "bootm ${loadaddr} - ${fdtaddr};reset;" \
249 "addip=setenv bootargs ${bootargs} " \
250 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
251 "${hostname}:eth0:on" \
253 "nfsargs=setenv bootargs " \
254 "root=/dev/nfs rw " \
255 "nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" \
257 "rootpath=/srv/tftp/DISP5/rootfs\0" \
259 "if run download_kernel; then " \
262 "setenv bootargs ${bootargs} console=${console};" \
263 "setenv fdt_conf imx6q-${board}-${display}.dtb; " \
264 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
267 "if mmc dev ${mmcdev}; then " \
269 "spl export fdt ${loadaddr}#conf@${fdt_conf};" \
270 "setexpr fw_sz ${fdtargslen} / 0x200; " \
271 "setexpr fw_sz ${fw_sz} + 1; " \
272 "mmc write ${fdtargsaddr} " \
273 __stringify(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)" ${fw_sz}; " \
276 "if mmc dev ${mmcdev}; then " \
278 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
281 "if test ${BOOT_FROM} = ACTIVE; then " \
282 "setenv kernel_part ${kernel_part_active};" \
283 "echo BOOT: ACTIVE;" \
284 "else if test ${BOOT_FROM} = BACKUP; then " \
285 "setenv kernel_part ${kernel_part_backup};" \
286 "echo BOOT: BACKUP;" \
291 "if test ${BOOT_FROM} = ACTIVE; then " \
292 "setenv rootfs_part ${rootfs_part_active};" \
293 "else if test ${BOOT_FROM} = BACKUP; then " \
294 "setenv rootfs_part ${rootfs_part_backup};" \
298 "BOOT_FROM=ACTIVE\0" \
299 TFTP_UPDATE_BOOTLOADER \
301 "kernel_part_active=1\0" \
302 "kernel_part_backup=3\0" \
303 __TFTP_UPDATE_KERNEL \
304 "rootfs_part_active=2\0" \
305 "rootfs_part_backup=4\0" \
306 "rootfs_file=core-image-lwn-display5.ext4\0" \
307 "rootfs_file_backup=core-image-lwn-backup-display5.ext4\0" \
308 __TFTP_UPDATE_ROOTFS \
309 "tftp_mmc_rootfs_bkp=" \
310 "setenv rootfs_part ${rootfs_part_backup};" \
311 "setenv rootfs_file ${rootfs_file_backup};" \
312 "run tftp_mmc_rootfs\0" \
313 TFTP_UPDATE_RECOVERY_SWU_KERNEL \
314 TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
317 /* Miscellaneous configurable options */
318 #undef CONFIG_SYS_CBSIZE
319 #define CONFIG_SYS_CBSIZE 2048
321 /* Print Buffer Size */
322 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
323 sizeof(CONFIG_SYS_PROMPT) + 16)
324 #define CONFIG_SYS_MAXARGS 32
325 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
327 #define CONFIG_STANDALONE_LOAD_ADDR 0x10001000
328 #define CONFIG_SYS_HZ 1000
330 /* Physical Memory Map */
331 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
332 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
334 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
335 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
337 #define CONFIG_SYS_INIT_SP_OFFSET \
338 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
339 #define CONFIG_SYS_INIT_SP_ADDR \
340 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
343 #if defined(CONFIG_SPL_BUILD)
345 #undef CONFIG_WATCHDOG
346 #define CONFIG_HW_WATCHDOG
350 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
351 /* The 0x120000 value corresponds to above SPI-NOR memory MAP */
354 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
355 #endif /* __CONFIG_H */