imx8m: config: convert to bootm_size
[platform/kernel/u-boot.git] / include / configs / bk4r1.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2018
4  * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
5  *
6  * Copyright 2016 3ADEV <http://3adev.com>
7  * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
8  *
9  * Configuration settings for BK4R1.
10  */
11
12 #ifndef __CONFIG_H
13 #define __CONFIG_H
14
15 /* Define the BK4r1-specific env commands */
16 #define BK4_EXTRA_ENV_SETTINGS \
17         "bootlimit=3\0" \
18         "eraseuserdata=false\0" \
19         "altbootcmd=led 5 on; " \
20                 "boot\0" \
21         "set_gpio103=mw 0x400ff0c4 0x0080; mw 0x4004819C 0x000011bf\0" \
22         "set_gpio102=mw 0x400ff0c4 0x40; mw 0x40048198 0x000011bf\0" \
23         "set_gpio96=mw 0x40048180 0x282; mw 0x400ff0c4 0x1\0"\
24         "set_gpio122=mw 0x400481e8 0x0282; mw 0x400ff0c4 0x04000000\0"\
25         "set_gpio6=mw 0x40048018 0x282; mw 0x400ff008 0x40\0"\
26         "manage_userdata=" MANAGE_USERDATA "\0"\
27         "ncenable=true\0"\
28         "ncserverip=192.168.0.77\0"\
29         "if_netconsole=ping $ncserverip\0"\
30         "start_netconsole=setenv ncip $serverip; setenv bootdelay 10;" \
31              "setenv stdin nc; setenv stdout nc; setenv stderr nc; version;\0" \
32         "preboot=" BK4_NET_INIT \
33                 "if ${ncenable}; then run if_netconsole start_netconsole; fi\0"
34
35 /* BK4r1 boot command sets GPIO103/PTC30 to force USB hub out of reset*/
36 #define BK4_BOOTCOMMAND "run set_gpio122; run set_gpio96; sf probe; " \
37                         "run manage_userdata; "
38
39 /* Enable PREBOOT variable */
40
41 /* Set ARP_TIMEOUT to 500ms */
42 #define CONFIG_ARP_TIMEOUT 500UL
43
44 /* Set ARP_TIMEOUT_COUNT to 3 repetitions */
45 #define CONFIG_NET_RETRY_COUNT  5
46
47 /* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
48 #define BK4_NET_INIT "run set_gpio122;"
49
50 /* Check if userdata volume shall be erased */
51 #define MANAGE_USERDATA "if ${eraseuserdata}; " \
52                                                 "then ubi part system; " \
53                                                 "ubi remove userdata; " \
54                                                 "ubi create userdata; " \
55                                                 "ubi detach; " \
56                                                 "setenv eraseuserdata false; " \
57                                                 "saveenv; " \
58                                                 "fi; "
59
60 #include <asm/arch/imx-regs.h>
61 #include <linux/sizes.h>
62
63 #define CONFIG_SKIP_LOWLEVEL_INIT
64
65 /* Enable passing of ATAGs */
66 #define CONFIG_CMDLINE_TAG
67
68 /* Size of malloc() pool */
69 #define CONFIG_SYS_MALLOC_LEN           (CONFIG_ENV_SIZE + 4 * SZ_1M)
70
71 /* NAND support */
72 #define CONFIG_SYS_NAND_ONFI_DETECTION
73 #define CONFIG_SYS_MAX_NAND_DEVICE 1
74
75 #define IMX_FEC1_BASE                   ENET1_BASE_ADDR
76
77 /* QSPI Configs*/
78 #ifdef CONFIG_FSL_QSPI
79 #define FSL_QSPI_FLASH_SIZE             (SZ_16M)
80 #define FSL_QSPI_FLASH_NUM              2
81 #define CONFIG_SYS_FSL_QSPI_LE
82 #endif
83
84 #define CONFIG_LOADADDR 0x82000000
85
86 /* We boot from the gfxRAM area of the OCRAM. */
87 #define CONFIG_BOARD_SIZE_LIMIT         520192
88
89 /* boot command, including the target-defined one if any */
90 #define CONFIG_BOOTCOMMAND      BK4_BOOTCOMMAND "run bootcmd_nand"
91
92 /* Extra env settings (including the target-defined ones if any) */
93 #define CONFIG_EXTRA_ENV_SETTINGS \
94         BK4_EXTRA_ENV_SETTINGS \
95         "autoload=no\0" \
96         "fdt_high=0xffffffff\0" \
97         "initrd_high=0xffffffff\0" \
98         "blimg_file=u-boot.vyb\0" \
99         "blimg_addr=0x81000000\0" \
100         "dtbkernel_file=fitImage\0" \
101         "dtbkernel_addr=0x82000000\0" \
102         "ram_file=uRamdisk\0" \
103         "ram_addr=0x83000000\0" \
104         "filesys=rootfs.ubifs\0" \
105         "sys_addr=0x81000000\0" \
106         "nfs_root=/path/to/nfs/root\0" \
107         "tftptimeout=1000\0" \
108         "tftptimeoutcountmax=1000000\0" \
109         "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
110         "ipaddr=192.168.0.60\0" \
111         "serverip=192.168.0.1\0" \
112         "bootargs_base=setenv bootargs rw " \
113         "console=ttyLP1,115200n8\0" \
114         "bootargs_sd=setenv bootargs ${bootargs} " \
115                 "root=/dev/mmcblk0p2 rootwait\0" \
116         "bootargs_nand=setenv bootargs ${bootargs} " \
117                 "ubi.mtd=5 rootfstype=" \
118                                 "ubifs root=ubi0:rootfs${active_workset}\0" \
119         "bootargs_ram=setenv bootargs ${bootargs} " \
120                 "root=/dev/ram rw initrd=${ram_addr}\0" \
121         "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
122         "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
123                 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
124                 "bootm ${dtbkernel_addr}\0" \
125         "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
126                 "ubi part dtbkernel; " \
127                 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
128                 "led 0 on; " \
129                 "bootm ${dtbkernel_addr}\0" \
130         "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
131                 "nand read ${fdt_addr} dtb; " \
132                 "nand read ${kernel_addr} kernel; " \
133                 "nand read ${ram_addr} root; " \
134                 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
135         "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
136                 "${blimg_file}; " \
137                 "then sf probe; " \
138                 "mtdparts default; " \
139                 "nand erase.part bootloader; " \
140                 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
141         "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
142                 "${tftpdir}${blimg_file}; "\
143                 "then sf probe; " \
144                 "mtdparts default; " \
145                 "nand erase.part bootloader; " \
146                 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
147         "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
148                 "${dtbkernel_file}; " \
149                 "then sf probe; " \
150                 "ubi part dtbkernel; " \
151                 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
152                 "${filesize}; " \
153                 "ubi detach; fi\0" \
154         "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
155                 "${tftpdir}${dtbkernel_file}; " \
156                 "then sf probe; " \
157                 "ubi part dtbkernel; " \
158                 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
159                 "${filesize}; " \
160                 "ubi detach; fi\0" \
161         "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
162                 "${ram_file}; " \
163                 "then sf probe; " \
164                 "mtdparts default; " \
165                 "nand erase.part initrd; " \
166                 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
167         "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
168                 "then sf probe; " \
169                 "nand erase.part initrd; " \
170                 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
171         "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
172                 "${filesys}; " \
173                 "then sf probe; " \
174                 "ubi part system; " \
175                 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
176                 "ubi detach; fi\0" \
177         "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
178                 "then sf probe; " \
179                 "ubi part system; " \
180                 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
181                 "ubi detach; fi\0" \
182         "setup_dtbkernel=nand erase.part dtbkernel; " \
183                 "ubi part dtbkernel; " \
184                 "ubi create dtbkernel1 972000 s; " \
185                 "ubi create dtbkernel2 972000 s; " \
186                 "ubi detach\0" \
187         "setup_system=nand erase.part system; " \
188                 "ubi part system; " \
189                 "ubi create rootfs1 15E15000 d; " \
190                 "ubi create rootfs2 15E15000 d; " \
191                 "ubi create userdata; " \
192                 "ubi detach\0" \
193         "setup_nor1=" BK4_NET_INIT \
194                 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
195                 "then sf probe 0:0; " \
196                 "sf erase 0 01000000; " \
197                 "mtdparts default; " \
198                 "ubi part nor; " \
199                 "ubi create nor1fs; " \
200                 "ubi write ${sys_addr} nor1fs ${filesize}; " \
201                 "ubi detach; fi\0" \
202         "setup_nor2=" BK4_NET_INIT \
203                 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
204                 "then sf probe 0:1; " \
205                 "sf erase 0 01000000; " \
206                 "mtdparts default; " \
207                 "ubi part nor; " \
208                 "ubi create nor2fs; " \
209                 "ubi write ${sys_addr} nor2fs ${filesize}; " \
210                 "ubi detach; fi\0" \
211         "prepare_install_bk4r1_envs=" \
212                 "echo 'Preparing envs for SD card recovery!';" \
213                 "setenv ipaddr 192.168.0.99;" \
214                 "setenv serverip 192.168.0.50;" \
215                 "\0" \
216         "install_bk4r1rs="\
217                 "led 0 on; " \
218                 "nand erase.chip; mtdparts default; "\
219                 "led 1 on; "\
220                 "run setup_dtbkernel; " \
221                 "run setup_system; " \
222                 "led 2 on;" \
223                 "run update_bootloader_from_sd; "\
224                 "run update_dtbkernel_from_sd; "\
225                 "run update_rootfs_from_sd; "\
226                 "setenv bootcmd 'run bootcmd_nand'; "\
227                 "saveenv; " \
228                 "led 3 on; " \
229                 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
230                         "source to NAND\0" \
231         "active_workset=1\0"
232
233 /* Miscellaneous configurable options */
234
235 #define CONFIG_SYS_LOAD_ADDR            CONFIG_LOADADDR
236
237 /* Physical memory map */
238 #define PHYS_SDRAM                      (0x80000000)
239 #define PHYS_SDRAM_SIZE         (SZ_512M)
240
241 #define CONFIG_SYS_SDRAM_BASE           PHYS_SDRAM
242 #define CONFIG_SYS_INIT_RAM_ADDR        IRAM_BASE_ADDR
243 #define CONFIG_SYS_INIT_RAM_SIZE        IRAM_SIZE
244
245 #define CONFIG_SYS_INIT_SP_OFFSET \
246         (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
247 #define CONFIG_SYS_INIT_SP_ADDR \
248         (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
249
250 #endif /* __CONFIG_H */