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