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