Convert CONFIG_SYS_MAXARGS to Kconfig
[platform/kernel/u-boot.git] / include / configs / siemens-am33x-common.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
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/
11  */
12
13 #ifndef __CONFIG_SIEMENS_AM33X_COMMON_H
14 #define __CONFIG_SIEMENS_AM33X_COMMON_H
15
16 #include <asm/arch/omap.h>
17
18 /* commands to include */
19
20 #ifndef CONFIG_SPL_BUILD
21 #define CONFIG_ROOTPATH         "/opt/eldk"
22 #endif
23
24 #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
30 /* Console I/O Buffer Size */
31 #define CONFIG_SYS_CBSIZE               1024
32
33 /* Boot Argument Buffer Size */
34 #define CONFIG_SYS_BARGSIZE             CONFIG_SYS_CBSIZE
35
36 /*
37  * memtest works on 8 MB in DRAM after skipping 32MB from
38  * start addr of ram disk
39  */
40
41  /* Physical Memory Map */
42 #define PHYS_DRAM_1                     0x80000000      /* DRAM Bank #1 */
43
44 #define CONFIG_SYS_SDRAM_BASE           PHYS_DRAM_1
45 #define CONFIG_SYS_INIT_SP_ADDR         (NON_SECURE_SRAM_END - \
46                                                 GENERATED_GBL_DATA_SIZE)
47  /* Platform/Board specific defs */
48 #define CONFIG_SYS_TIMERBASE            0x48040000      /* Use Timer2 */
49 #define CONFIG_SYS_PTV                  2       /* Divisor: 2^(PTV+1) => 8 */
50
51 /* NS16550 Configuration */
52 #define CONFIG_SYS_NS16550_SERIAL
53 #define CONFIG_SYS_NS16550_CLK          (48000000)
54 #define CONFIG_SYS_NS16550_COM1         0x44e09000
55 #define CONFIG_SYS_NS16550_COM4         0x481a6000
56
57
58 /* I2C Configuration */
59
60 /* Defines for SPL */
61 #define CONFIG_SPL_MAX_SIZE             (SRAM_SCRATCH_SPACE_ADDR - \
62                                          CONFIG_SPL_TEXT_BASE)
63
64 #define CONFIG_SPL_BSS_START_ADDR       0x80000000
65 #define CONFIG_SPL_BSS_MAX_SIZE         0x80000         /* 512 KB */
66
67 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
68
69 #define CONFIG_SYS_NAND_ECCPOS          { 2, 3, 4, 5, 6, 7, 8, 9, \
70                                          10, 11, 12, 13, 14, 15, 16, 17, \
71                                          18, 19, 20, 21, 22, 23, 24, 25, \
72                                          26, 27, 28, 29, 30, 31, 32, 33, \
73                                          34, 35, 36, 37, 38, 39, 40, 41, \
74                                          42, 43, 44, 45, 46, 47, 48, 49, \
75                                          50, 51, 52, 53, 54, 55, 56, 57, }
76
77 #define CONFIG_SYS_NAND_ECCSIZE         512
78 #define CONFIG_SYS_NAND_ECCBYTES        14
79
80 #define CONFIG_SYS_NAND_ECCSTEPS        4
81 #define CONFIG_SYS_NAND_ECCTOTAL        (CONFIG_SYS_NAND_ECCBYTES * \
82                                                 CONFIG_SYS_NAND_ECCSTEPS)
83
84 #define CONFIG_SYS_NAND_U_BOOT_START    CONFIG_SYS_TEXT_BASE
85
86 /*
87  * 1MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM
88  * 64 bytes before this address should be set aside for u-boot.img's
89  * header. That is 0x800FFFC0--0x80100000 should not be used for any
90  * other needs.
91  */
92 #define CONFIG_SYS_SPL_MALLOC_START     0x80208000
93 #define CONFIG_SYS_SPL_MALLOC_SIZE      0x100000
94
95 /*
96  * Since SPL did pll and ddr initialization for us,
97  * we don't need to do it twice.
98  */
99
100 #ifndef CONFIG_SPL_BUILD
101
102 /* USB DRACO ID as default */
103 #define CONFIG_USBD_HS
104
105 /* USB Device Firmware Update support */
106 #define DFU_MANIFEST_POLL_TIMEOUT       25000
107
108 #endif /* CONFIG_SPL_BUILD */
109
110 /*
111  * Default to using SPI for environment, etc.  We have multiple copies
112  * of SPL as the ROM will check these locations.
113  * 0x0 - 0x20000 : First copy of SPL
114  * 0x20000 - 0x40000 : Second copy of SPL
115  * 0x40000 - 0x60000 : Third copy of SPL
116  * 0x60000 - 0x80000 : Fourth copy of SPL
117  * 0x80000 - 0xDF000 : U-Boot
118  * 0xDF000 - 0xE0000 : U-Boot Environment
119  * 0xE0000 - 0x442000 : Linux Kernel
120  * 0x442000 - 0x800000 : Userland
121  */
122
123 /* NAND support */
124 #ifdef CONFIG_MTD_RAW_NAND
125 /* UBI Support */
126
127 /* Commen environment */
128 #define COMMON_ENV_DFU_ARGS     "dfu_args=run bootargs_defaults;" \
129                                 "setenv bootargs ${bootargs};" \
130                                 "mtdparts default;" \
131                                 "draco_led 1;" \
132                                 "dfu 0 nand 0;" \
133                                 "draco_led 0;\0" \
134
135 #define COMMON_ENV_NAND_BOOT \
136                 "nand_boot=echo Booting from nand; " \
137                 "if test ${upgrade_available} -eq 1; then " \
138                         "if test ${bootcount} -gt ${bootlimit}; " \
139                                 "then " \
140                                 "setenv upgrade_available 0;" \
141                                 "setenv ${partitionset_active} true;" \
142                                 "if test -n ${A}; then " \
143                                         "setenv partitionset_active B; " \
144                                         "env delete A; " \
145                                 "fi;" \
146                                 "if test -n ${B}; then " \
147                                         "setenv partitionset_active A; " \
148                                         "env delete B; " \
149                                 "fi;" \
150                                 "saveenv; " \
151                         "fi;" \
152                 "fi;" \
153                 "echo set ${partitionset_active}...;" \
154                 "run nand_args; "
155
156 #define COMMON_ENV_NAND_CMDS    "flash_self=run nand_boot\0" \
157                                 "flash_self_test=setenv testargs test; " \
158                                         "run nand_boot\0" \
159                                 "dfu_start=echo Preparing for dfu mode ...; " \
160                                 "run dfu_args; \0"
161
162 #define COMMON_ENV_SETTINGS \
163         "verify=no \0" \
164         "project_dir=targetdir\0" \
165         "upgrade_available=0\0" \
166         "altbootcmd=run bootcmd\0" \
167         "partitionset_active=A\0" \
168         "loadaddr=0x82000000\0" \
169         "kloadaddr=0x81000000\0" \
170         "script_addr=0x81900000\0" \
171         "console=console=ttyMTD,mtdoops console=ttyO0,115200n8 panic=5\0" \
172         "nfsopts=nolock rw\0" \
173         "ip_method=none\0" \
174         "bootenv=uEnv.txt\0" \
175         "bootargs_defaults=setenv bootargs " \
176                 "console=${console} " \
177                 "${testargs} " \
178                 "${optargs}\0" \
179         "siemens_help=echo; "\
180                 "echo Type 'run flash_self' to use kernel and root " \
181                 "filesystem on memory; echo Type 'run flash_self_test' to " \
182                 "use kernel and root filesystem on memory, boot in test " \
183                 "mode; echo Not ready yet: 'run flash_nfs' to use kernel " \
184                 "from memory and root filesystem over NFS; echo Type " \
185                 "'run net_nfs' to get Kernel over TFTP and mount root " \
186                 "filesystem over NFS; " \
187                 "echo Set partitionset_active variable to 'A' " \
188                 "or 'B' to select kernel and rootfs partition; " \
189                 "echo" \
190                 "\0"
191
192 /*
193  * Variant 1 partition layout
194  * chip-size = 256MiB
195  *|         name |        size |           address area |
196  *-------------------------------------------------------
197  *|          spl | 128.000 KiB | 0x       0..0x   1ffff |
198  *|  spl.backup1 | 128.000 KiB | 0x   20000..0x   3ffff |
199  *|  spl.backup2 | 128.000 KiB | 0x   40000..0x   5ffff |
200  *|  spl.backup3 | 128.000 KiB | 0x   60000..0x   7ffff |
201  *|       u-boot |   1.875 MiB | 0x   80000..0x  25ffff |
202  *|    uboot.env | 128.000 KiB | 0x  260000..0x  27ffff |
203  *|     kernel_a |   5.000 MiB | 0x  280000..0x  77ffff |
204  *|     kernel_b |   5.000 MiB | 0x  780000..0x  c7ffff |
205  *|      mtdoops |   8.000 MiB | 0x  c80000..0x 147ffff |
206  *|       rootfs | 235.500 MiB | 0x 1480000..0x fffffff |
207  *-------------------------------------------------------
208
209                                         "mtdparts=omap2-nand.0:" \
210                                         "128k(spl),"            \
211                                         "128k(spl.backup1),"    \
212                                         "128k(spl.backup2),"    \
213                                         "128k(spl.backup3),"    \
214                                         "1920k(u-boot),"        \
215                                         "128k(uboot.env),"      \
216                                         "5120k(kernel_a),"      \
217                                         "5120k(kernel_b),"      \
218                                         "8192k(mtdoops),"       \
219                                         "-(rootfs)"
220  */
221
222 #define DFU_ALT_INFO_NAND_V1 \
223         "spl part 0 1;" \
224         "spl.backup1 part 0 2;" \
225         "spl.backup2 part 0 3;" \
226         "spl.backup3 part 0 4;" \
227         "u-boot part 0 5;" \
228         "u-boot.env part 0 6;" \
229         "kernel_a part 0 7;" \
230         "kernel_b part 0 8;" \
231         "rootfs partubi 0 10"
232
233 #define CONFIG_ENV_SETTINGS_NAND_V1 \
234         "nand_active_ubi_vol=rootfs_a\0" \
235         "nand_active_ubi_vol_A=rootfs_a\0" \
236         "nand_active_ubi_vol_B=rootfs_b\0" \
237         "nand_root_fs_type=ubifs rootwait=1\0" \
238         "nand_src_addr=0x280000\0" \
239         "nand_src_addr_A=0x280000\0" \
240         "nand_src_addr_B=0x780000\0" \
241         "nand_args=run bootargs_defaults;" \
242                 "mtdparts default;" \
243                 "setenv ${partitionset_active} true;" \
244                 "if test -n ${A}; then " \
245                         "setenv nand_active_ubi_vol ${nand_active_ubi_vol_A};" \
246                         "setenv nand_src_addr ${nand_src_addr_A};" \
247                 "fi;" \
248                 "if test -n ${B}; then " \
249                         "setenv nand_active_ubi_vol ${nand_active_ubi_vol_B};" \
250                         "setenv nand_src_addr ${nand_src_addr_B};" \
251                 "fi;" \
252                 "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
253                 "ubi.mtd=9,${ubi_off};" \
254                 "setenv bootargs ${bootargs} " \
255                 "root=${nand_root} noinitrd ${mtdparts} " \
256                 "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
257                 "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
258                 "=mtdoops\0" \
259         COMMON_ENV_DFU_ARGS \
260                 "dfu_alt_info=" DFU_ALT_INFO_NAND_V1 "\0" \
261         COMMON_ENV_NAND_BOOT \
262                 "nand read.i ${kloadaddr} ${nand_src_addr} " \
263                 "${nand_img_size}; bootm ${kloadaddr}\0" \
264         COMMON_ENV_NAND_CMDS
265
266 #define CONFIG_ENV_SETTINGS_V1 \
267                 COMMON_ENV_SETTINGS \
268         "net_args=run bootargs_defaults;" \
269                 "mtdparts default;" \
270                 "setenv bootfile ${project_dir}/kernel/uImage;" \
271                 "setenv rootpath /home/projects/${project_dir}/rootfs;" \
272                 "setenv bootargs ${bootargs} " \
273                 "root=/dev/nfs ${mtdparts} " \
274                 "nfsroot=${serverip}:${rootpath},${nfsopts} " \
275                 "ip=${ipaddr}:${serverip}:" \
276                 "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
277         "net_nfs=echo Booting from network ...; " \
278                 "run net_args; " \
279                 "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
280                 "bootm ${kloadaddr}\0"
281
282 /*
283  * Variant 2 partition layout (default)
284  * chip-size = 256MiB or 512 MiB
285  *|         name |        size |           address area |
286  *-------------------------------------------------------
287  *|          spl | 128.000 KiB | 0x       0..0x   1ffff |
288  *|  spl.backup1 | 128.000 KiB | 0x   20000..0x   3ffff |
289  *|  spl.backup2 | 128.000 KiB | 0x   40000..0x   5ffff |
290  *|  spl.backup3 | 128.000 KiB | 0x   60000..0x   7ffff |
291  *|       u-boot |   1.875 MiB | 0x   80000..0x  25ffff |
292  *|   uboot.env0 | 512.000 KiB | 0x  260000..0x  2Dffff |
293  *|   uboot.env1 | 512.000 KiB | 0x  2E0000..0x  35ffff |
294  *|      mtdoops | 512.000 KiB | 0x  360000..0x  3dffff |
295  *| (256) rootfs | 252.125 MiB | 0x  3E0000..0x fffffff |
296  *| (512) rootfs | 508.125 MiB | 0x  3E0000..0x1fffffff |
297  *-------------------------------------------------------
298  */
299
300 #define DFU_ALT_INFO_NAND_V2 \
301         "spl part 0 1;" \
302         "spl.backup1 part 0 2;" \
303         "spl.backup2 part 0 3;" \
304         "spl.backup3 part 0 4;" \
305         "u-boot part 0 5;" \
306         "u-boot.env0 part 0 6;" \
307         "u-boot.env1 part 0 7;" \
308         "rootfs partubi 0 9" \
309
310 #define CONFIG_ENV_SETTINGS_NAND_V2 \
311         "nand_active_ubi_vol=rootfs_a\0" \
312         "rootfs_name=rootfs\0" \
313         "kernel_name=uImage\0"\
314         "nand_root_fs_type=ubifs rootwait=1\0" \
315         "nand_args=run bootargs_defaults;" \
316                 "mtdparts default;" \
317                 "setenv ${partitionset_active} true;" \
318                 "if test -n ${A}; then " \
319                         "setenv nand_active_ubi_vol ${rootfs_name}_a;" \
320                 "fi;" \
321                 "if test -n ${B}; then " \
322                         "setenv nand_active_ubi_vol ${rootfs_name}_b;" \
323                 "fi;" \
324                 "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
325                 "ubi.mtd=rootfs,2048;" \
326                 "setenv bootargs ${bootargs} " \
327                 "root=${nand_root} noinitrd ${mtdparts} " \
328                 "rootfstype=${nand_root_fs_type} ip=${ip_method} " \
329                 "console=ttyMTD,mtdoops console=ttyO0,115200n8 mtdoops.mtddev" \
330                 "=mtdoops\0" \
331         COMMON_ENV_DFU_ARGS \
332                 "dfu_alt_info=" DFU_ALT_INFO_NAND_V2 "\0" \
333         COMMON_ENV_NAND_BOOT \
334                 "ubi part rootfs ${ubi_off};" \
335                 "ubifsmount ubi0:${nand_active_ubi_vol};" \
336                 "ubifsload ${kloadaddr} boot/${kernel_name};" \
337                 "ubifsload ${loadaddr} boot/${dtb_name}.dtb;" \
338                 "bootm ${kloadaddr} - ${loadaddr}\0" \
339         "nand_boot_backup=ubifsload ${loadaddr} boot/am335x-draco.dtb;" \
340                 "bootm ${kloadaddr} - ${loadaddr}\0" \
341         COMMON_ENV_NAND_CMDS
342
343 #define CONFIG_ENV_SETTINGS_V2 \
344                 COMMON_ENV_SETTINGS \
345         "net_args=run bootargs_defaults;" \
346                 "mtdparts default;" \
347                 "setenv bootfile ${project_dir}/kernel/uImage;" \
348                 "setenv bootdtb ${project_dir}/kernel/dtb;" \
349                 "setenv rootpath /home/projects/${project_dir}/rootfs;" \
350                 "setenv bootargs ${bootargs} " \
351                 "root=/dev/nfs ${mtdparts} " \
352                 "nfsroot=${serverip}:${rootpath},${nfsopts} " \
353                 "ip=${ipaddr}:${serverip}:" \
354                 "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
355         "net_nfs=echo Booting from network ...; " \
356                 "run net_args; " \
357                 "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
358                 "tftpboot ${loadaddr} ${serverip}:${bootdtb}; " \
359                 "bootm ${kloadaddr} - ${loadaddr}\0"
360
361 /*
362  * Variant 3 partition layout
363  * chip-size = 512MiB
364  *|         name |        size |           address area |
365  *-------------------------------------------------------
366  *|          spl | 128.000 KiB | 0x       0..0x   1ffff |
367  *|  spl.backup1 | 128.000 KiB | 0x   20000..0x   3ffff |
368  *|  spl.backup2 | 128.000 KiB | 0x   40000..0x   5ffff |
369  *|  spl.backup3 | 128.000 KiB | 0x   60000..0x   7ffff |
370  *|       u-boot |   1.875 MiB | 0x   80000..0x  25ffff |
371  *|   uboot.env0 | 512.000 KiB | 0x  260000..0x  2Dffff |
372  *|   uboot.env1 | 512.000 KiB | 0x  2E0000..0x  35ffff |
373  *|       rootfs | 300.000 MiB | 0x  360000..0x12f5ffff |
374  *|      mtdoops | 512.000 KiB | 0x12f60000..0x12fdffff |
375  *|configuration | 104.125 MiB | 0x12fe0000..0x1fffffff |
376  *-------------------------------------------------------
377
378                                         "mtdparts=omap2-nand.0:" \
379                                         "128k(spl),"            \
380                                         "128k(spl.backup1),"    \
381                                         "128k(spl.backup2),"    \
382                                         "128k(spl.backup3),"    \
383                                         "1920k(u-boot),"        \
384                                         "512k(u-boot.env0),"    \
385                                         "512k(u-boot.env1),"    \
386                                         "300m(rootfs),"         \
387                                         "512k(mtdoops),"        \
388                                         "-(configuration)"
389
390  */
391
392 #define CONFIG_SYS_NAND_BASE            (0x08000000)    /* physical address */
393                                                         /* to access nand at */
394                                                         /* CS0 */
395 #define CONFIG_SYS_MAX_NAND_DEVICE      1               /* Max number of NAND
396                                                            devices */
397 #if !defined(CONFIG_SPI_BOOT)
398 #define CONFIG_SYS_ENV_SECT_SIZE        (128 << 10)     /* 128 KiB */
399 #endif
400 #endif
401
402 #endif  /* ! __CONFIG_SIEMENS_AM33X_COMMON_H */