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 /* Enable PREBOOT variable */
37 /* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
38 #define BK4_NET_INIT "run set_gpio122;"
40 /* Check if userdata volume shall be erased */
41 #define MANAGE_USERDATA "if ${eraseuserdata}; " \
42 "then ubi part system; " \
43 "ubi remove userdata; " \
44 "ubi create userdata; " \
46 "setenv eraseuserdata false; " \
50 #include <asm/arch/imx-regs.h>
51 #include <linux/sizes.h>
54 #define CONFIG_SYS_MAX_NAND_DEVICE 1
56 #define IMX_FEC1_BASE ENET1_BASE_ADDR
59 #ifdef CONFIG_FSL_QSPI
60 #define FSL_QSPI_FLASH_SIZE (SZ_16M)
61 #define FSL_QSPI_FLASH_NUM 2
62 #define CONFIG_SYS_FSL_QSPI_LE
65 /* boot command, including the target-defined one if any */
67 /* Extra env settings (including the target-defined ones if any) */
68 #define CONFIG_EXTRA_ENV_SETTINGS \
69 BK4_EXTRA_ENV_SETTINGS \
71 "fdt_high=0xffffffff\0" \
72 "initrd_high=0xffffffff\0" \
73 "blimg_file=u-boot.vyb\0" \
74 "blimg_addr=0x81000000\0" \
75 "dtbkernel_file=fitImage\0" \
76 "dtbkernel_addr=0x82000000\0" \
77 "ram_file=uRamdisk\0" \
78 "ram_addr=0x83000000\0" \
79 "filesys=rootfs.ubifs\0" \
80 "sys_addr=0x81000000\0" \
81 "nfs_root=/path/to/nfs/root\0" \
82 "tftptimeout=1000\0" \
83 "tftptimeoutcountmax=1000000\0" \
84 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
85 "ipaddr=192.168.0.60\0" \
86 "serverip=192.168.0.1\0" \
87 "bootargs_base=setenv bootargs rw " \
88 "console=ttyLP1,115200n8\0" \
89 "bootargs_sd=setenv bootargs ${bootargs} " \
90 "root=/dev/mmcblk0p2 rootwait\0" \
91 "bootargs_nand=setenv bootargs ${bootargs} " \
92 "ubi.mtd=5 rootfstype=" \
93 "ubifs root=ubi0:rootfs${active_workset}\0" \
94 "bootargs_ram=setenv bootargs ${bootargs} " \
95 "root=/dev/ram rw initrd=${ram_addr}\0" \
96 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
97 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
98 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
99 "bootm ${dtbkernel_addr}\0" \
100 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
101 "ubi part dtbkernel; " \
102 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
104 "bootm ${dtbkernel_addr}\0" \
105 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
106 "nand read ${fdt_addr} dtb; " \
107 "nand read ${kernel_addr} kernel; " \
108 "nand read ${ram_addr} root; " \
109 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
110 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
113 "mtdparts default; " \
114 "nand erase.part bootloader; " \
115 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
116 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
117 "${tftpdir}${blimg_file}; "\
119 "mtdparts default; " \
120 "nand erase.part bootloader; " \
121 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
122 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
123 "${dtbkernel_file}; " \
125 "ubi part dtbkernel; " \
126 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
129 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
130 "${tftpdir}${dtbkernel_file}; " \
132 "ubi part dtbkernel; " \
133 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
136 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
139 "mtdparts default; " \
140 "nand erase.part initrd; " \
141 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
142 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
144 "nand erase.part initrd; " \
145 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
146 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
149 "ubi part system; " \
150 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
152 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
154 "ubi part system; " \
155 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
157 "setup_dtbkernel=nand erase.part dtbkernel; " \
158 "ubi part dtbkernel; " \
159 "ubi create dtbkernel1 972000 s; " \
160 "ubi create dtbkernel2 972000 s; " \
162 "setup_system=nand erase.part system; " \
163 "ubi part system; " \
164 "ubi create rootfs1 15E15000 d; " \
165 "ubi create rootfs2 15E15000 d; " \
166 "ubi create userdata; " \
168 "setup_nor1=" BK4_NET_INIT \
169 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
170 "then sf probe 0:0; " \
171 "sf erase 0 01000000; " \
172 "mtdparts default; " \
174 "ubi create nor1fs; " \
175 "ubi write ${sys_addr} nor1fs ${filesize}; " \
177 "setup_nor2=" BK4_NET_INIT \
178 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
179 "then sf probe 0:1; " \
180 "sf erase 0 01000000; " \
181 "mtdparts default; " \
183 "ubi create nor2fs; " \
184 "ubi write ${sys_addr} nor2fs ${filesize}; " \
186 "prepare_install_bk4r1_envs=" \
187 "echo 'Preparing envs for SD card recovery!';" \
188 "setenv ipaddr 192.168.0.99;" \
189 "setenv serverip 192.168.0.50;" \
193 "nand erase.chip; mtdparts default; "\
195 "run setup_dtbkernel; " \
196 "run setup_system; " \
198 "run update_bootloader_from_sd; "\
199 "run update_dtbkernel_from_sd; "\
200 "run update_rootfs_from_sd; "\
201 "setenv bootcmd 'run bootcmd_nand'; "\
204 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
208 /* Physical memory map */
209 #define PHYS_SDRAM (0x80000000)
210 #define PHYS_SDRAM_SIZE (SZ_512M)
212 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
213 #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
214 #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
216 #define CONFIG_SYS_INIT_SP_OFFSET \
217 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
218 #define CONFIG_SYS_INIT_SP_ADDR \
219 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
221 #endif /* __CONFIG_H */