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