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