blob: 921f30612e64421cf0e5dcfdda931eb66b7c1a1c [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
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010063/* Enable passing of ATAGs */
64#define CONFIG_CMDLINE_TAG
65
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010066/* NAND support */
67#define CONFIG_SYS_NAND_ONFI_DETECTION
68#define CONFIG_SYS_MAX_NAND_DEVICE 1
Albert ARIBAUD \(3ADEV\)ddef3b62016-09-26 09:08:08 +020069
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010070#define IMX_FEC1_BASE ENET1_BASE_ADDR
71
72/* QSPI Configs*/
73#ifdef CONFIG_FSL_QSPI
74#define FSL_QSPI_FLASH_SIZE (SZ_16M)
75#define FSL_QSPI_FLASH_NUM 2
76#define CONFIG_SYS_FSL_QSPI_LE
77#endif
Lukasz Majewski8c6248c2019-02-13 22:46:52 +010078
79/* We boot from the gfxRAM area of the OCRAM. */
80#define CONFIG_BOARD_SIZE_LIMIT 520192
81
82/* boot command, including the target-defined one if any */
83#define CONFIG_BOOTCOMMAND BK4_BOOTCOMMAND "run bootcmd_nand"
84
85/* Extra env settings (including the target-defined ones if any) */
86#define CONFIG_EXTRA_ENV_SETTINGS \
87 BK4_EXTRA_ENV_SETTINGS \
88 "autoload=no\0" \
89 "fdt_high=0xffffffff\0" \
90 "initrd_high=0xffffffff\0" \
91 "blimg_file=u-boot.vyb\0" \
92 "blimg_addr=0x81000000\0" \
93 "dtbkernel_file=fitImage\0" \
94 "dtbkernel_addr=0x82000000\0" \
95 "ram_file=uRamdisk\0" \
96 "ram_addr=0x83000000\0" \
97 "filesys=rootfs.ubifs\0" \
98 "sys_addr=0x81000000\0" \
99 "nfs_root=/path/to/nfs/root\0" \
100 "tftptimeout=1000\0" \
101 "tftptimeoutcountmax=1000000\0" \
102 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
103 "ipaddr=192.168.0.60\0" \
104 "serverip=192.168.0.1\0" \
105 "bootargs_base=setenv bootargs rw " \
106 "console=ttyLP1,115200n8\0" \
107 "bootargs_sd=setenv bootargs ${bootargs} " \
108 "root=/dev/mmcblk0p2 rootwait\0" \
109 "bootargs_nand=setenv bootargs ${bootargs} " \
110 "ubi.mtd=5 rootfstype=" \
111 "ubifs root=ubi0:rootfs${active_workset}\0" \
112 "bootargs_ram=setenv bootargs ${bootargs} " \
113 "root=/dev/ram rw initrd=${ram_addr}\0" \
114 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
115 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
116 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
117 "bootm ${dtbkernel_addr}\0" \
118 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
119 "ubi part dtbkernel; " \
120 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
121 "led 0 on; " \
122 "bootm ${dtbkernel_addr}\0" \
123 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
124 "nand read ${fdt_addr} dtb; " \
125 "nand read ${kernel_addr} kernel; " \
126 "nand read ${ram_addr} root; " \
127 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
128 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
129 "${blimg_file}; " \
130 "then sf probe; " \
131 "mtdparts default; " \
132 "nand erase.part bootloader; " \
133 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
134 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
135 "${tftpdir}${blimg_file}; "\
136 "then sf probe; " \
137 "mtdparts default; " \
138 "nand erase.part bootloader; " \
139 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
140 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
141 "${dtbkernel_file}; " \
142 "then sf probe; " \
143 "ubi part dtbkernel; " \
144 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
145 "${filesize}; " \
146 "ubi detach; fi\0" \
147 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
148 "${tftpdir}${dtbkernel_file}; " \
149 "then sf probe; " \
150 "ubi part dtbkernel; " \
151 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
152 "${filesize}; " \
153 "ubi detach; fi\0" \
154 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
155 "${ram_file}; " \
156 "then sf probe; " \
157 "mtdparts default; " \
158 "nand erase.part initrd; " \
159 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
160 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
161 "then sf probe; " \
162 "nand erase.part initrd; " \
163 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
164 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
165 "${filesys}; " \
166 "then sf probe; " \
167 "ubi part system; " \
168 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
169 "ubi detach; fi\0" \
170 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
171 "then sf probe; " \
172 "ubi part system; " \
173 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
174 "ubi detach; fi\0" \
Lukasz Majewskiad3d7a72019-02-13 22:46:54 +0100175 "setup_dtbkernel=nand erase.part dtbkernel; " \
176 "ubi part dtbkernel; " \
177 "ubi create dtbkernel1 972000 s; " \
178 "ubi create dtbkernel2 972000 s; " \
179 "ubi detach\0" \
180 "setup_system=nand erase.part system; " \
181 "ubi part system; " \
182 "ubi create rootfs1 15E15000 d; " \
183 "ubi create rootfs2 15E15000 d; " \
184 "ubi create userdata; " \
185 "ubi detach\0" \
Lukasz Majewski9050cfc2019-02-13 22:46:55 +0100186 "setup_nor1=" BK4_NET_INIT \
187 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
188 "then sf probe 0:0; " \
189 "sf erase 0 01000000; " \
190 "mtdparts default; " \
191 "ubi part nor; " \
192 "ubi create nor1fs; " \
193 "ubi write ${sys_addr} nor1fs ${filesize}; " \
194 "ubi detach; fi\0" \
195 "setup_nor2=" BK4_NET_INIT \
196 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
197 "then sf probe 0:1; " \
198 "sf erase 0 01000000; " \
199 "mtdparts default; " \
200 "ubi part nor; " \
201 "ubi create nor2fs; " \
202 "ubi write ${sys_addr} nor2fs ${filesize}; " \
203 "ubi detach; fi\0" \
Lukasz Majewskiad3d7a72019-02-13 22:46:54 +0100204 "prepare_install_bk4r1_envs=" \
205 "echo 'Preparing envs for SD card recovery!';" \
206 "setenv ipaddr 192.168.0.99;" \
207 "setenv serverip 192.168.0.50;" \
208 "\0" \
209 "install_bk4r1rs="\
210 "led 0 on; " \
211 "nand erase.chip; mtdparts default; "\
212 "led 1 on; "\
213 "run setup_dtbkernel; " \
214 "run setup_system; " \
215 "led 2 on;" \
216 "run update_bootloader_from_sd; "\
217 "run update_dtbkernel_from_sd; "\
218 "run update_rootfs_from_sd; "\
219 "setenv bootcmd 'run bootcmd_nand'; "\
220 "saveenv; " \
221 "led 3 on; " \
222 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
223 "source to NAND\0" \
Lukasz Majewski8c6248c2019-02-13 22:46:52 +0100224 "active_workset=1\0"
225
Lukasz Majewski8c6248c2019-02-13 22:46:52 +0100226/* Physical memory map */
227#define PHYS_SDRAM (0x80000000)
228#define PHYS_SDRAM_SIZE (SZ_512M)
229
230#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
231#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
232#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
233
234#define CONFIG_SYS_INIT_SP_OFFSET \
235 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
236#define CONFIG_SYS_INIT_SP_ADDR \
237 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
238
Lukasz Majewski8c6248c2019-02-13 22:46:52 +0100239#endif /* __CONFIG_H */