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