1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
6 * Copyright 2016 3ADEV <http://3adev.com>
7 * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
9 * Configuration settings for BK4R1.
15 /* Define the BK4r1-specific env commands */
16 #define BK4_EXTRA_ENV_SETTINGS \
18 "eraseuserdata=false\0" \
19 "altbootcmd=led 5 on; " \
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"\
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"
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; "
39 /* Enable PREBOOT variable */
40 #define CONFIG_PREBOOT
42 /* Set ARP_TIMEOUT to 500ms */
43 #define CONFIG_ARP_TIMEOUT 500UL
45 /* Set ARP_TIMEOUT_COUNT to 3 repetitions */
46 #define CONFIG_NET_RETRY_COUNT 5
48 /* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
49 #define BK4_NET_INIT "run set_gpio122;"
51 /* Check if userdata volume shall be erased */
52 #define MANAGE_USERDATA "if ${eraseuserdata}; " \
53 "then ubi part system; " \
54 "ubi remove userdata; " \
55 "ubi create userdata; " \
57 "setenv eraseuserdata false; " \
61 /* Autoboot options */
62 #define CONFIG_AUTOBOOT_KEYED
63 #define CONFIG_AUTOBOOT_PROMPT \
64 "Enter passphrase to stop autoboot, booting in %d seconds\n"
65 #define CONFIG_AUTOBOOT_STOP_STR "123"
67 #include <asm/arch/imx-regs.h>
68 #include <linux/sizes.h>
70 #define CONFIG_SKIP_LOWLEVEL_INIT
72 /* Enable passing of ATAGs */
73 #define CONFIG_CMDLINE_TAG
75 /* Size of malloc() pool */
76 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 4 * SZ_1M)
78 /* Allow to overwrite serial and ethaddr */
79 #define CONFIG_ENV_OVERWRITE
82 #define CONFIG_SYS_NAND_ONFI_DETECTION
83 #define CONFIG_SYS_MAX_NAND_DEVICE 1
85 #define IMX_FEC1_BASE ENET1_BASE_ADDR
88 #ifdef CONFIG_FSL_QSPI
89 #define FSL_QSPI_FLASH_SIZE (SZ_16M)
90 #define FSL_QSPI_FLASH_NUM 2
91 #define CONFIG_SYS_FSL_QSPI_LE
94 #define CONFIG_LOADADDR 0x82000000
96 /* We boot from the gfxRAM area of the OCRAM. */
97 #define CONFIG_BOARD_SIZE_LIMIT 520192
99 /* boot command, including the target-defined one if any */
100 #define CONFIG_BOOTCOMMAND BK4_BOOTCOMMAND "run bootcmd_nand"
102 /* Extra env settings (including the target-defined ones if any) */
103 #define CONFIG_EXTRA_ENV_SETTINGS \
104 BK4_EXTRA_ENV_SETTINGS \
106 "fdt_high=0xffffffff\0" \
107 "initrd_high=0xffffffff\0" \
108 "blimg_file=u-boot.vyb\0" \
109 "blimg_addr=0x81000000\0" \
110 "dtbkernel_file=fitImage\0" \
111 "dtbkernel_addr=0x82000000\0" \
112 "ram_file=uRamdisk\0" \
113 "ram_addr=0x83000000\0" \
114 "filesys=rootfs.ubifs\0" \
115 "sys_addr=0x81000000\0" \
116 "nfs_root=/path/to/nfs/root\0" \
117 "tftptimeout=1000\0" \
118 "tftptimeoutcountmax=1000000\0" \
119 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
120 "ipaddr=192.168.0.60\0" \
121 "serverip=192.168.0.1\0" \
122 "bootargs_base=setenv bootargs rw " \
123 "console=ttyLP1,115200n8\0" \
124 "bootargs_sd=setenv bootargs ${bootargs} " \
125 "root=/dev/mmcblk0p2 rootwait\0" \
126 "bootargs_nand=setenv bootargs ${bootargs} " \
127 "ubi.mtd=5 rootfstype=" \
128 "ubifs root=ubi0:rootfs${active_workset}\0" \
129 "bootargs_ram=setenv bootargs ${bootargs} " \
130 "root=/dev/ram rw initrd=${ram_addr}\0" \
131 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
132 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
133 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
134 "bootm ${dtbkernel_addr}\0" \
135 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
136 "ubi part dtbkernel; " \
137 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
139 "bootm ${dtbkernel_addr}\0" \
140 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
141 "nand read ${fdt_addr} dtb; " \
142 "nand read ${kernel_addr} kernel; " \
143 "nand read ${ram_addr} root; " \
144 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
145 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
148 "mtdparts default; " \
149 "nand erase.part bootloader; " \
150 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
151 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
152 "${tftpdir}${blimg_file}; "\
154 "mtdparts default; " \
155 "nand erase.part bootloader; " \
156 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
157 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
158 "${dtbkernel_file}; " \
160 "ubi part dtbkernel; " \
161 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
164 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
165 "${tftpdir}${dtbkernel_file}; " \
167 "ubi part dtbkernel; " \
168 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
171 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
174 "mtdparts default; " \
175 "nand erase.part initrd; " \
176 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
177 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
179 "nand erase.part initrd; " \
180 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
181 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
184 "ubi part system; " \
185 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
187 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
189 "ubi part system; " \
190 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
192 "setup_dtbkernel=nand erase.part dtbkernel; " \
193 "ubi part dtbkernel; " \
194 "ubi create dtbkernel1 972000 s; " \
195 "ubi create dtbkernel2 972000 s; " \
197 "setup_system=nand erase.part system; " \
198 "ubi part system; " \
199 "ubi create rootfs1 15E15000 d; " \
200 "ubi create rootfs2 15E15000 d; " \
201 "ubi create userdata; " \
203 "setup_nor1=" BK4_NET_INIT \
204 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
205 "then sf probe 0:0; " \
206 "sf erase 0 01000000; " \
207 "mtdparts default; " \
209 "ubi create nor1fs; " \
210 "ubi write ${sys_addr} nor1fs ${filesize}; " \
212 "setup_nor2=" BK4_NET_INIT \
213 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
214 "then sf probe 0:1; " \
215 "sf erase 0 01000000; " \
216 "mtdparts default; " \
218 "ubi create nor2fs; " \
219 "ubi write ${sys_addr} nor2fs ${filesize}; " \
221 "prepare_install_bk4r1_envs=" \
222 "echo 'Preparing envs for SD card recovery!';" \
223 "setenv ipaddr 192.168.0.99;" \
224 "setenv serverip 192.168.0.50;" \
228 "nand erase.chip; mtdparts default; "\
230 "run setup_dtbkernel; " \
231 "run setup_system; " \
233 "run update_bootloader_from_sd; "\
234 "run update_dtbkernel_from_sd; "\
235 "run update_rootfs_from_sd; "\
236 "setenv bootcmd 'run bootcmd_nand'; "\
239 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
243 /* Miscellaneous configurable options */
245 #define CONFIG_SYS_MEMTEST_START 0x80010000
246 #define CONFIG_SYS_MEMTEST_END 0x87C00000
248 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
250 /* Physical memory map */
251 #define PHYS_SDRAM (0x80000000)
252 #define PHYS_SDRAM_SIZE (SZ_512M)
254 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
255 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
256 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
258 #define CONFIG_SYS_INIT_SP_OFFSET \
259 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
260 #define CONFIG_SYS_INIT_SP_ADDR \
261 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
263 #ifdef CONFIG_ENV_IS_IN_NAND
264 #define CONFIG_ENV_SECT_SIZE (SZ_128K)
265 #define CONFIG_ENV_SIZE (SZ_8K)
266 #define CONFIG_ENV_OFFSET 0x200000
267 #define CONFIG_ENV_SIZE_REDUND (SZ_8K)
268 #define CONFIG_ENV_OFFSET_REDUND 0x220000
271 #endif /* __CONFIG_H */