blob: 5df8d03c70655af0d88a93307981db364486cd9a [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
55#define IMX_FEC1_BASE ENET1_BASE_ADDR
56
Lukasz Majewski6f854c62019-02-13 22:46:52 +010057/* boot command, including the target-defined one if any */
Lukasz Majewski6f854c62019-02-13 22:46:52 +010058
59/* Extra env settings (including the target-defined ones if any) */
Tom Rini0613c362022-12-04 10:03:50 -050060#define CFG_EXTRA_ENV_SETTINGS \
Lukasz Majewski6f854c62019-02-13 22:46:52 +010061 BK4_EXTRA_ENV_SETTINGS \
Lukasz Majewski6f854c62019-02-13 22:46:52 +010062 "fdt_high=0xffffffff\0" \
63 "initrd_high=0xffffffff\0" \
64 "blimg_file=u-boot.vyb\0" \
65 "blimg_addr=0x81000000\0" \
66 "dtbkernel_file=fitImage\0" \
67 "dtbkernel_addr=0x82000000\0" \
68 "ram_file=uRamdisk\0" \
69 "ram_addr=0x83000000\0" \
70 "filesys=rootfs.ubifs\0" \
71 "sys_addr=0x81000000\0" \
72 "nfs_root=/path/to/nfs/root\0" \
73 "tftptimeout=1000\0" \
74 "tftptimeoutcountmax=1000000\0" \
Lukasz Majewski6f854c62019-02-13 22:46:52 +010075 "ipaddr=192.168.0.60\0" \
76 "serverip=192.168.0.1\0" \
77 "bootargs_base=setenv bootargs rw " \
78 "console=ttyLP1,115200n8\0" \
79 "bootargs_sd=setenv bootargs ${bootargs} " \
80 "root=/dev/mmcblk0p2 rootwait\0" \
81 "bootargs_nand=setenv bootargs ${bootargs} " \
82 "ubi.mtd=5 rootfstype=" \
83 "ubifs root=ubi0:rootfs${active_workset}\0" \
84 "bootargs_ram=setenv bootargs ${bootargs} " \
85 "root=/dev/ram rw initrd=${ram_addr}\0" \
86 "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
87 "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \
88 "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \
89 "bootm ${dtbkernel_addr}\0" \
90 "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \
91 "ubi part dtbkernel; " \
92 "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \
93 "led 0 on; " \
94 "bootm ${dtbkernel_addr}\0" \
95 "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \
96 "nand read ${fdt_addr} dtb; " \
97 "nand read ${kernel_addr} kernel; " \
98 "nand read ${ram_addr} root; " \
99 "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \
100 "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \
101 "${blimg_file}; " \
102 "then sf probe; " \
103 "mtdparts default; " \
104 "nand erase.part bootloader; " \
105 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
106 "update_bootloader_from_tftp=if tftp ${blimg_addr} "\
107 "${tftpdir}${blimg_file}; "\
108 "then sf probe; " \
109 "mtdparts default; " \
110 "nand erase.part bootloader; " \
111 "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \
112 "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \
113 "${dtbkernel_file}; " \
114 "then sf probe; " \
115 "ubi part dtbkernel; " \
116 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
117 "${filesize}; " \
118 "ubi detach; fi\0" \
119 "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \
120 "${tftpdir}${dtbkernel_file}; " \
121 "then sf probe; " \
122 "ubi part dtbkernel; " \
123 "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \
124 "${filesize}; " \
125 "ubi detach; fi\0" \
126 "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \
127 "${ram_file}; " \
128 "then sf probe; " \
129 "mtdparts default; " \
130 "nand erase.part initrd; " \
131 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
132 "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \
133 "then sf probe; " \
134 "nand erase.part initrd; " \
135 "nand write ${ram_addr} initrd ${filesize}; fi\0" \
136 "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \
137 "${filesys}; " \
138 "then sf probe; " \
139 "ubi part system; " \
140 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
141 "ubi detach; fi\0" \
142 "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \
143 "then sf probe; " \
144 "ubi part system; " \
145 "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \
146 "ubi detach; fi\0" \
Lukasz Majewski32c160e2019-02-13 22:46:54 +0100147 "setup_dtbkernel=nand erase.part dtbkernel; " \
148 "ubi part dtbkernel; " \
149 "ubi create dtbkernel1 972000 s; " \
150 "ubi create dtbkernel2 972000 s; " \
151 "ubi detach\0" \
152 "setup_system=nand erase.part system; " \
153 "ubi part system; " \
154 "ubi create rootfs1 15E15000 d; " \
155 "ubi create rootfs2 15E15000 d; " \
156 "ubi create userdata; " \
157 "ubi detach\0" \
Lukasz Majewskib3d28ac2019-02-13 22:46:55 +0100158 "setup_nor1=" BK4_NET_INIT \
159 "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \
160 "then sf probe 0:0; " \
161 "sf erase 0 01000000; " \
162 "mtdparts default; " \
163 "ubi part nor; " \
164 "ubi create nor1fs; " \
165 "ubi write ${sys_addr} nor1fs ${filesize}; " \
166 "ubi detach; fi\0" \
167 "setup_nor2=" BK4_NET_INIT \
168 "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \
169 "then sf probe 0:1; " \
170 "sf erase 0 01000000; " \
171 "mtdparts default; " \
172 "ubi part nor; " \
173 "ubi create nor2fs; " \
174 "ubi write ${sys_addr} nor2fs ${filesize}; " \
175 "ubi detach; fi\0" \
Lukasz Majewski32c160e2019-02-13 22:46:54 +0100176 "prepare_install_bk4r1_envs=" \
177 "echo 'Preparing envs for SD card recovery!';" \
178 "setenv ipaddr 192.168.0.99;" \
179 "setenv serverip 192.168.0.50;" \
180 "\0" \
181 "install_bk4r1rs="\
182 "led 0 on; " \
183 "nand erase.chip; mtdparts default; "\
184 "led 1 on; "\
185 "run setup_dtbkernel; " \
186 "run setup_system; " \
187 "led 2 on;" \
188 "run update_bootloader_from_sd; "\
189 "run update_dtbkernel_from_sd; "\
190 "run update_rootfs_from_sd; "\
191 "setenv bootcmd 'run bootcmd_nand'; "\
192 "saveenv; " \
193 "led 3 on; " \
194 "echo Finished - Please Power off, REMOVE SDCARD and set boot" \
195 "source to NAND\0" \
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100196 "active_workset=1\0"
197
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100198/* Physical memory map */
199#define PHYS_SDRAM (0x80000000)
200#define PHYS_SDRAM_SIZE (SZ_512M)
201
Tom Riniaa6e94d2022-11-16 13:10:37 -0500202#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini65cc0e22022-11-16 13:10:41 -0500203#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
204#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100205
Lukasz Majewski6f854c62019-02-13 22:46:52 +0100206#endif /* __CONFIG_H */