blob: 0a7428b02caf1a9f9f639df0e4e54c2eaff4e233 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Lukasz Majewskia3eec242017-10-31 17:58:05 +01002/*
3 * Copyright (C) 2017
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
Lukasz Majewskia3eec242017-10-31 17:58:05 +01005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
10#include "mx6_common.h"
11
12/* Falcon Mode */
Lukasz Majewskia3eec242017-10-31 17:58:05 +010013
14/* Falcon Mode - MMC support */
Lukasz Majewskia3eec242017-10-31 17:58:05 +010015
16/*
17 * display5 SPI-NOR memory layout
18 *
19 * The definition can be found in Kconfig's
20 * CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
21 *
22 * 0x000000 - 0x020000 : SPI.SPL (128KiB)
23 * 0x020000 - 0x120000 : SPI.u-boot (1MiB)
24 * 0x120000 - 0x130000 : SPI.u-boot-env1 (64KiB)
25 * 0x130000 - 0x140000 : SPI.u-boot-env2 (64KiB)
Lukasz Majewskic04b41b2020-05-13 17:45:15 +020026 * 0x140000 - 0x740000 : SPI.swupdate-kernel-FIT (6MiB)
27 * 0x740000 - 0x1B40000 : SPI.swupdate-initramfs (20MiB)
28 * 0x1B40000 - 0x1F00000 : SPI.reserved (3840KiB)
29 * 0x1F00000 - 0x2000000 : SPI.factory (1MiB)
Lukasz Majewskia3eec242017-10-31 17:58:05 +010030 */
31
Lukasz Majewskia3eec242017-10-31 17:58:05 +010032/* Below values are "dummy" - only to avoid build break */
33#define CONFIG_SYS_SPI_KERNEL_OFFS 0x150000
34#define CONFIG_SYS_SPI_ARGS_OFFS 0x140000
35#define CONFIG_SYS_SPI_ARGS_SIZE 0x10000
36
Lukasz Majewskia3eec242017-10-31 17:58:05 +010037#define CONFIG_MXC_UART_BASE UART5_BASE
38
Lukasz Majewskia3eec242017-10-31 17:58:05 +010039/* I2C Configs */
Lukasz Majewskia3eec242017-10-31 17:58:05 +010040#define CONFIG_I2C_MULTI_BUS
Lukasz Majewskia3eec242017-10-31 17:58:05 +010041
42/* MMC Configs */
Tom Rini6cc04542022-10-28 20:27:13 -040043#define CFG_SYS_FSL_ESDHC_ADDR 0
44#define CFG_SYS_FSL_USDHC_NUM 2
Lukasz Majewskia3eec242017-10-31 17:58:05 +010045
Lukasz Majewskia3eec242017-10-31 17:58:05 +010046#define PARTS_DEFAULT \
47 /* Linux partitions */ \
48 "partitions=" \
49 "uuid_disk=${uuid_gpt_disk};" \
50 "name=kernel_raw1,start=128K,size=8M,uuid=${uuid_gpt_kernel_raw1};" \
51 "name=rootfs1,size=1528M,uuid=${uuid_gpt_rootfs1};" \
52 "name=kernel_raw2,size=8M,uuid=${uuid_gpt_kernel_raw2};" \
Lukasz Majewski9fea1ca2018-05-11 16:51:16 +020053 "name=rootfs2,size=512M,uuid=${uuid_gpt_rootfs2};" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +010054 "name=data,size=-,uuid=${uuid_gpt_data}\0"
55
Lukasz Majewskia3eec242017-10-31 17:58:05 +010056#define SWUPDATE_RECOVERY_PROCEDURE \
57 "echo '#######################';" \
58 "echo '# RECOVERY SWUupdate #';" \
59 "echo '#######################';" \
Lukasz Majewski0f055122018-05-11 16:51:18 +020060 "echo '#######################';" \
61 "echo '# GPT verify #';" \
62 "if gpt verify mmc ${mmcdev} ${partitions}; then " \
63 "echo '# OK ! #';" \
64 "else " \
65 "echo '# FAILED ! #';" \
66 "echo '# GPT RESTORATION #';" \
67 "gpt write mmc ${mmcdev} ${partitions};" \
68 "fi;" \
69 "echo '#######################';" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +010070 "setenv loadaddr_swu_initramfs 0x14000000;" \
71 "setenv bootargs console=${console} " \
72 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
73 ":${hostname}::off root=/dev/ram rw;" \
74 "sf probe;" \
75 "sf read ${loadaddr} swu-kernel;" \
76 "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \
Lukasz Majewski1bcbf482018-05-11 16:51:04 +020077 "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
Lukasz Majewskia3eec242017-10-31 17:58:05 +010078
Lukasz Majewskia3eec242017-10-31 17:58:05 +010079#define SETUP_BOOTARGS \
80 "run set_rootfs_part;" \
81 "setenv bootargs ${bootargs} console=${console} " \
82 "root=/dev/mmcblk${mmcdev}p${rootfs_part} " \
83 "rootwait rootfstype=ext4 rw; " \
84 "run set_kernel_part;" \
85 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
Lukasz Majewskif008e262018-08-18 22:22:07 +020086 "mmc read ${loadaddr} ${lba_start} ${fitImg_fw_sz}; " \
Lukasz Majewskia3eec242017-10-31 17:58:05 +010087 "setenv fdt_conf imx6q-${board}-${display}.dtb; "
88
89/* All the numbers are in LBAs */
90#define __TFTP_UPDATE_KERNEL \
91 "tftp_mmc_fitImg=" \
92 "if test ! -n ${kernel_part}; then " \
93 "setenv kernel_part ${kernel_part_active};" \
94 "fi;" \
95 "if tftp ${loadaddr} ${kernel_file}; then " \
96 "setexpr fw_sz ${filesize} / 0x200; " \
97 "setexpr fw_sz ${fw_sz} + 1; " \
98 "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
99 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
100 "; fi\0" \
101
102#define TFTP_UPDATE_KERNEL \
103 "setenv kernel_part ${kernel_part_active};" \
104 "run tftp_mmc_fitImg;" \
105 "setenv kernel_part ${kernel_part_backup};" \
106 "run tftp_mmc_fitImg;" \
107
108#define __TFTP_UPDATE_ROOTFS \
109 "tftp_mmc_rootfs=" \
110 "if test ! -n ${rootfs_part}; then " \
111 "setenv rootfs_part ${rootfs_part_active};" \
112 "fi;" \
113 "if tftp ${loadaddr} ${rootfs_file}; then " \
114 "setexpr fw_sz ${filesize} / 0x200; " \
115 "setexpr fw_sz ${fw_sz} + 1; " \
116 "part start mmc ${mmcdev} ${rootfs_part} lba_start; " \
117 "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
118 "; fi\0" \
119
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100120#define TFTP_UPDATE_ROOTFS \
121 "setenv rootfs_part ${rootfs_part_active};" \
122 "run tftp_mmc_rootfs;" \
Lukasz Majewski18ccca52018-05-11 16:51:11 +0200123 "run tftp_mmc_rootfs_bkp;" \
124
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100125
126#define TFTP_UPDATE_RECOVERY_SWU_KERNEL \
127 "tftp_sf_fitImg_SWU=" \
128 "if tftp ${loadaddr} ${kernel_file}; then " \
129 "sf probe;" \
130 "sf erase swu-kernel +${filesize};" \
131 "sf write ${loadaddr} swu-kernel ${filesize};" \
132 "; fi\0" \
133
134#define TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
Lukasz Majewskib5f45432018-05-11 16:51:12 +0200135 "swu_initramfs_file=swupdate-image-display5.ext4.gz.u-boot\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100136 "tftp_sf_initramfs_SWU=" \
137 "if tftp ${loadaddr} ${swu_initramfs_file}; then " \
138 "sf probe;" \
139 "sf erase swu-initramfs +${filesize};" \
140 "sf write ${loadaddr} swu-initramfs ${filesize};" \
141 "; fi\0" \
142
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100143#define TFTP_UPDATE_BOOTLOADER \
144 "ubootfile=u-boot.img\0" \
145 "ubootfileSPL=SPL\0" \
146 "tftp_sf_uboot=" \
147 "if tftp ${loadaddr} ${ubootfile}; then " \
148 "sf probe;" \
149 "sf erase u-boot +${filesize};" \
150 "sf write ${loadaddr} u-boot ${filesize}" \
151 "; fi\0" \
152 "tftp_sf_SPL=" \
153 "if tftp ${loadaddr} ${ubootfileSPL}; then " \
154 "sf probe;" \
155 "setexpr uboot_SPL_size ${filesize} + 0x400;" \
156 "sf erase 0x0 +${uboot_SPL_size};" \
157 "sf write ${loadaddr} 0x400 ${filesize};" \
158 "fi\0" \
159
Lukasz Majewski2f4372a2018-05-11 16:51:02 +0200160#define TFTP_UPDATE_SPINOR \
161 "spinorfile=core-image-lwn-display5.spinor\0" \
162 "spinorsize=0x2000000\0" \
163 "tftp_sf_img=" \
164 "if tftp ${loadaddr} ${spinorfile}; then " \
165 "sf probe;" \
166 "sf erase 0x0 ${spinorsize};" \
167 "sf write ${loadaddr} 0x0 ${filesize};" \
168 "fi\0" \
169
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100170#define CONFIG_EXTRA_ENV_SETTINGS \
171 PARTS_DEFAULT \
Lukasz Majewski27aede22018-05-11 16:51:08 +0200172 "gpio_recovery=93\0" \
173 "check_em_pad=gpio input ${gpio_recovery};test $? -eq 0;\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100174 "display=tianma-tm070-800x480\0" \
175 "board=display5\0" \
176 "mmcdev=0\0" \
177 "altbootcmd=run recovery\0" \
178 "bootdelay=1\0" \
179 "baudrate=115200\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100180 "ethact=FEC\0" \
181 "netdev=eth0\0" \
182 "boot_os=y\0" \
183 "hostname=display5\0" \
184 "loadaddr=0x12000000\0" \
185 "fdtaddr=0x12800000\0" \
Lukasz Majewski5d925402018-05-11 16:51:15 +0200186 "console=ttymxc4,115200 quiet cma=256M\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100187 "fdtfile=imx6q-display5.dtb\0" \
188 "fdt_high=0xffffffff\0" \
189 "initrd_high=0xffffffff\0" \
190 "kernel_file=fitImage\0" \
Lukasz Majewskif008e262018-08-18 22:22:07 +0200191 "fitImg_fw_sz=0x2200\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100192 "up=run tftp_sf_SPL; run tftp_sf_uboot\0" \
193 "download_kernel=" \
194 "tftpboot ${loadaddr} ${kernel_file};\0" \
Lukasz Majewski13e012f2018-05-11 16:50:59 +0200195 "factory_nfs=" \
Lukasz Majewski4864ba72018-05-11 16:51:00 +0200196 "setenv ipaddr 192.168.1.102;" \
197 "setenv gatewayip 192.168.1.1;" \
198 "setenv netmask 255.255.255.0;" \
199 "setenv serverip 192.168.1.2;" \
Lukasz Majewski13e012f2018-05-11 16:50:59 +0200200 "echo BOOT: FACTORY (LEG);" \
201 "run boot_nfs\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100202 "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \
203 "recovery=" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100204 "echo BOOT: RECOVERY: SWU;" \
Lukasz Majewskib78e9c42018-05-11 16:51:05 +0200205 "run boot_swu_recovery\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100206 "boot_tftp=" \
207 "if run download_kernel; then " \
208 "setenv bootargs console=${console} " \
209 "root=/dev/mmcblk0p2 rootwait;" \
Lukasz Majewski1bcbf482018-05-11 16:51:04 +0200210 "bootm ${loadaddr} - ${fdtaddr};reset;" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100211 "fi\0" \
212 "addip=setenv bootargs ${bootargs} " \
213 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
214 "${hostname}:eth0:on" \
215 "\0" \
216 "nfsargs=setenv bootargs " \
217 "root=/dev/nfs rw " \
218 "nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" \
219 "\0" \
220 "rootpath=/srv/tftp/DISP5/rootfs\0" \
221 "boot_nfs=" \
222 "if run download_kernel; then " \
223 "run nfsargs;" \
224 "run addip;" \
225 "setenv bootargs ${bootargs} console=${console};" \
226 "setenv fdt_conf imx6q-${board}-${display}.dtb; " \
Lukasz Majewski1bcbf482018-05-11 16:51:04 +0200227 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100228 "fi\0" \
229 "falcon_setup=" \
230 "if mmc dev ${mmcdev}; then " \
231 SETUP_BOOTARGS \
232 "spl export fdt ${loadaddr}#conf@${fdt_conf};" \
233 "setexpr fw_sz ${fdtargslen} / 0x200; " \
234 "setexpr fw_sz ${fw_sz} + 1; " \
235 "mmc write ${fdtargsaddr} " \
236 __stringify(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)" ${fw_sz}; " \
237 "fi\0" \
238 "boot_mmc=" \
239 "if mmc dev ${mmcdev}; then " \
240 SETUP_BOOTARGS \
Lukasz Majewski1bcbf482018-05-11 16:51:04 +0200241 "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100242 "fi\0" \
243 "set_kernel_part=" \
244 "if test ${BOOT_FROM} = ACTIVE; then " \
245 "setenv kernel_part ${kernel_part_active};" \
246 "echo BOOT: ACTIVE;" \
247 "else if test ${BOOT_FROM} = BACKUP; then " \
248 "setenv kernel_part ${kernel_part_backup};" \
249 "echo BOOT: BACKUP;" \
250 "else " \
251 "run recovery;" \
252 "fi;fi\0" \
253 "set_rootfs_part=" \
254 "if test ${BOOT_FROM} = ACTIVE; then " \
255 "setenv rootfs_part ${rootfs_part_active};" \
256 "else if test ${BOOT_FROM} = BACKUP; then " \
257 "setenv rootfs_part ${rootfs_part_backup};" \
258 "else " \
259 "run recovery;" \
260 "fi;fi\0" \
261 "BOOT_FROM=ACTIVE\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100262 TFTP_UPDATE_BOOTLOADER \
Lukasz Majewski2f4372a2018-05-11 16:51:02 +0200263 TFTP_UPDATE_SPINOR \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100264 "kernel_part_active=1\0" \
265 "kernel_part_backup=3\0" \
266 __TFTP_UPDATE_KERNEL \
267 "rootfs_part_active=2\0" \
268 "rootfs_part_backup=4\0" \
269 "rootfs_file=core-image-lwn-display5.ext4\0" \
Lukasz Majewskidd4ed882018-05-11 16:51:10 +0200270 "rootfs_file_backup=core-image-lwn-backup-display5.ext4\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100271 __TFTP_UPDATE_ROOTFS \
Lukasz Majewskidd4ed882018-05-11 16:51:10 +0200272 "tftp_mmc_rootfs_bkp=" \
273 "setenv rootfs_part ${rootfs_part_backup};" \
274 "setenv rootfs_file ${rootfs_file_backup};" \
275 "run tftp_mmc_rootfs\0" \
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100276 TFTP_UPDATE_RECOVERY_SWU_KERNEL \
277 TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
278 "\0" \
279
280/* Miscellaneous configurable options */
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100281
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100282#define CONFIG_STANDALONE_LOAD_ADDR 0x10001000
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100283
284/* Physical Memory Map */
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100285#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
Tom Riniaa6e94d2022-11-16 13:10:37 -0500286#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100287
288#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
289#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
290
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100291/* ENV config */
292#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100293/* The 0x120000 value corresponds to above SPI-NOR memory MAP */
Lukasz Majewskia3eec242017-10-31 17:58:05 +0100294#endif
295
296#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
297#endif /* __CONFIG_H */