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