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