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