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 * 0x940000 - 0xD40000 : SPI.swupdate-kernel-FIT (4MiB)
34 * 0xD40000 - 0x1540000 : SPI.swupdate-initramfs (8MiB)
35 * 0x1540000 - 0x1640000 : SPI.factory (1MiB)
38 #ifndef CONFIG_SPL_BUILD
39 #define CONFIG_MTD_DEVICE
40 #define CONFIG_SPI_FLASH_MTD
41 #define CONFIG_MTD_PARTITIONS
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
50 #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
52 #define CONFIG_CMDLINE_TAG
53 #define CONFIG_SETUP_MEMORY_TAGS
54 #define CONFIG_INITRD_TAG
55 #define CONFIG_REVISION_TAG
57 /* Size of malloc() pool */
58 #define CONFIG_SYS_MALLOC_LEN (16 * 1024 * 1024)
59 #define CONFIG_MISC_INIT_R
61 /*#define CONFIG_MXC_UART*/
62 #define CONFIG_MXC_UART_BASE UART5_BASE
66 #define CONFIG_SF_DEFAULT_BUS 1
67 #define CONFIG_SF_DEFAULT_CS (0 | (IMX_GPIO_NR(5, 29) << 8))
68 #define CONFIG_SF_DEFAULT_SPEED 50000000
69 #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
73 #define CONFIG_SYS_I2C
74 #define CONFIG_SYS_I2C_MXC
75 #define CONFIG_SYS_I2C_MXC_I2C1
76 #define CONFIG_SYS_I2C_MXC_I2C2
77 #define CONFIG_SYS_I2C_MXC_I2C3
78 #define CONFIG_I2C_MULTI_BUS
79 #define CONFIG_SYS_I2C_SPEED 100000
80 #define CONFIG_I2C_EDID
81 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
85 #define IMX_FEC_BASE ENET_BASE_ADDR
86 #define CONFIG_FEC_XCV_TYPE RGMII
87 #define CONFIG_ETHPRIME "FEC"
88 #define CONFIG_FEC_MXC_PHYADDR 0
93 #define CONFIG_FSL_USDHC
94 #define CONFIG_SYS_FSL_ESDHC_ADDR 0
95 #define CONFIG_SYS_FSL_USDHC_NUM 2
96 #define CONFIG_SUPPORT_EMMC_BOOT
98 /* allow to overwrite serial and ethaddr */
99 #define CONFIG_ENV_OVERWRITE
100 #define CONFIG_BAUDRATE 115200
102 #ifndef CONFIG_BOOTCOMMAND
103 #define CONFIG_BOOTCOMMAND "if test ${BOOT_FROM} = FACTORY; then " \
110 #define PARTS_DEFAULT \
111 /* Linux partitions */ \
113 "uuid_disk=${uuid_gpt_disk};" \
114 "name=kernel_raw1,start=128K,size=8M,uuid=${uuid_gpt_kernel_raw1};" \
115 "name=rootfs1,size=1528M,uuid=${uuid_gpt_rootfs1};" \
116 "name=kernel_raw2,size=8M,uuid=${uuid_gpt_kernel_raw2};" \
117 "name=rootfs2,size=1528M,uuid=${uuid_gpt_rootfs2};" \
118 "name=data,size=-,uuid=${uuid_gpt_data}\0"
120 #define FACTORY_PROCEDURE \
121 "echo '#######################';" \
122 "echo '# Factory Boot #';" \
123 "echo '#######################';" \
126 "gpt write mmc ${mmcdev} ${partitions};" \
128 "run tftp_sf_uboot;" \
130 "run tftp_sf_fitImg_SWU;" \
131 "run tftp_sf_initramfs_SWU;" \
133 "echo '#######################';" \
134 "echo '# END - OK #';" \
135 "echo '#######################';" \
136 "setenv bootcmd 'env default -a; saveenv; run falcon_setup; reset';" \
137 "setenv boot_os 'n';" \
141 #define SWUPDATE_RECOVERY_PROCEDURE \
142 "echo '#######################';" \
143 "echo '# RECOVERY SWUupdate #';" \
144 "echo '#######################';" \
145 "setenv loadaddr_swu_initramfs 0x14000000;" \
146 "setenv bootargs console=${console} " \
147 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
148 ":${hostname}::off root=/dev/ram rw;" \
150 "sf read ${loadaddr} swu-kernel;" \
151 "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \
152 "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
154 #define SETUP_BOOTARGS \
155 "run set_rootfs_part;" \
156 "setenv bootargs ${bootargs} console=${console} " \
157 "root=/dev/mmcblk${mmcdev}p${rootfs_part} " \
158 "rootwait rootfstype=ext4 rw; " \
159 "run set_kernel_part;" \
160 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
161 "mmc read ${loadaddr} ${lba_start} 0x2000; " \
162 "setenv fdt_conf imx6q-${board}-${display}.dtb; "
164 /* All the numbers are in LBAs */
165 #define __TFTP_UPDATE_KERNEL \
167 "if test ! -n ${kernel_part}; then " \
168 "setenv kernel_part ${kernel_part_active};" \
170 "if tftp ${loadaddr} ${kernel_file}; then " \
171 "setexpr fw_sz ${filesize} / 0x200; " \
172 "setexpr fw_sz ${fw_sz} + 1; " \
173 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
174 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
177 #define TFTP_UPDATE_KERNEL \
178 "setenv kernel_part ${kernel_part_active};" \
179 "run tftp_mmc_fitImg;" \
180 "setenv kernel_part ${kernel_part_backup};" \
181 "run tftp_mmc_fitImg;" \
183 #define __TFTP_UPDATE_ROOTFS \
185 "if test ! -n ${rootfs_part}; then " \
186 "setenv rootfs_part ${rootfs_part_active};" \
188 "if tftp ${loadaddr} ${rootfs_file}; then " \
189 "setexpr fw_sz ${filesize} / 0x200; " \
190 "setexpr fw_sz ${fw_sz} + 1; " \
191 "part start mmc ${mmcdev} ${rootfs_part} lba_start; " \
192 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
195 /* To save some considerable time, we only once download the rootfs image */
196 /* and store it on 'active' and 'backup' rootfs partitions */
197 #define TFTP_UPDATE_ROOTFS \
198 "setenv rootfs_part ${rootfs_part_active};" \
199 "run tftp_mmc_rootfs;" \
200 "part start mmc ${mmcdev} ${rootfs_part_backup} lba_start;" \
201 "mmc write ${loadaddr} ${lba_start} ${fw_sz};" \
203 #define TFTP_UPDATE_RECOVERY_SWU_KERNEL \
204 "tftp_sf_fitImg_SWU=" \
205 "if tftp ${loadaddr} ${kernel_file}; then " \
207 "sf erase swu-kernel +${filesize};" \
208 "sf write ${loadaddr} swu-kernel ${filesize};" \
211 #define TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
212 "swu_initramfs_file=swupdate-image-display5.ext3.gz.u-boot\0" \
213 "tftp_sf_initramfs_SWU=" \
214 "if tftp ${loadaddr} ${swu_initramfs_file}; then " \
216 "sf erase swu-initramfs +${filesize};" \
217 "sf write ${loadaddr} swu-initramfs ${filesize};" \
220 #define TFTP_UPDATE_BOOTLOADER \
221 "ubootfile=u-boot.img\0" \
222 "ubootfileSPL=SPL\0" \
224 "if tftp ${loadaddr} ${ubootfile}; then " \
226 "sf erase u-boot +${filesize};" \
227 "sf write ${loadaddr} u-boot ${filesize}" \
230 "if tftp ${loadaddr} ${ubootfileSPL}; then " \
232 "setexpr uboot_SPL_size ${filesize} + 0x400;" \
233 "sf erase 0x0 +${uboot_SPL_size};" \
234 "sf write ${loadaddr} 0x400 ${filesize};" \
237 #define TFTP_UPDATE_SPINOR \
238 "spinorfile=core-image-lwn-display5.spinor\0" \
239 "spinorsize=0x2000000\0" \
241 "if tftp ${loadaddr} ${spinorfile}; then " \
243 "sf erase 0x0 ${spinorsize};" \
244 "sf write ${loadaddr} 0x0 ${filesize};" \
247 #define CONFIG_EXTRA_ENV_SETTINGS \
249 "display=tianma-tm070-800x480\0" \
252 "altbootcmd=run recovery\0" \
254 "baudrate=115200\0" \
255 "bootcmd=" CONFIG_BOOTCOMMAND "\0" \
256 "factory=" FACTORY_PROCEDURE "\0" \
261 "hostname=display5\0" \
262 "loadaddr=0x12000000\0" \
263 "fdtaddr=0x12800000\0" \
264 "console=ttymxc4,115200 quiet\0" \
265 "fdtfile=imx6q-display5.dtb\0" \
266 "fdt_high=0xffffffff\0" \
267 "initrd_high=0xffffffff\0" \
268 "kernel_file=fitImage\0" \
269 "up=run tftp_sf_SPL; run tftp_sf_uboot\0" \
271 "tftpboot ${loadaddr} ${kernel_file};\0" \
273 "setenv ipaddr 192.168.1.102;" \
274 "setenv gatewayip 192.168.1.1;" \
275 "setenv netmask 255.255.255.0;" \
276 "setenv serverip 192.168.1.2;" \
277 "echo BOOT: FACTORY (LEG);" \
279 "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \
281 "echo BOOT: RECOVERY: SWU;" \
282 "run boot_swu_recovery\0" \
284 "if run download_kernel; then " \
285 "setenv bootargs console=${console} " \
286 "root=/dev/mmcblk0p2 rootwait;" \
287 "bootm ${loadaddr} - ${fdtaddr};reset;" \
289 "addip=setenv bootargs ${bootargs} " \
290 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
291 "${hostname}:eth0:on" \
293 "nfsargs=setenv bootargs " \
294 "root=/dev/nfs rw " \
295 "nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" \
297 "rootpath=/srv/tftp/DISP5/rootfs\0" \
299 "if run download_kernel; then " \
302 "setenv bootargs ${bootargs} console=${console};" \
303 "setenv fdt_conf imx6q-${board}-${display}.dtb; " \
304 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
307 "if mmc dev ${mmcdev}; then " \
309 "spl export fdt ${loadaddr}#conf@${fdt_conf};" \
310 "setexpr fw_sz ${fdtargslen} / 0x200; " \
311 "setexpr fw_sz ${fw_sz} + 1; " \
312 "mmc write ${fdtargsaddr} " \
313 __stringify(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)" ${fw_sz}; " \
316 "if mmc dev ${mmcdev}; then " \
318 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
321 "if test ${BOOT_FROM} = ACTIVE; then " \
322 "setenv kernel_part ${kernel_part_active};" \
323 "echo BOOT: ACTIVE;" \
324 "else if test ${BOOT_FROM} = BACKUP; then " \
325 "setenv kernel_part ${kernel_part_backup};" \
326 "echo BOOT: BACKUP;" \
331 "if test ${BOOT_FROM} = ACTIVE; then " \
332 "setenv rootfs_part ${rootfs_part_active};" \
333 "else if test ${BOOT_FROM} = BACKUP; then " \
334 "setenv rootfs_part ${rootfs_part_backup};" \
338 "BOOT_FROM=ACTIVE\0" \
339 TFTP_UPDATE_BOOTLOADER \
341 "kernel_part_active=1\0" \
342 "kernel_part_backup=3\0" \
343 __TFTP_UPDATE_KERNEL \
344 "rootfs_part_active=2\0" \
345 "rootfs_part_backup=4\0" \
346 "rootfs_file=core-image-lwn-display5.ext4\0" \
347 __TFTP_UPDATE_ROOTFS \
348 TFTP_UPDATE_RECOVERY_SWU_KERNEL \
349 TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
352 /* Miscellaneous configurable options */
353 #undef CONFIG_SYS_CBSIZE
354 #define CONFIG_SYS_CBSIZE 2048
356 /* Print Buffer Size */
357 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
358 sizeof(CONFIG_SYS_PROMPT) + 16)
359 #define CONFIG_SYS_MAXARGS 32
360 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
362 #define CONFIG_STANDALONE_LOAD_ADDR 0x10001000
363 #define CONFIG_SYS_HZ 1000
365 /* Physical Memory Map */
366 #define CONFIG_NR_DRAM_BANKS 1
367 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
368 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
370 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
371 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
373 #define CONFIG_SYS_INIT_SP_OFFSET \
374 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
375 #define CONFIG_SYS_INIT_SP_ADDR \
376 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
379 #define CONFIG_MTD_PARTITIONS
380 #define CONFIG_MTD_DEVICE
383 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
384 #define CONFIG_ENV_SIZE (SZ_64K)
385 /* The 0x120000 value corresponds to above SPI-NOR memory MAP */
386 #define CONFIG_ENV_OFFSET (0x120000)
387 #define CONFIG_ENV_SECT_SIZE (SZ_64K)
388 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
389 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \
390 CONFIG_ENV_SECT_SIZE)
391 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
393 #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
394 #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS
395 #define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE
396 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
399 #define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
400 #endif /* __CONFIG_H */