Convert CONFIG_SYS_SPL_ARGS_ADDR to Kconfig
[platform/kernel/u-boot.git] / include / configs / display5.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2017
4  * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
5  */
6
7 #ifndef __CONFIG_H
8 #define __CONFIG_H
9
10 #include "mx6_common.h"
11
12 /* Falcon Mode */
13
14 /* Falcon Mode - MMC support */
15 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR   0x3F00
16 #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS  \
17         (CONFIG_CMD_SPL_WRITE_SIZE / 512)
18
19 /*
20  * display5 SPI-NOR memory layout
21  *
22  * The definition can be found in Kconfig's
23  * CONFIG_MTDIDS_DEFAULT and CONFIG_MTDPARTS_DEFAULT
24  *
25  * 0x000000 - 0x020000 : SPI.SPL (128KiB)
26  * 0x020000 - 0x120000 : SPI.u-boot (1MiB)
27  * 0x120000 - 0x130000 : SPI.u-boot-env1 (64KiB)
28  * 0x130000 - 0x140000 : SPI.u-boot-env2 (64KiB)
29  * 0x140000 - 0x740000 : SPI.swupdate-kernel-FIT (6MiB)
30  * 0x740000 - 0x1B40000 : SPI.swupdate-initramfs  (20MiB)
31  * 0x1B40000 - 0x1F00000 : SPI.reserved (3840KiB)
32  * 0x1F00000 - 0x2000000 : SPI.factory  (1MiB)
33  */
34
35 /* Below values are "dummy" - only to avoid build break */
36 #define CONFIG_SYS_SPI_KERNEL_OFFS      0x150000
37 #define CONFIG_SYS_SPI_ARGS_OFFS        0x140000
38 #define CONFIG_SYS_SPI_ARGS_SIZE        0x10000
39
40 #include "imx6_spl.h"
41
42 #define CONFIG_MXC_UART_BASE            UART5_BASE
43
44 /* I2C Configs */
45 #define CONFIG_I2C_MULTI_BUS
46
47 /* MMC Configs */
48 #define CONFIG_SYS_FSL_ESDHC_ADDR       0
49 #define CONFIG_SYS_FSL_USDHC_NUM        2
50
51 #define PARTS_DEFAULT \
52         /* Linux partitions */ \
53         "partitions=" \
54         "uuid_disk=${uuid_gpt_disk};" \
55         "name=kernel_raw1,start=128K,size=8M,uuid=${uuid_gpt_kernel_raw1};" \
56         "name=rootfs1,size=1528M,uuid=${uuid_gpt_rootfs1};" \
57         "name=kernel_raw2,size=8M,uuid=${uuid_gpt_kernel_raw2};" \
58         "name=rootfs2,size=512M,uuid=${uuid_gpt_rootfs2};" \
59         "name=data,size=-,uuid=${uuid_gpt_data}\0"
60
61 #define SWUPDATE_RECOVERY_PROCEDURE \
62         "echo '#######################';" \
63         "echo '# RECOVERY SWUupdate  #';" \
64         "echo '#######################';" \
65         "echo '#######################';" \
66         "echo '# GPT verify          #';" \
67         "if gpt verify mmc ${mmcdev} ${partitions}; then " \
68                 "echo '# OK !                #';" \
69         "else " \
70                 "echo '# FAILED !            #';" \
71                 "echo '# GPT RESTORATION     #';" \
72                 "gpt write mmc ${mmcdev} ${partitions};" \
73         "fi;" \
74         "echo '#######################';" \
75         "setenv loadaddr_swu_initramfs 0x14000000;" \
76         "setenv bootargs console=${console} " \
77                 "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
78                 ":${hostname}::off root=/dev/ram rw;" \
79         "sf probe;" \
80         "sf read ${loadaddr} swu-kernel;" \
81         "sf read ${loadaddr_swu_initramfs} swu-initramfs;" \
82         "bootm ${loadaddr} ${loadaddr_swu_initramfs};reset;"
83
84 #define SETUP_BOOTARGS \
85         "run set_rootfs_part;" \
86         "setenv bootargs ${bootargs} console=${console} "         \
87                       "root=/dev/mmcblk${mmcdev}p${rootfs_part} " \
88                       "rootwait rootfstype=ext4 rw; " \
89         "run set_kernel_part;" \
90         "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
91         "mmc read ${loadaddr} ${lba_start} ${fitImg_fw_sz}; " \
92         "setenv fdt_conf imx6q-${board}-${display}.dtb; "
93
94 /* All the numbers are in LBAs */
95 #define __TFTP_UPDATE_KERNEL \
96         "tftp_mmc_fitImg=" \
97            "if test ! -n ${kernel_part}; then " \
98                "setenv kernel_part ${kernel_part_active};" \
99            "fi;" \
100            "if tftp ${loadaddr} ${kernel_file}; then " \
101                "setexpr fw_sz ${filesize} / 0x200; " \
102                "setexpr fw_sz ${fw_sz} + 1; "  \
103                "part start mmc ${mmcdev} ${kernel_part} lba_start; " \
104                "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
105            "; fi\0" \
106
107 #define TFTP_UPDATE_KERNEL \
108         "setenv kernel_part ${kernel_part_active};" \
109         "run tftp_mmc_fitImg;" \
110         "setenv kernel_part ${kernel_part_backup};" \
111         "run tftp_mmc_fitImg;" \
112
113 #define __TFTP_UPDATE_ROOTFS \
114         "tftp_mmc_rootfs=" \
115            "if test ! -n ${rootfs_part}; then " \
116                "setenv rootfs_part ${rootfs_part_active};" \
117            "fi;" \
118            "if tftp ${loadaddr} ${rootfs_file}; then " \
119                "setexpr fw_sz ${filesize} / 0x200; " \
120                "setexpr fw_sz ${fw_sz} + 1; "  \
121                "part start mmc ${mmcdev} ${rootfs_part} lba_start; " \
122                "mmc write ${loadaddr} ${lba_start} ${fw_sz}; " \
123            "; fi\0" \
124
125 #define TFTP_UPDATE_ROOTFS \
126         "setenv rootfs_part ${rootfs_part_active};" \
127         "run tftp_mmc_rootfs;" \
128         "run tftp_mmc_rootfs_bkp;" \
129
130
131 #define TFTP_UPDATE_RECOVERY_SWU_KERNEL \
132         "tftp_sf_fitImg_SWU=" \
133             "if tftp ${loadaddr} ${kernel_file}; then " \
134                 "sf probe;" \
135                 "sf erase swu-kernel +${filesize};" \
136                 "sf write ${loadaddr} swu-kernel ${filesize};" \
137         "; fi\0"          \
138
139 #define TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
140         "swu_initramfs_file=swupdate-image-display5.ext4.gz.u-boot\0" \
141         "tftp_sf_initramfs_SWU=" \
142             "if tftp ${loadaddr} ${swu_initramfs_file}; then " \
143                 "sf probe;" \
144                 "sf erase swu-initramfs +${filesize};" \
145                 "sf write ${loadaddr} swu-initramfs ${filesize};" \
146         "; fi\0"          \
147
148 #define TFTP_UPDATE_BOOTLOADER \
149         "ubootfile=u-boot.img\0" \
150         "ubootfileSPL=SPL\0" \
151         "tftp_sf_uboot=" \
152             "if tftp ${loadaddr} ${ubootfile}; then " \
153                 "sf probe;" \
154                 "sf erase u-boot +${filesize};" \
155                 "sf write ${loadaddr} u-boot ${filesize}" \
156         "; fi\0"          \
157         "tftp_sf_SPL="    \
158             "if tftp ${loadaddr} ${ubootfileSPL}; then " \
159                 "sf probe;" \
160                 "setexpr uboot_SPL_size ${filesize} + 0x400;" \
161                 "sf erase 0x0 +${uboot_SPL_size};" \
162                 "sf write ${loadaddr} 0x400 ${filesize};" \
163         "fi\0" \
164
165 #define TFTP_UPDATE_SPINOR \
166         "spinorfile=core-image-lwn-display5.spinor\0" \
167         "spinorsize=0x2000000\0" \
168         "tftp_sf_img=" \
169             "if tftp ${loadaddr} ${spinorfile}; then " \
170                 "sf probe;" \
171                 "sf erase 0x0 ${spinorsize};" \
172                 "sf write ${loadaddr} 0x0 ${filesize};" \
173         "fi\0" \
174
175 #define CONFIG_EXTRA_ENV_SETTINGS         \
176         PARTS_DEFAULT \
177         "gpio_recovery=93\0" \
178         "check_em_pad=gpio input ${gpio_recovery};test $? -eq 0;\0" \
179         "display=tianma-tm070-800x480\0" \
180         "board=display5\0" \
181         "mmcdev=0\0" \
182         "altbootcmd=run recovery\0" \
183         "bootdelay=1\0" \
184         "baudrate=115200\0" \
185         "ethact=FEC\0" \
186         "netdev=eth0\0" \
187         "boot_os=y\0" \
188         "hostname=display5\0" \
189         "loadaddr=0x12000000\0" \
190         "fdtaddr=0x12800000\0" \
191         "console=ttymxc4,115200 quiet cma=256M\0" \
192         "fdtfile=imx6q-display5.dtb\0" \
193         "fdt_high=0xffffffff\0" \
194         "initrd_high=0xffffffff\0" \
195         "kernel_file=fitImage\0" \
196         "fitImg_fw_sz=0x2200\0" \
197         "up=run tftp_sf_SPL; run tftp_sf_uboot\0" \
198         "download_kernel=" \
199                 "tftpboot ${loadaddr} ${kernel_file};\0" \
200         "factory_nfs=" \
201              "setenv ipaddr 192.168.1.102;" \
202              "setenv gatewayip 192.168.1.1;" \
203              "setenv netmask 255.255.255.0;" \
204              "setenv serverip 192.168.1.2;" \
205              "echo BOOT: FACTORY (LEG);" \
206              "run boot_nfs\0" \
207         "boot_swu_recovery=" SWUPDATE_RECOVERY_PROCEDURE "\0" \
208         "recovery=" \
209              "echo BOOT: RECOVERY: SWU;" \
210              "run boot_swu_recovery\0" \
211         "boot_tftp=" \
212         "if run download_kernel; then "   \
213              "setenv bootargs console=${console} " \
214              "root=/dev/mmcblk0p2 rootwait;" \
215              "bootm ${loadaddr} - ${fdtaddr};reset;" \
216         "fi\0" \
217         "addip=setenv bootargs ${bootargs} " \
218         "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:" \
219             "${hostname}:eth0:on"         \
220         "\0"      \
221         "nfsargs=setenv bootargs " \
222         "root=/dev/nfs rw "       \
223         "nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" \
224         "\0" \
225         "rootpath=/srv/tftp/DISP5/rootfs\0" \
226         "boot_nfs=" \
227         "if run download_kernel; then "   \
228              "run nfsargs;"       \
229              "run addip;"         \
230              "setenv bootargs ${bootargs} console=${console};"    \
231              "setenv fdt_conf imx6q-${board}-${display}.dtb; " \
232              "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
233         "fi\0" \
234         "falcon_setup=" \
235         "if mmc dev ${mmcdev}; then "     \
236              SETUP_BOOTARGS \
237              "spl export fdt ${loadaddr}#conf@${fdt_conf};" \
238              "setexpr fw_sz ${fdtargslen} / 0x200; " \
239              "setexpr fw_sz ${fw_sz} + 1; "  \
240              "mmc write ${fdtargsaddr} " \
241              __stringify(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)" ${fw_sz}; " \
242         "fi\0" \
243         "boot_mmc=" \
244         "if mmc dev ${mmcdev}; then "     \
245              SETUP_BOOTARGS \
246              "bootm ${loadaddr}#conf@${fdt_conf};reset;" \
247         "fi\0" \
248         "set_kernel_part=" \
249         "if test ${BOOT_FROM} = ACTIVE; then " \
250              "setenv kernel_part ${kernel_part_active};" \
251              "echo BOOT: ACTIVE;" \
252         "else if test ${BOOT_FROM} = BACKUP; then " \
253              "setenv kernel_part ${kernel_part_backup};" \
254              "echo BOOT: BACKUP;" \
255         "else " \
256              "run recovery;" \
257         "fi;fi\0" \
258         "set_rootfs_part=" \
259         "if test ${BOOT_FROM} = ACTIVE; then " \
260              "setenv rootfs_part ${rootfs_part_active};" \
261         "else if test ${BOOT_FROM} = BACKUP; then " \
262              "setenv rootfs_part ${rootfs_part_backup};" \
263         "else " \
264              "run recovery;" \
265         "fi;fi\0" \
266         "BOOT_FROM=ACTIVE\0" \
267         TFTP_UPDATE_BOOTLOADER \
268         TFTP_UPDATE_SPINOR \
269         "kernel_part_active=1\0" \
270         "kernel_part_backup=3\0" \
271         __TFTP_UPDATE_KERNEL \
272         "rootfs_part_active=2\0" \
273         "rootfs_part_backup=4\0" \
274         "rootfs_file=core-image-lwn-display5.ext4\0" \
275         "rootfs_file_backup=core-image-lwn-backup-display5.ext4\0" \
276         __TFTP_UPDATE_ROOTFS \
277         "tftp_mmc_rootfs_bkp=" \
278            "setenv rootfs_part ${rootfs_part_backup};" \
279            "setenv rootfs_file ${rootfs_file_backup};" \
280            "run tftp_mmc_rootfs\0" \
281         TFTP_UPDATE_RECOVERY_SWU_KERNEL \
282         TFTP_UPDATE_RECOVERY_SWU_INITRAMFS \
283         "\0" \
284
285 /* Miscellaneous configurable options */
286
287 #define CONFIG_STANDALONE_LOAD_ADDR     0x10001000
288
289 /* Physical Memory Map */
290 #define PHYS_SDRAM                      MMDC0_ARB_BASE_ADDR
291 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
292
293 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
294 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
295
296 /* ENV config */
297 #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
298 /* The 0x120000 value corresponds to above SPI-NOR memory MAP */
299 #endif
300
301 #define CONFIG_MXC_USB_PORTSC           (PORT_PTS_UTMI | PORT_PTS_PTW)
302 #endif /* __CONFIG_H */