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