blob: 300b9c7b7afbf8ca6c72bc446a5b5db0fb6d9afa [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +02002/*
Lukasz Majewski8c6248c2019-02-13 22:46:52 +01003 * Copyright (C) 2018
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
5 *
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +02006 * Copyright 2016 3ADEV <http://3adev.com>
7 * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
8 *
Lukasz Majewski8c6248c2019-02-13 22:46:52 +01009 * Configuration settings for BK4R1.
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020010 */
11
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010012#ifndef __CONFIG_H
13#define __CONFIG_H
14
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020015/* Define the BK4r1-specific env commands */
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010016#define BK4_EXTRA_ENV_SETTINGS \
17 "bootlimit=3\0" \
18 "eraseuserdata=false\0" \
19 "altbootcmd=led 5 on; " \
20 "boot\0" \
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020021 "set_gpio103=mw 0x400ff0c4 0x0080; mw 0x4004819C 0x000011bf\0" \
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010022 "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"
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020034
35/* BK4r1 boot command sets GPIO103/PTC30 to force USB hub out of reset*/
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010036#define BK4_BOOTCOMMAND "run set_gpio122; run set_gpio96; sf probe; " \
37 "run manage_userdata; "
38
39/* Enable PREBOOT variable */
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010040
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
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020046
47/* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010048#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
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010060#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/* Allow to overwrite serial and ethaddr */
72#define CONFIG_ENV_OVERWRITE
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020073
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010074/* NAND support */
75#define CONFIG_SYS_NAND_ONFI_DETECTION
76#define CONFIG_SYS_MAX_NAND_DEVICE 1
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020077
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010078#define IMX_FEC1_BASE ENET1_BASE_ADDR
79
80/* QSPI Configs*/
81#ifdef CONFIG_FSL_QSPI
82#define FSL_QSPI_FLASH_SIZE (SZ_16M)
83#define FSL_QSPI_FLASH_NUM 2
84#define CONFIG_SYS_FSL_QSPI_LE
85#endif
86
87#define CONFIG_LOADADDR 0x82000000
88
89/* We boot from the gfxRAM area of the OCRAM. */
90#define CONFIG_BOARD_SIZE_LIMIT 520192
91
92/* boot command, including the target-defined one if any */
93#define CONFIG_BOOTCOMMAND BK4_BOOTCOMMAND "run bootcmd_nand"
94
95/* Extra env settings (including the target-defined ones if any) */
96#define CONFIG_EXTRA_ENV_SETTINGS \
97 BK4_EXTRA_ENV_SETTINGS \
98 "autoload=no\0" \
99 "fdt_high=0xffffffff\0" \
100 "initrd_high=0xffffffff\0" \
101 "blimg_file=u-boot.vyb\0" \
102 "blimg_addr=0x81000000\0" \
103 "dtbkernel_file=fitImage\0" \
104 "dtbkernel_addr=0x82000000\0" \
105 "ram_file=uRamdisk\0" \
106 "ram_addr=0x83000000\0" \
107 "filesys=rootfs.ubifs\0" \
108 "sys_addr=0x81000000\0" \
109 "nfs_root=/path/to/nfs/root\0" \
110 "tftptimeout=1000\0" \
111 "tftptimeoutcountmax=1000000\0" \
112 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
113 "ipaddr=192.168.0.60\0" \
114 "serverip=192.168.0.1\0" \
115 "bootargs_base=setenv bootargs rw " \
116 "console=ttyLP1,115200n8\0" \
117 "bootargs_sd=setenv bootargs ${bootargs} " \
118 "root=/dev/mmcblk0p2 rootwait\0" \
119 "bootargs_nand=setenv bootargs ${bootargs} " \
120 "ubi.mtd=5 rootfstype=" \
121 "ubifs root=ubi0:rootfs${active_workset}\0" \
122 "bootargs_ram=setenv bootargs ${bootargs} " \
123 "root=/dev/ram rw initrd=${ram_addr}\0" \
124 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
125 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
126 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
127 "bootm ${dtbkernel_addr}\0" \
128 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
129 "ubi part dtbkernel; " \
130 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
131 "led 0 on; " \
132 "bootm ${dtbkernel_addr}\0" \
133 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
134 "nand read ${fdt_addr} dtb; " \
135 "nand read ${kernel_addr} kernel; " \
136 "nand read ${ram_addr} root; " \
137 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
138 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
139 "${blimg_file}; " \
140 "then sf probe; " \
141 "mtdparts default; " \
142 "nand erase.part bootloader; " \
143 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
144 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
145 "${tftpdir}${blimg_file}; "\
146 "then sf probe; " \
147 "mtdparts default; " \
148 "nand erase.part bootloader; " \
149 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
150 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
151 "${dtbkernel_file}; " \
152 "then sf probe; " \
153 "ubi part dtbkernel; " \
154 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
155 "${filesize}; " \
156 "ubi detach; fi\0" \
157 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
158 "${tftpdir}${dtbkernel_file}; " \
159 "then sf probe; " \
160 "ubi part dtbkernel; " \
161 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
162 "${filesize}; " \
163 "ubi detach; fi\0" \
164 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
165 "${ram_file}; " \
166 "then sf probe; " \
167 "mtdparts default; " \
168 "nand erase.part initrd; " \
169 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
170 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
171 "then sf probe; " \
172 "nand erase.part initrd; " \
173 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
174 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
175 "${filesys}; " \
176 "then sf probe; " \
177 "ubi part system; " \
178 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
179 "ubi detach; fi\0" \
180 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
181 "then sf probe; " \
182 "ubi part system; " \
183 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
184 "ubi detach; fi\0" \
Lukasz Majewskiad3d7a72019-02-13 22:46:54 +0100185 "setup_dtbkernel=nand erase.part dtbkernel; " \
186 "ubi part dtbkernel; " \
187 "ubi create dtbkernel1 972000 s; " \
188 "ubi create dtbkernel2 972000 s; " \
189 "ubi detach\0" \
190 "setup_system=nand erase.part system; " \
191 "ubi part system; " \
192 "ubi create rootfs1 15E15000 d; " \
193 "ubi create rootfs2 15E15000 d; " \
194 "ubi create userdata; " \
195 "ubi detach\0" \
Lukasz Majewski9050cfc2019-02-13 22:46:55 +0100196 "setup_nor1=" BK4_NET_INIT \
197 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
198 "then sf probe 0:0; " \
199 "sf erase 0 01000000; " \
200 "mtdparts default; " \
201 "ubi part nor; " \
202 "ubi create nor1fs; " \
203 "ubi write ${sys_addr} nor1fs ${filesize}; " \
204 "ubi detach; fi\0" \
205 "setup_nor2=" BK4_NET_INIT \
206 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
207 "then sf probe 0:1; " \
208 "sf erase 0 01000000; " \
209 "mtdparts default; " \
210 "ubi part nor; " \
211 "ubi create nor2fs; " \
212 "ubi write ${sys_addr} nor2fs ${filesize}; " \
213 "ubi detach; fi\0" \
Lukasz Majewskiad3d7a72019-02-13 22:46:54 +0100214 "prepare_install_bk4r1_envs=" \
215 "echo 'Preparing envs for SD card recovery!';" \
216 "setenv ipaddr 192.168.0.99;" \
217 "setenv serverip 192.168.0.50;" \
218 "\0" \
219 "install_bk4r1rs="\
220 "led 0 on; " \
221 "nand erase.chip; mtdparts default; "\
222 "led 1 on; "\
223 "run setup_dtbkernel; " \
224 "run setup_system; " \
225 "led 2 on;" \
226 "run update_bootloader_from_sd; "\
227 "run update_dtbkernel_from_sd; "\
228 "run update_rootfs_from_sd; "\
229 "setenv bootcmd 'run bootcmd_nand'; "\
230 "saveenv; " \
231 "led 3 on; " \
232 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
233 "source to NAND\0" \
Lukasz Majewski8c6248c2019-02-13 22:46:52 +0100234 "active_workset=1\0"
235
236/* Miscellaneous configurable options */
237
Lukasz Majewski8c6248c2019-02-13 22:46:52 +0100238#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
239
240/* Physical memory map */
241#define PHYS_SDRAM (0x80000000)
242#define PHYS_SDRAM_SIZE (SZ_512M)
243
244#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
245#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
246#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
247
248#define CONFIG_SYS_INIT_SP_OFFSET \
249 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
250#define CONFIG_SYS_INIT_SP_ADDR \
251 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
252
Lukasz Majewski8c6248c2019-02-13 22:46:52 +0100253#endif /* __CONFIG_H */