blob: 762d1980bda44e3cd1b06fd4bc845f0ef46f2f6c [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
Lukasz Majewski6f854c62019-02-13 22:46:52 +010035/* Enable PREBOOT variable */
Lukasz Majewski6f854c62019-02-13 22:46:52 +010036
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020037/* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */
Lukasz Majewski6f854c62019-02-13 22:46:52 +010038#define BK4_NET_INIT "run set_gpio122;"
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020039
Lukasz Majewski6f854c62019-02-13 22:46:52 +010040/* 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; " \
45 "ubi detach; " \
46 "setenv eraseuserdata false; " \
47 "saveenv; " \
48 "fi; "
Albert ARIBAUD \(3ADEV\)27192d12016-09-26 09:08:08 +020049
Lukasz Majewski6f854c62019-02-13 22:46:52 +010050#include <asm/arch/imx-regs.h>
51#include <linux/sizes.h>
52
Lukasz Majewski6f854c62019-02-13 22:46:52 +010053/* NAND support */
Lukasz Majewski6f854c62019-02-13 22:46:52 +010054#define CONFIG_SYS_MAX_NAND_DEVICE 1
55
56#define IMX_FEC1_BASE ENET1_BASE_ADDR
57
58/* QSPI Configs*/
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
63#endif
Lukasz Majewski6f854c62019-02-13 22:46:52 +010064
65/* We boot from the gfxRAM area of the OCRAM. */
66#define CONFIG_BOARD_SIZE_LIMIT 520192
67
68/* boot command, including the target-defined one if any */
Lukasz Majewski6f854c62019-02-13 22:46:52 +010069
70/* Extra env settings (including the target-defined ones if any) */
71#define CONFIG_EXTRA_ENV_SETTINGS \
72 BK4_EXTRA_ENV_SETTINGS \
73 "autoload=no\0" \
74 "fdt_high=0xffffffff\0" \
75 "initrd_high=0xffffffff\0" \
76 "blimg_file=u-boot.vyb\0" \
77 "blimg_addr=0x81000000\0" \
78 "dtbkernel_file=fitImage\0" \
79 "dtbkernel_addr=0x82000000\0" \
80 "ram_file=uRamdisk\0" \
81 "ram_addr=0x83000000\0" \
82 "filesys=rootfs.ubifs\0" \
83 "sys_addr=0x81000000\0" \
84 "nfs_root=/path/to/nfs/root\0" \
85 "tftptimeout=1000\0" \
86 "tftptimeoutcountmax=1000000\0" \
87 "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
88 "ipaddr=192.168.0.60\0" \
89 "serverip=192.168.0.1\0" \
90 "bootargs_base=setenv bootargs rw " \
91 "console=ttyLP1,115200n8\0" \
92 "bootargs_sd=setenv bootargs ${bootargs} " \
93 "root=/dev/mmcblk0p2 rootwait\0" \
94 "bootargs_nand=setenv bootargs ${bootargs} " \
95 "ubi.mtd=5 rootfstype=" \
96 "ubifs root=ubi0:rootfs${active_workset}\0" \
97 "bootargs_ram=setenv bootargs ${bootargs} " \
98 "root=/dev/ram rw initrd=${ram_addr}\0" \
99 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
100 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
101 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
102 "bootm ${dtbkernel_addr}\0" \
103 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
104 "ubi part dtbkernel; " \
105 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
106 "led 0 on; " \
107 "bootm ${dtbkernel_addr}\0" \
108 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
109 "nand read ${fdt_addr} dtb; " \
110 "nand read ${kernel_addr} kernel; " \
111 "nand read ${ram_addr} root; " \
112 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
113 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
114 "${blimg_file}; " \
115 "then sf probe; " \
116 "mtdparts default; " \
117 "nand erase.part bootloader; " \
118 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
119 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
120 "${tftpdir}${blimg_file}; "\
121 "then sf probe; " \
122 "mtdparts default; " \
123 "nand erase.part bootloader; " \
124 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
125 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
126 "${dtbkernel_file}; " \
127 "then sf probe; " \
128 "ubi part dtbkernel; " \
129 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
130 "${filesize}; " \
131 "ubi detach; fi\0" \
132 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
133 "${tftpdir}${dtbkernel_file}; " \
134 "then sf probe; " \
135 "ubi part dtbkernel; " \
136 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
137 "${filesize}; " \
138 "ubi detach; fi\0" \
139 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
140 "${ram_file}; " \
141 "then sf probe; " \
142 "mtdparts default; " \
143 "nand erase.part initrd; " \
144 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
145 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
146 "then sf probe; " \
147 "nand erase.part initrd; " \
148 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
149 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
150 "${filesys}; " \
151 "then sf probe; " \
152 "ubi part system; " \
153 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
154 "ubi detach; fi\0" \
155 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
156 "then sf probe; " \
157 "ubi part system; " \
158 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
159 "ubi detach; fi\0" \
Lukasz Majewski32c160e2019-02-13 22:46:54 +0100160 "setup_dtbkernel=nand erase.part dtbkernel; " \
161 "ubi part dtbkernel; " \
162 "ubi create dtbkernel1 972000 s; " \
163 "ubi create dtbkernel2 972000 s; " \
164 "ubi detach\0" \
165 "setup_system=nand erase.part system; " \
166 "ubi part system; " \
167 "ubi create rootfs1 15E15000 d; " \
168 "ubi create rootfs2 15E15000 d; " \
169 "ubi create userdata; " \
170 "ubi detach\0" \
Lukasz Majewskib3d28ac2019-02-13 22:46:55 +0100171 "setup_nor1=" BK4_NET_INIT \
172 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
173 "then sf probe 0:0; " \
174 "sf erase 0 01000000; " \
175 "mtdparts default; " \
176 "ubi part nor; " \
177 "ubi create nor1fs; " \
178 "ubi write ${sys_addr} nor1fs ${filesize}; " \
179 "ubi detach; fi\0" \
180 "setup_nor2=" BK4_NET_INIT \
181 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
182 "then sf probe 0:1; " \
183 "sf erase 0 01000000; " \
184 "mtdparts default; " \
185 "ubi part nor; " \
186 "ubi create nor2fs; " \
187 "ubi write ${sys_addr} nor2fs ${filesize}; " \
188 "ubi detach; fi\0" \
Lukasz Majewski32c160e2019-02-13 22:46:54 +0100189 "prepare_install_bk4r1_envs=" \
190 "echo 'Preparing envs for SD card recovery!';" \
191 "setenv ipaddr 192.168.0.99;" \
192 "setenv serverip 192.168.0.50;" \
193 "\0" \
194 "install_bk4r1rs="\
195 "led 0 on; " \
196 "nand erase.chip; mtdparts default; "\
197 "led 1 on; "\
198 "run setup_dtbkernel; " \
199 "run setup_system; " \
200 "led 2 on;" \
201 "run update_bootloader_from_sd; "\
202 "run update_dtbkernel_from_sd; "\
203 "run update_rootfs_from_sd; "\
204 "setenv bootcmd 'run bootcmd_nand'; "\
205 "saveenv; " \
206 "led 3 on; " \
207 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
208 "source to NAND\0" \
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100209 "active_workset=1\0"
210
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100211/* Physical memory map */
212#define PHYS_SDRAM (0x80000000)
213#define PHYS_SDRAM_SIZE (SZ_512M)
214
215#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM
216#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
217#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE
218
219#define CONFIG_SYS_INIT_SP_OFFSET \
220 (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
221#define CONFIG_SYS_INIT_SP_ADDR \
222 (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
223
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100224#endif /* __CONFIG_H */