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 */
41 /* Set ARP_TIMEOUT to 500ms */
42 #define CONFIG_ARP_TIMEOUT 500UL
44 /* Set ARP_TIMEOUT_COUNT to 3 repetitions */
45 #define CONFIG_NET_RETRY_COUNT 5
47 /* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
48 #define BK4_NET_INIT "run set_gpio122;"
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; " \
56 "setenv eraseuserdata false; " \
60 /* Autoboot options */
61 #define CONFIG_AUTOBOOT_KEYED
62 #define CONFIG_AUTOBOOT_PROMPT \
63 "Enter passphrase to stop autoboot, booting in %d seconds\n"
64 #define CONFIG_AUTOBOOT_STOP_STR "123"
66 #include <asm/arch/imx-regs.h>
67 #include <linux/sizes.h>
69 #define CONFIG_SKIP_LOWLEVEL_INIT
71 /* Enable passing of ATAGs */
72 #define CONFIG_CMDLINE_TAG
74 /* Size of malloc() pool */
75 #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 4 * SZ_1M)
77 /* Allow to overwrite serial and ethaddr */
78 #define CONFIG_ENV_OVERWRITE
81 #define CONFIG_SYS_NAND_ONFI_DETECTION
82 #define CONFIG_SYS_MAX_NAND_DEVICE 1
84 #define IMX_FEC1_BASE ENET1_BASE_ADDR
87 #ifdef CONFIG_FSL_QSPI
88 #define FSL_QSPI_FLASH_SIZE (SZ_16M)
89 #define FSL_QSPI_FLASH_NUM 2
90 #define CONFIG_SYS_FSL_QSPI_LE
93 #define CONFIG_LOADADDR 0x82000000
95 /* We boot from the gfxRAM area of the OCRAM. */
96 #define CONFIG_BOARD_SIZE_LIMIT 520192
98 /* boot command, including the target-defined one if any */
99 #define CONFIG_BOOTCOMMAND BK4_BOOTCOMMAND "run bootcmd_nand"
101 /* Extra env settings (including the target-defined ones if any) */
102 #define CONFIG_EXTRA_ENV_SETTINGS \
103 BK4_EXTRA_ENV_SETTINGS \
105 "fdt_high=0xffffffff\0" \
106 "initrd_high=0xffffffff\0" \
107 "blimg_file=u-boot.vyb\0" \
108 "blimg_addr=0x81000000\0" \
109 "dtbkernel_file=fitImage\0" \
110 "dtbkernel_addr=0x82000000\0" \
111 "ram_file=uRamdisk\0" \
112 "ram_addr=0x83000000\0" \
113 "filesys=rootfs.ubifs\0" \
114 "sys_addr=0x81000000\0" \
115 "nfs_root=/path/to/nfs/root\0" \
116 "tftptimeout=1000\0" \
117 "tftptimeoutcountmax=1000000\0" \
118 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
119 "ipaddr=192.168.0.60\0" \
120 "serverip=192.168.0.1\0" \
121 "bootargs_base=setenv bootargs rw " \
122 "console=ttyLP1,115200n8\0" \
123 "bootargs_sd=setenv bootargs ${bootargs} " \
124 "root=/dev/mmcblk0p2 rootwait\0" \
125 "bootargs_nand=setenv bootargs ${bootargs} " \
126 "ubi.mtd=5 rootfstype=" \
127 "ubifs root=ubi0:rootfs${active_workset}\0" \
128 "bootargs_ram=setenv bootargs ${bootargs} " \
129 "root=/dev/ram rw initrd=${ram_addr}\0" \
130 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
131 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
132 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
133 "bootm ${dtbkernel_addr}\0" \
134 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
135 "ubi part dtbkernel; " \
136 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
138 "bootm ${dtbkernel_addr}\0" \
139 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
140 "nand read ${fdt_addr} dtb; " \
141 "nand read ${kernel_addr} kernel; " \
142 "nand read ${ram_addr} root; " \
143 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
144 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
147 "mtdparts default; " \
148 "nand erase.part bootloader; " \
149 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
150 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
151 "${tftpdir}${blimg_file}; "\
153 "mtdparts default; " \
154 "nand erase.part bootloader; " \
155 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
156 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
157 "${dtbkernel_file}; " \
159 "ubi part dtbkernel; " \
160 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
163 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
164 "${tftpdir}${dtbkernel_file}; " \
166 "ubi part dtbkernel; " \
167 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
170 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
173 "mtdparts default; " \
174 "nand erase.part initrd; " \
175 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
176 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
178 "nand erase.part initrd; " \
179 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
180 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
183 "ubi part system; " \
184 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
186 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
188 "ubi part system; " \
189 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
191 "setup_dtbkernel=nand erase.part dtbkernel; " \
192 "ubi part dtbkernel; " \
193 "ubi create dtbkernel1 972000 s; " \
194 "ubi create dtbkernel2 972000 s; " \
196 "setup_system=nand erase.part system; " \
197 "ubi part system; " \
198 "ubi create rootfs1 15E15000 d; " \
199 "ubi create rootfs2 15E15000 d; " \
200 "ubi create userdata; " \
202 "setup_nor1=" BK4_NET_INIT \
203 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
204 "then sf probe 0:0; " \
205 "sf erase 0 01000000; " \
206 "mtdparts default; " \
208 "ubi create nor1fs; " \
209 "ubi write ${sys_addr} nor1fs ${filesize}; " \
211 "setup_nor2=" BK4_NET_INIT \
212 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
213 "then sf probe 0:1; " \
214 "sf erase 0 01000000; " \
215 "mtdparts default; " \
217 "ubi create nor2fs; " \
218 "ubi write ${sys_addr} nor2fs ${filesize}; " \
220 "prepare_install_bk4r1_envs=" \
221 "echo 'Preparing envs for SD card recovery!';" \
222 "setenv ipaddr 192.168.0.99;" \
223 "setenv serverip 192.168.0.50;" \
227 "nand erase.chip; mtdparts default; "\
229 "run setup_dtbkernel; " \
230 "run setup_system; " \
232 "run update_bootloader_from_sd; "\
233 "run update_dtbkernel_from_sd; "\
234 "run update_rootfs_from_sd; "\
235 "setenv bootcmd 'run bootcmd_nand'; "\
238 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
242 /* Miscellaneous configurable options */
244 #define CONFIG_SYS_MEMTEST_START 0x80010000
245 #define CONFIG_SYS_MEMTEST_END 0x87C00000
247 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
249 /* Physical memory map */
250 #define PHYS_SDRAM (0x80000000)
251 #define PHYS_SDRAM_SIZE (SZ_512M)
253 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
254 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
255 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
257 #define CONFIG_SYS_INIT_SP_OFFSET \
258 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
259 #define CONFIG_SYS_INIT_SP_ADDR \
260 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
262 #endif /* __CONFIG_H */