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