blob: 5dc09fa91ccceb79dc63a836d48f5880be3ccde0 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocher499c4982013-08-19 16:39:01 +02002/*
3 * siemens am33x common board options
4 * (C) Copyright 2013 Siemens Schweiz AG
5 * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de.
6 *
7 * Based on:
8 * U-Boot file:/include/configs/am335x_evm.h
9 *
10 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Heiko Schocher499c4982013-08-19 16:39:01 +020011 */
12
13#ifndef __CONFIG_SIEMENS_AM33X_COMMON_H
14#define __CONFIG_SIEMENS_AM33X_COMMON_H
15
Heiko Schocher499c4982013-08-19 16:39:01 +020016#include <asm/arch/omap.h>
17
Heiko Schocher499c4982013-08-19 16:39:01 +020018/* commands to include */
Heiko Schocher499c4982013-08-19 16:39:01 +020019
Heiko Schocher499c4982013-08-19 16:39:01 +020020#ifndef CONFIG_SPL_BUILD
21#define CONFIG_ROOTPATH "/opt/eldk"
22#endif
23
Heiko Schocher499c4982013-08-19 16:39:01 +020024#define CONFIG_SYS_AUTOLOAD "yes"
25
26/* Clock Defines */
27#define V_OSCK 24000000 /* Clock output from T2 */
28#define V_SCLK (V_OSCK)
29
Heiko Schocher499c4982013-08-19 16:39:01 +020030/* Console I/O Buffer Size */
Heiko Schocher499c4982013-08-19 16:39:01 +020031
Heiko Schocher499c4982013-08-19 16:39:01 +020032/*
33 * memtest works on 8 MB in DRAM after skipping 32MB from
34 * start addr of ram disk
35 */
Heiko Schocher499c4982013-08-19 16:39:01 +020036
Heiko Schocher499c4982013-08-19 16:39:01 +020037 /* Physical Memory Map */
Heiko Schocher499c4982013-08-19 16:39:01 +020038#define PHYS_DRAM_1 0x80000000 /* DRAM Bank #1 */
39
40#define CONFIG_SYS_SDRAM_BASE PHYS_DRAM_1
Heiko Schocher499c4982013-08-19 16:39:01 +020041 /* Platform/Board specific defs */
42#define CONFIG_SYS_TIMERBASE 0x48040000 /* Use Timer2 */
Heiko Schocher499c4982013-08-19 16:39:01 +020043
44/* NS16550 Configuration */
Heiko Schocher499c4982013-08-19 16:39:01 +020045#define CONFIG_SYS_NS16550_SERIAL
Heiko Schocher499c4982013-08-19 16:39:01 +020046#define CONFIG_SYS_NS16550_CLK (48000000)
47#define CONFIG_SYS_NS16550_COM1 0x44e09000
48#define CONFIG_SYS_NS16550_COM4 0x481a6000
49
Heiko Schocher499c4982013-08-19 16:39:01 +020050
51/* I2C Configuration */
Heiko Schocher499c4982013-08-19 16:39:01 +020052
53/* Defines for SPL */
Heiko Schocher499c4982013-08-19 16:39:01 +020054
Heiko Schocher499c4982013-08-19 16:39:01 +020055#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, \
56 10, 11, 12, 13, 14, 15, 16, 17, \
57 18, 19, 20, 21, 22, 23, 24, 25, \
58 26, 27, 28, 29, 30, 31, 32, 33, \
59 34, 35, 36, 37, 38, 39, 40, 41, \
60 42, 43, 44, 45, 46, 47, 48, 49, \
61 50, 51, 52, 53, 54, 55, 56, 57, }
62
63#define CONFIG_SYS_NAND_ECCSIZE 512
64#define CONFIG_SYS_NAND_ECCBYTES 14
65
66#define CONFIG_SYS_NAND_ECCSTEPS 4
67#define CONFIG_SYS_NAND_ECCTOTAL (CONFIG_SYS_NAND_ECCBYTES * \
68 CONFIG_SYS_NAND_ECCSTEPS)
69
70#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE
71
Heiko Schocher499c4982013-08-19 16:39:01 +020072/*
73 * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
74 * 64 bytes before this address should be set aside for u-boot.img's
75 * header. That is 0x800FFFC0--0x80100000 should not be used for any
76 * other needs.
77 */
Heiko Schocher499c4982013-08-19 16:39:01 +020078
79/*
80 * Since SPL did pll and ddr initialization for us,
81 * we don't need to do it twice.
82 */
Heiko Schocher499c4982013-08-19 16:39:01 +020083
84#ifndef CONFIG_SPL_BUILD
Heiko Schocher499c4982013-08-19 16:39:01 +020085
Samuel Egli8069bfe2013-11-04 14:05:03 +010086/* USB DRACO ID as default */
Heiko Schocher499c4982013-08-19 16:39:01 +020087#define CONFIG_USBD_HS
Heiko Schocher499c4982013-08-19 16:39:01 +020088
89/* USB Device Firmware Update support */
Heiko Schocherea75c472014-03-18 08:09:57 +010090#define DFU_MANIFEST_POLL_TIMEOUT 25000
Heiko Schocher499c4982013-08-19 16:39:01 +020091
92#endif /* CONFIG_SPL_BUILD */
93
94/*
95 * Default to using SPI for environment, etc. We have multiple copies
96 * of SPL as the ROM will check these locations.
97 * 0x0 - 0x20000 : First copy of SPL
98 * 0x20000 - 0x40000 : Second copy of SPL
99 * 0x40000 - 0x60000 : Third copy of SPL
100 * 0x60000 - 0x80000 : Fourth copy of SPL
101 * 0x80000 - 0xDF000 : U-Boot
102 * 0xDF000 - 0xE0000 : U-Boot Environment
103 * 0xE0000 - 0x442000 : Linux Kernel
104 * 0x442000 - 0x800000 : Userland
105 */
Heiko Schocher499c4982013-08-19 16:39:01 +0200106
Heiko Schocher499c4982013-08-19 16:39:01 +0200107/* NAND support */
Miquel Raynald0935362019-10-03 19:50:03 +0200108#ifdef CONFIG_MTD_RAW_NAND
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200109/* UBI Support */
Heiko Schocher499c4982013-08-19 16:39:01 +0200110
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200111/* Commen environment */
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200112#define COMMON_ENV_DFU_ARGS "dfu_args=run bootargs_defaults;" \
113 "setenv bootargs ${bootargs};" \
114 "mtdparts default;" \
115 "draco_led 1;" \
116 "dfu 0 nand 0;" \
117 "draco_led 0;\0" \
118
119#define COMMON_ENV_NAND_BOOT \
120 "nand_boot=echo Booting from nand; " \
121 "if test ${upgrade_available} -eq 1; then " \
122 "if test ${bootcount} -gt ${bootlimit}; " \
123 "then " \
124 "setenv upgrade_available 0;" \
125 "setenv ${partitionset_active} true;" \
126 "if test -n ${A}; then " \
127 "setenv partitionset_active B; " \
128 "env delete A; " \
129 "fi;" \
130 "if test -n ${B}; then " \
131 "setenv partitionset_active A; " \
132 "env delete B; " \
133 "fi;" \
134 "saveenv; " \
135 "fi;" \
136 "fi;" \
137 "echo set ${partitionset_active}...;" \
138 "run nand_args; "
139
140#define COMMON_ENV_NAND_CMDS "flash_self=run nand_boot\0" \
141 "flash_self_test=setenv testargs test; " \
142 "run nand_boot\0" \
143 "dfu_start=echo Preparing for dfu mode ...; " \
144 "run dfu_args; \0"
145
146#define COMMON_ENV_SETTINGS \
147 "verify=no \0" \
148 "project_dir=targetdir\0" \
149 "upgrade_available=0\0" \
150 "altbootcmd=run bootcmd\0" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200151 "partitionset_active=A\0" \
152 "loadaddr=0x82000000\0" \
153 "kloadaddr=0x81000000\0" \
154 "script_addr=0x81900000\0" \
155 "console=console=ttyMTD,mtdoops console=ttyO0,115200n8 panic=5\0" \
156 "nfsopts=nolock rw\0" \
157 "ip_method=none\0" \
158 "bootenv=uEnv.txt\0" \
159 "bootargs_defaults=setenv bootargs " \
160 "console=${console} " \
161 "${testargs} " \
162 "${optargs}\0" \
163 "siemens_help=echo; "\
164 "echo Type 'run flash_self' to use kernel and root " \
165 "filesystem on memory; echo Type 'run flash_self_test' to " \
166 "use kernel and root filesystem on memory, boot in test " \
167 "mode; echo Not ready yet: 'run flash_nfs' to use kernel " \
168 "from memory and root filesystem over NFS; echo Type " \
169 "'run net_nfs' to get Kernel over TFTP and mount root " \
170 "filesystem over NFS; " \
171 "echo Set partitionset_active variable to 'A' " \
172 "or 'B' to select kernel and rootfs partition; " \
173 "echo" \
174 "\0"
175
Heiko Schocher499c4982013-08-19 16:39:01 +0200176/*
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200177 * Variant 1 partition layout
Heiko Schocher499c4982013-08-19 16:39:01 +0200178 * chip-size = 256MiB
179 *| name | size | address area |
180 *-------------------------------------------------------
181 *| spl | 128.000 KiB | 0x 0..0x 1ffff |
182 *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
183 *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
184 *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
185 *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
186 *| uboot.env | 128.000 KiB | 0x 260000..0x 27ffff |
187 *| kernel_a | 5.000 MiB | 0x 280000..0x 77ffff |
188 *| kernel_b | 5.000 MiB | 0x 780000..0x c7ffff |
189 *| mtdoops | 8.000 MiB | 0x c80000..0x 147ffff |
190 *| rootfs | 235.500 MiB | 0x 1480000..0x fffffff |
191 *-------------------------------------------------------
Tom Rini5ad8e112017-10-22 17:55:07 -0400192
193 "mtdparts=omap2-nand.0:" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200194 "128k(spl)," \
195 "128k(spl.backup1)," \
196 "128k(spl.backup2)," \
197 "128k(spl.backup3)," \
198 "1920k(u-boot)," \
199 "128k(uboot.env)," \
200 "5120k(kernel_a)," \
201 "5120k(kernel_b)," \
202 "8192k(mtdoops)," \
203 "-(rootfs)"
Tom Rini5ad8e112017-10-22 17:55:07 -0400204 */
Heiko Schocher499c4982013-08-19 16:39:01 +0200205
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200206#define DFU_ALT_INFO_NAND_V1 \
Heiko Schocher499c4982013-08-19 16:39:01 +0200207 "spl part 0 1;" \
208 "spl.backup1 part 0 2;" \
209 "spl.backup2 part 0 3;" \
210 "spl.backup3 part 0 4;" \
211 "u-boot part 0 5;" \
212 "u-boot.env part 0 6;" \
213 "kernel_a part 0 7;" \
214 "kernel_b part 0 8;" \
215 "rootfs partubi 0 10"
216
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200217#define CONFIG_ENV_SETTINGS_NAND_V1 \
Heiko Schocher499c4982013-08-19 16:39:01 +0200218 "nand_active_ubi_vol=rootfs_a\0" \
Samuel Egli8069bfe2013-11-04 14:05:03 +0100219 "nand_active_ubi_vol_A=rootfs_a\0" \
220 "nand_active_ubi_vol_B=rootfs_b\0" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200221 "nand_root_fs_type=ubifs rootwait=1\0" \
222 "nand_src_addr=0x280000\0" \
Samuel Egli8069bfe2013-11-04 14:05:03 +0100223 "nand_src_addr_A=0x280000\0" \
224 "nand_src_addr_B=0x780000\0" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200225 "nand_args=run bootargs_defaults;" \
226 "mtdparts default;" \
Samuel Egli8069bfe2013-11-04 14:05:03 +0100227 "setenv ${partitionset_active} true;" \
228 "if test -n ${A}; then " \
229 "setenv nand_active_ubi_vol ${nand_active_ubi_vol_A};" \
230 "setenv nand_src_addr ${nand_src_addr_A};" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200231 "fi;" \
Samuel Egli8069bfe2013-11-04 14:05:03 +0100232 "if test -n ${B}; then " \
233 "setenv nand_active_ubi_vol ${nand_active_ubi_vol_B};" \
234 "setenv nand_src_addr ${nand_src_addr_B};" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200235 "fi;" \
236 "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
Heiko Schochercbec11a2016-06-07 08:55:45 +0200237 "ubi.mtd=9,${ubi_off};" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200238 "setenv bootargs ${bootargs} " \
239 "root=${nand_root} noinitrd ${mtdparts} " \
240 "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
241 "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
242 "=mtdoops\0" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200243 COMMON_ENV_DFU_ARGS \
244 "dfu_alt_info=" DFU_ALT_INFO_NAND_V1 "\0" \
245 COMMON_ENV_NAND_BOOT \
246 "nand read.i ${kloadaddr} ${nand_src_addr} " \
247 "${nand_img_size}; bootm ${kloadaddr}\0" \
248 COMMON_ENV_NAND_CMDS
249
250#define CONFIG_ENV_SETTINGS_V1 \
251 COMMON_ENV_SETTINGS \
Heiko Schocher499c4982013-08-19 16:39:01 +0200252 "net_args=run bootargs_defaults;" \
253 "mtdparts default;" \
254 "setenv bootfile ${project_dir}/kernel/uImage;" \
255 "setenv rootpath /home/projects/${project_dir}/rootfs;" \
256 "setenv bootargs ${bootargs} " \
257 "root=/dev/nfs ${mtdparts} " \
258 "nfsroot=${serverip}:${rootpath},${nfsopts} " \
Samuel Egli8069bfe2013-11-04 14:05:03 +0100259 "ip=${ipaddr}:${serverip}:" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200260 "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200261 "net_nfs=echo Booting from network ...; " \
262 "run net_args; " \
263 "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
264 "bootm ${kloadaddr}\0"
265
266/*
Tom Rini5ad8e112017-10-22 17:55:07 -0400267 * Variant 2 partition layout (default)
Egli, Samuel21c5f722015-07-01 17:57:39 +0200268 * chip-size = 256MiB or 512 MiB
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200269 *| name | size | address area |
270 *-------------------------------------------------------
271 *| spl | 128.000 KiB | 0x 0..0x 1ffff |
272 *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
273 *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
274 *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
275 *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
276 *| uboot.env0 | 512.000 KiB | 0x 260000..0x 2Dffff |
277 *| uboot.env1 | 512.000 KiB | 0x 2E0000..0x 35ffff |
Egli, Samuel21c5f722015-07-01 17:57:39 +0200278 *| mtdoops | 512.000 KiB | 0x 360000..0x 3dffff |
279 *| (256) rootfs | 252.125 MiB | 0x 3E0000..0x fffffff |
280 *| (512) rootfs | 508.125 MiB | 0x 3E0000..0x1fffffff |
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200281 *-------------------------------------------------------
282 */
283
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200284#define DFU_ALT_INFO_NAND_V2 \
285 "spl part 0 1;" \
286 "spl.backup1 part 0 2;" \
287 "spl.backup2 part 0 3;" \
288 "spl.backup3 part 0 4;" \
289 "u-boot part 0 5;" \
290 "u-boot.env0 part 0 6;" \
291 "u-boot.env1 part 0 7;" \
Egli, Samuel21c5f722015-07-01 17:57:39 +0200292 "rootfs partubi 0 9" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200293
294#define CONFIG_ENV_SETTINGS_NAND_V2 \
295 "nand_active_ubi_vol=rootfs_a\0" \
296 "rootfs_name=rootfs\0" \
297 "kernel_name=uImage\0"\
298 "nand_root_fs_type=ubifs rootwait=1\0" \
299 "nand_args=run bootargs_defaults;" \
300 "mtdparts default;" \
301 "setenv ${partitionset_active} true;" \
302 "if test -n ${A}; then " \
303 "setenv nand_active_ubi_vol ${rootfs_name}_a;" \
Samuel Egli8069bfe2013-11-04 14:05:03 +0100304 "fi;" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200305 "if test -n ${B}; then " \
306 "setenv nand_active_ubi_vol ${rootfs_name}_b;" \
307 "fi;" \
308 "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
Egli, Samuel21c5f722015-07-01 17:57:39 +0200309 "ubi.mtd=rootfs,2048;" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200310 "setenv bootargs ${bootargs} " \
311 "root=${nand_root} noinitrd ${mtdparts} " \
312 "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
313 "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
314 "=mtdoops\0" \
315 COMMON_ENV_DFU_ARGS \
316 "dfu_alt_info=" DFU_ALT_INFO_NAND_V2 "\0" \
317 COMMON_ENV_NAND_BOOT \
Heiko Schochercbec11a2016-06-07 08:55:45 +0200318 "ubi part rootfs ${ubi_off};" \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200319 "ubifsmount ubi0:${nand_active_ubi_vol};" \
320 "ubifsload ${kloadaddr} boot/${kernel_name};" \
321 "ubifsload ${loadaddr} boot/${dtb_name}.dtb;" \
322 "bootm ${kloadaddr} - ${loadaddr}\0" \
323 "nand_boot_backup=ubifsload ${loadaddr} boot/am335x-draco.dtb;" \
324 "bootm ${kloadaddr} - ${loadaddr}\0" \
325 COMMON_ENV_NAND_CMDS
326
327#define CONFIG_ENV_SETTINGS_V2 \
328 COMMON_ENV_SETTINGS \
329 "net_args=run bootargs_defaults;" \
330 "mtdparts default;" \
331 "setenv bootfile ${project_dir}/kernel/uImage;" \
332 "setenv bootdtb ${project_dir}/kernel/dtb;" \
333 "setenv rootpath /home/projects/${project_dir}/rootfs;" \
334 "setenv bootargs ${bootargs} " \
335 "root=/dev/nfs ${mtdparts} " \
336 "nfsroot=${serverip}:${rootpath},${nfsopts} " \
337 "ip=${ipaddr}:${serverip}:" \
338 "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
Heiko Schocher499c4982013-08-19 16:39:01 +0200339 "net_nfs=echo Booting from network ...; " \
340 "run net_args; " \
341 "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
Heiko Schocherd17c3fc2015-06-16 14:59:34 +0200342 "tftpboot ${loadaddr} ${serverip}:${bootdtb}; " \
343 "bootm ${kloadaddr} - ${loadaddr}\0"
344
Heiko Schocherb7a6d142015-06-15 14:56:41 +0200345/*
346 * Variant 3 partition layout
347 * chip-size = 512MiB
348 *| name | size | address area |
349 *-------------------------------------------------------
350 *| spl | 128.000 KiB | 0x 0..0x 1ffff |
351 *| spl.backup1 | 128.000 KiB | 0x 20000..0x 3ffff |
352 *| spl.backup2 | 128.000 KiB | 0x 40000..0x 5ffff |
353 *| spl.backup3 | 128.000 KiB | 0x 60000..0x 7ffff |
354 *| u-boot | 1.875 MiB | 0x 80000..0x 25ffff |
355 *| uboot.env0 | 512.000 KiB | 0x 260000..0x 2Dffff |
356 *| uboot.env1 | 512.000 KiB | 0x 2E0000..0x 35ffff |
357 *| rootfs | 300.000 MiB | 0x 360000..0x12f5ffff |
358 *| mtdoops | 512.000 KiB | 0x12f60000..0x12fdffff |
359 *|configuration | 104.125 MiB | 0x12fe0000..0x1fffffff |
360 *-------------------------------------------------------
Heiko Schocherb7a6d142015-06-15 14:56:41 +0200361
Tom Rini5ad8e112017-10-22 17:55:07 -0400362 "mtdparts=omap2-nand.0:" \
Heiko Schocherb7a6d142015-06-15 14:56:41 +0200363 "128k(spl)," \
364 "128k(spl.backup1)," \
365 "128k(spl.backup2)," \
366 "128k(spl.backup3)," \
367 "1920k(u-boot)," \
368 "512k(u-boot.env0)," \
369 "512k(u-boot.env1)," \
370 "300m(rootfs)," \
371 "512k(mtdoops)," \
372 "-(configuration)"
373
Tom Rini5ad8e112017-10-22 17:55:07 -0400374 */
375
Heiko Schocher499c4982013-08-19 16:39:01 +0200376#define CONFIG_SYS_NAND_BASE (0x08000000) /* physical address */
377 /* to access nand at */
378 /* CS0 */
379#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of NAND
380 devices */
381#if !defined(CONFIG_SPI_BOOT)
Heiko Schocher499c4982013-08-19 16:39:01 +0200382#define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
383#endif
384#endif
385
Heiko Schocher499c4982013-08-19 16:39:01 +0200386#endif /* ! __CONFIG_SIEMENS_AM33X_COMMON_H */