1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
10 #include "mx6_common.h"
13 #define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000
15 /* Falcon Mode - MMC support */
16 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x3F00
17 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS \
18 (CONFIG_CMD_SPL_WRITE_SIZE / 512)
21 * display5 SPI-NOR memory layout
23 * The definition can be found in Kconfig's
24 * CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
26 * 0x000000 - 0x020000 : SPI.SPL (128KiB)
27 * 0x020000 - 0x120000 : SPI.u-boot (1MiB)
28 * 0x120000 - 0x130000 : SPI.u-boot-env1 (64KiB)
29 * 0x130000 - 0x140000 : SPI.u-boot-env2 (64KiB)
30 * 0x140000 - 0x740000 : SPI.swupdate-kernel-FIT (6MiB)
31 * 0x740000 - 0x1B40000 : SPI.swupdate-initramfs (20MiB)
32 * 0x1B40000 - 0x1F00000 : SPI.reserved (3840KiB)
33 * 0x1F00000 - 0x2000000 : SPI.factory (1MiB)
36 /* Below values are "dummy" - only to avoid build break */
37 #define CONFIG_SYS_SPI_KERNEL_OFFS 0x150000
38 #define CONFIG_SYS_SPI_ARGS_OFFS 0x140000
39 #define CONFIG_SYS_SPI_ARGS_SIZE 0x10000
43 #define CONFIG_MXC_UART_BASE UART5_BASE
46 #define CONFIG_I2C_MULTI_BUS
49 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
50 #define CONFIG_SYS_FSL_USDHC_NUM 2
52 #define PARTS_DEFAULT \
53 /* Linux partitions */ \
55 "uuid_disk=${uuid_gpt_disk};" \
56 "name=kernel_raw1,start=128K,size=8M,uuid=${uuid_gpt_kernel_raw1};" \
57 "name=rootfs1,size=1528M,uuid=${uuid_gpt_rootfs1};" \
58 "name=kernel_raw2,size=8M,uuid=${uuid_gpt_kernel_raw2};" \
59 "name=rootfs2,size=512M,uuid=${uuid_gpt_rootfs2};" \
60 "name=data,size=-,uuid=${uuid_gpt_data}\0"
62 #define SWUPDATE_RECOVERY_PROCEDURE \
63 "echo '#######################';" \
64 "echo '# RECOVERY SWUupdate #';" \
65 "echo '#######################';" \
66 "echo '#######################';" \
67 "echo '# GPT verify #';" \
68 "if gpt verify mmc ${mmcdev} ${partitions}; then " \
71 "echo '# FAILED ! #';" \
72 "echo '# GPT RESTORATION #';" \
73 "gpt write mmc ${mmcdev} ${partitions};" \
75 "echo '#######################';" \
76 "setenv loadaddr_swu_initramfs 0x14000000;" \
77 "setenv bootargs console=${console} " \
78 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
79 ":${hostname}::off root=/dev/ram rw;" \
81 "sf read ${loadaddr} swu-kernel;" \
82 "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \
83 "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
85 #define SETUP_BOOTARGS \
86 "run set_rootfs_part;" \
87 "setenv bootargs ${bootargs} console=${console} " \
88 "root=/dev/mmcblk${mmcdev}p${rootfs_part} " \
89 "rootwait rootfstype=ext4 rw; " \
90 "run set_kernel_part;" \
91 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
92 "mmc read ${loadaddr} ${lba_start} ${fitImg_fw_sz}; " \
93 "setenv fdt_conf imx6q-${board}-${display}.dtb; "
95 /* All the numbers are in LBAs */
96 #define __TFTP_UPDATE_KERNEL \
98 "if test ! -n ${kernel_part}; then " \
99 "setenv kernel_part ${kernel_part_active};" \
101 "if tftp ${loadaddr} ${kernel_file}; then " \
102 "setexpr fw_sz ${filesize} / 0x200; " \
103 "setexpr fw_sz ${fw_sz} + 1; " \
104 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
105 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
108 #define TFTP_UPDATE_KERNEL \
109 "setenv kernel_part ${kernel_part_active};" \
110 "run tftp_mmc_fitImg;" \
111 "setenv kernel_part ${kernel_part_backup};" \
112 "run tftp_mmc_fitImg;" \
114 #define __TFTP_UPDATE_ROOTFS \
116 "if test ! -n ${rootfs_part}; then " \
117 "setenv rootfs_part ${rootfs_part_active};" \
119 "if tftp ${loadaddr} ${rootfs_file}; then " \
120 "setexpr fw_sz ${filesize} / 0x200; " \
121 "setexpr fw_sz ${fw_sz} + 1; " \
122 "part start mmc ${mmcdev} ${rootfs_part} lba_start; " \
123 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
126 #define TFTP_UPDATE_ROOTFS \
127 "setenv rootfs_part ${rootfs_part_active};" \
128 "run tftp_mmc_rootfs;" \
129 "run tftp_mmc_rootfs_bkp;" \
132 #define TFTP_UPDATE_RECOVERY_SWU_KERNEL \
133 "tftp_sf_fitImg_SWU=" \
134 "if tftp ${loadaddr} ${kernel_file}; then " \
136 "sf erase swu-kernel +${filesize};" \
137 "sf write ${loadaddr} swu-kernel ${filesize};" \
140 #define TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
141 "swu_initramfs_file=swupdate-image-display5.ext4.gz.u-boot\0" \
142 "tftp_sf_initramfs_SWU=" \
143 "if tftp ${loadaddr} ${swu_initramfs_file}; then " \
145 "sf erase swu-initramfs +${filesize};" \
146 "sf write ${loadaddr} swu-initramfs ${filesize};" \
149 #define TFTP_UPDATE_BOOTLOADER \
150 "ubootfile=u-boot.img\0" \
151 "ubootfileSPL=SPL\0" \
153 "if tftp ${loadaddr} ${ubootfile}; then " \
155 "sf erase u-boot +${filesize};" \
156 "sf write ${loadaddr} u-boot ${filesize}" \
159 "if tftp ${loadaddr} ${ubootfileSPL}; then " \
161 "setexpr uboot_SPL_size ${filesize} + 0x400;" \
162 "sf erase 0x0 +${uboot_SPL_size};" \
163 "sf write ${loadaddr} 0x400 ${filesize};" \
166 #define TFTP_UPDATE_SPINOR \
167 "spinorfile=core-image-lwn-display5.spinor\0" \
168 "spinorsize=0x2000000\0" \
170 "if tftp ${loadaddr} ${spinorfile}; then " \
172 "sf erase 0x0 ${spinorsize};" \
173 "sf write ${loadaddr} 0x0 ${filesize};" \
176 #define CONFIG_EXTRA_ENV_SETTINGS \
178 "gpio_recovery=93\0" \
179 "check_em_pad=gpio input ${gpio_recovery};test $? -eq 0;\0" \
180 "display=tianma-tm070-800x480\0" \
183 "altbootcmd=run recovery\0" \
185 "baudrate=115200\0" \
189 "hostname=display5\0" \
190 "loadaddr=0x12000000\0" \
191 "fdtaddr=0x12800000\0" \
192 "console=ttymxc4,115200 quiet cma=256M\0" \
193 "fdtfile=imx6q-display5.dtb\0" \
194 "fdt_high=0xffffffff\0" \
195 "initrd_high=0xffffffff\0" \
196 "kernel_file=fitImage\0" \
197 "fitImg_fw_sz=0x2200\0" \
198 "up=run tftp_sf_SPL; run tftp_sf_uboot\0" \
200 "tftpboot ${loadaddr} ${kernel_file};\0" \
202 "setenv ipaddr 192.168.1.102;" \
203 "setenv gatewayip 192.168.1.1;" \
204 "setenv netmask 255.255.255.0;" \
205 "setenv serverip 192.168.1.2;" \
206 "echo BOOT: FACTORY (LEG);" \
208 "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \
210 "echo BOOT: RECOVERY: SWU;" \
211 "run boot_swu_recovery\0" \
213 "if run download_kernel; then " \
214 "setenv bootargs console=${console} " \
215 "root=/dev/mmcblk0p2 rootwait;" \
216 "bootm ${loadaddr} - ${fdtaddr};reset;" \
218 "addip=setenv bootargs ${bootargs} " \
219 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
220 "${hostname}:eth0:on" \
222 "nfsargs=setenv bootargs " \
223 "root=/dev/nfs rw " \
224 "nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" \
226 "rootpath=/srv/tftp/DISP5/rootfs\0" \
228 "if run download_kernel; then " \
231 "setenv bootargs ${bootargs} console=${console};" \
232 "setenv fdt_conf imx6q-${board}-${display}.dtb; " \
233 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
236 "if mmc dev ${mmcdev}; then " \
238 "spl export fdt ${loadaddr}#conf@${fdt_conf};" \
239 "setexpr fw_sz ${fdtargslen} / 0x200; " \
240 "setexpr fw_sz ${fw_sz} + 1; " \
241 "mmc write ${fdtargsaddr} " \
242 __stringify(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)" ${fw_sz}; " \
245 "if mmc dev ${mmcdev}; then " \
247 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
250 "if test ${BOOT_FROM} = ACTIVE; then " \
251 "setenv kernel_part ${kernel_part_active};" \
252 "echo BOOT: ACTIVE;" \
253 "else if test ${BOOT_FROM} = BACKUP; then " \
254 "setenv kernel_part ${kernel_part_backup};" \
255 "echo BOOT: BACKUP;" \
260 "if test ${BOOT_FROM} = ACTIVE; then " \
261 "setenv rootfs_part ${rootfs_part_active};" \
262 "else if test ${BOOT_FROM} = BACKUP; then " \
263 "setenv rootfs_part ${rootfs_part_backup};" \
267 "BOOT_FROM=ACTIVE\0" \
268 TFTP_UPDATE_BOOTLOADER \
270 "kernel_part_active=1\0" \
271 "kernel_part_backup=3\0" \
272 __TFTP_UPDATE_KERNEL \
273 "rootfs_part_active=2\0" \
274 "rootfs_part_backup=4\0" \
275 "rootfs_file=core-image-lwn-display5.ext4\0" \
276 "rootfs_file_backup=core-image-lwn-backup-display5.ext4\0" \
277 __TFTP_UPDATE_ROOTFS \
278 "tftp_mmc_rootfs_bkp=" \
279 "setenv rootfs_part ${rootfs_part_backup};" \
280 "setenv rootfs_file ${rootfs_file_backup};" \
281 "run tftp_mmc_rootfs\0" \
282 TFTP_UPDATE_RECOVERY_SWU_KERNEL \
283 TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
286 /* Miscellaneous configurable options */
287 #undef CONFIG_SYS_CBSIZE
288 #define CONFIG_SYS_CBSIZE 2048
290 /* Print Buffer Size */
291 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
292 sizeof(CONFIG_SYS_PROMPT) + 16)
293 #define CONFIG_SYS_MAXARGS 32
294 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
296 #define CONFIG_STANDALONE_LOAD_ADDR 0x10001000
298 /* Physical Memory Map */
299 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
300 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
302 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
303 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
305 #define CONFIG_SYS_INIT_SP_OFFSET \
306 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
307 #define CONFIG_SYS_INIT_SP_ADDR \
308 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
311 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
312 /* The 0x120000 value corresponds to above SPI-NOR memory MAP */
315 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
316 #endif /* __CONFIG_H */