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