blob: 05ebb7d9c5cf44a9bcc52275ca5221de6c42a6eb [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +02002/*
Lukasz Majewski6f854c62019-02-13 22:46:52 +01003 * Copyright (C) 2018
4 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
5 *
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +02006 * Copyright 2016 3ADEV <http://3adev.com>
7 * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
8 *
Lukasz Majewski6f854c62019-02-13 22:46:52 +01009 * Configuration settings for BK4R1.
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020010 */
11
Lukasz Majewski6f854c62019-02-13 22:46:52 +010012#ifndef __CONFIG_H
13#define __CONFIG_H
14
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020015/* Define the BK4r1-specific env commands */
Lukasz Majewski6f854c62019-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\)27192d12016-09-26 09:08:08 +020021 "set_gpio103=mw 0x400ff0c4 0x0080; mw 0x4004819C 0x000011bf\0" \
Lukasz Majewski6f854c62019-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\)27192d12016-09-26 09:08:08 +020034
35/* BK4r1 boot command sets GPIO103/PTC30 to force USB hub out of reset*/
Lukasz Majewski6f854c62019-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 */
40#define CONFIG_PREBOOT
41
42/* Set ARP_TIMEOUT to 500ms */
43#define CONFIG_ARP_TIMEOUT 500UL
44
45/* Set ARP_TIMEOUT_COUNT to 3 repetitions */
46#define CONFIG_NET_RETRY_COUNT 5
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020047
48/* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
Lukasz Majewski6f854c62019-02-13 22:46:52 +010049#define BK4_NET_INIT "run set_gpio122;"
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020050
Lukasz Majewski6f854c62019-02-13 22:46:52 +010051/* 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; " \
56 "ubi detach; " \
57 "setenv eraseuserdata false; " \
58 "saveenv; " \
59 "fi; "
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020060
Lukasz Majewski6f854c62019-02-13 22:46:52 +010061/* 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"
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020066
Lukasz Majewski6f854c62019-02-13 22:46:52 +010067#include <asm/arch/imx-regs.h>
68#include <linux/sizes.h>
69
70#define CONFIG_SKIP_LOWLEVEL_INIT
71
72/* Enable passing of ATAGs */
73#define CONFIG_CMDLINE_TAG
74
75/* Size of malloc() pool */
76#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 4 * SZ_1M)
77
78/* Allow to overwrite serial and ethaddr */
79#define CONFIG_ENV_OVERWRITE
80
81/* NAND support */
82#define CONFIG_SYS_NAND_ONFI_DETECTION
83#define CONFIG_SYS_MAX_NAND_DEVICE 1
84
85#define IMX_FEC1_BASE ENET1_BASE_ADDR
86
87/* QSPI Configs*/
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
92#endif
93
94#define CONFIG_LOADADDR 0x82000000
95
96/* We boot from the gfxRAM area of the OCRAM. */
97#define CONFIG_BOARD_SIZE_LIMIT 520192
98
99/* boot command, including the target-defined one if any */
100#define CONFIG_BOOTCOMMAND BK4_BOOTCOMMAND "run bootcmd_nand"
101
102/* Extra env settings (including the target-defined ones if any) */
103#define CONFIG_EXTRA_ENV_SETTINGS \
104 BK4_EXTRA_ENV_SETTINGS \
105 "autoload=no\0" \
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}; " \
138 "led 0 on; " \
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} " \
146 "${blimg_file}; " \
147 "then sf probe; " \
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}; "\
153 "then sf probe; " \
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}; " \
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_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
165 "${tftpdir}${dtbkernel_file}; " \
166 "then sf probe; " \
167 "ubi part dtbkernel; " \
168 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
169 "${filesize}; " \
170 "ubi detach; fi\0" \
171 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
172 "${ram_file}; " \
173 "then sf probe; " \
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}; " \
178 "then sf probe; " \
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} " \
182 "${filesys}; " \
183 "then sf probe; " \
184 "ubi part system; " \
185 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
186 "ubi detach; fi\0" \
187 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
188 "then sf probe; " \
189 "ubi part system; " \
190 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
191 "ubi detach; fi\0" \
Lukasz Majewski32c160e2019-02-13 22:46:54 +0100192 "setup_dtbkernel=nand erase.part dtbkernel; " \
193 "ubi part dtbkernel; " \
194 "ubi create dtbkernel1 972000 s; " \
195 "ubi create dtbkernel2 972000 s; " \
196 "ubi detach\0" \
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; " \
202 "ubi detach\0" \
Lukasz Majewskib3d28ac2019-02-13 22:46:55 +0100203 "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; " \
208 "ubi part nor; " \
209 "ubi create nor1fs; " \
210 "ubi write ${sys_addr} nor1fs ${filesize}; " \
211 "ubi detach; fi\0" \
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; " \
217 "ubi part nor; " \
218 "ubi create nor2fs; " \
219 "ubi write ${sys_addr} nor2fs ${filesize}; " \
220 "ubi detach; fi\0" \
Lukasz Majewski32c160e2019-02-13 22:46:54 +0100221 "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;" \
225 "\0" \
226 "install_bk4r1rs="\
227 "led 0 on; " \
228 "nand erase.chip; mtdparts default; "\
229 "led 1 on; "\
230 "run setup_dtbkernel; " \
231 "run setup_system; " \
232 "led 2 on;" \
233 "run update_bootloader_from_sd; "\
234 "run update_dtbkernel_from_sd; "\
235 "run update_rootfs_from_sd; "\
236 "setenv bootcmd 'run bootcmd_nand'; "\
237 "saveenv; " \
238 "led 3 on; " \
239 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
240 "source to NAND\0" \
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100241 "active_workset=1\0"
242
243/* Miscellaneous configurable options */
244
245#define CONFIG_SYS_MEMTEST_START 0x80010000
246#define CONFIG_SYS_MEMTEST_END 0x87C00000
247
248#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
249
250/* Physical memory map */
251#define PHYS_SDRAM (0x80000000)
252#define PHYS_SDRAM_SIZE (SZ_512M)
253
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
257
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)
262
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
269#endif
270
271#endif /* __CONFIG_H */