Convert CONFIG_SYS_SPL_MALLOC_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  /* Platform/Board specific defs */
42 #define CONFIG_SYS_TIMERBASE            0x48040000      /* Use Timer2 */
43
44 /* NS16550 Configuration */
45 #define CONFIG_SYS_NS16550_SERIAL
46 #define CONFIG_SYS_NS16550_CLK          (48000000)
47 #define CONFIG_SYS_NS16550_COM1         0x44e09000
48 #define CONFIG_SYS_NS16550_COM4         0x481a6000
49
50
51 /* I2C Configuration */
52
53 /* Defines for SPL */
54
55 #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
72 /*
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  */
78
79 /*
80  * Since SPL did pll and ddr initialization for us,
81  * we don't need to do it twice.
82  */
83
84 #ifndef CONFIG_SPL_BUILD
85
86 /* USB DRACO ID as default */
87 #define CONFIG_USBD_HS
88
89 /* USB Device Firmware Update support */
90 #define DFU_MANIFEST_POLL_TIMEOUT       25000
91
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  */
106
107 /* NAND support */
108 #ifdef CONFIG_MTD_RAW_NAND
109 /* UBI Support */
110
111 /* Commen environment */
112 #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" \
151         "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
176 /*
177  * Variant 1 partition layout
178  * 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  *-------------------------------------------------------
192
193                                         "mtdparts=omap2-nand.0:" \
194                                         "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)"
204  */
205
206 #define DFU_ALT_INFO_NAND_V1 \
207         "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
217 #define CONFIG_ENV_SETTINGS_NAND_V1 \
218         "nand_active_ubi_vol=rootfs_a\0" \
219         "nand_active_ubi_vol_A=rootfs_a\0" \
220         "nand_active_ubi_vol_B=rootfs_b\0" \
221         "nand_root_fs_type=ubifs rootwait=1\0" \
222         "nand_src_addr=0x280000\0" \
223         "nand_src_addr_A=0x280000\0" \
224         "nand_src_addr_B=0x780000\0" \
225         "nand_args=run bootargs_defaults;" \
226                 "mtdparts default;" \
227                 "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};" \
231                 "fi;" \
232                 "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};" \
235                 "fi;" \
236                 "setenv nand_root ubi0:${nand_active_ubi_vol} rw " \
237                 "ubi.mtd=9,${ubi_off};" \
238                 "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" \
243         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 \
252         "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} " \
259                 "ip=${ipaddr}:${serverip}:" \
260                 "${gatewayip}:${netmask}:${hostname}:eth0:off\0" \
261         "net_nfs=echo Booting from network ...; " \
262                 "run net_args; " \
263                 "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
264                 "bootm ${kloadaddr}\0"
265
266 /*
267  * Variant 2 partition layout (default)
268  * chip-size = 256MiB or 512 MiB
269  *|         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 |
278  *|      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 |
281  *-------------------------------------------------------
282  */
283
284 #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;" \
292         "rootfs partubi 0 9" \
293
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;" \
304                 "fi;" \
305                 "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 " \
309                 "ubi.mtd=rootfs,2048;" \
310                 "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 \
318                 "ubi part rootfs ${ubi_off};" \
319                 "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" \
339         "net_nfs=echo Booting from network ...; " \
340                 "run net_args; " \
341                 "tftpboot ${kloadaddr} ${serverip}:${bootfile}; " \
342                 "tftpboot ${loadaddr} ${serverip}:${bootdtb}; " \
343                 "bootm ${kloadaddr} - ${loadaddr}\0"
344
345 /*
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  *-------------------------------------------------------
361
362                                         "mtdparts=omap2-nand.0:" \
363                                         "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
374  */
375
376 #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)
382 #define CONFIG_SYS_ENV_SECT_SIZE        (128 << 10)     /* 128 KiB */
383 #endif
384 #endif
385
386 #endif  /* ! __CONFIG_SIEMENS_AM33X_COMMON_H */