Merge tag 'ti-v2021.07-rc3' of https://source.denx.de/u-boot/custodians/u-boot-ti
[platform/kernel/u-boot.git] / include / configs / am64x_evm.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Configuration header file for K3 AM642 SoC family
4  *
5  * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
6  *      Keerthy <j-keerthy@ti.com>
7  */
8
9 #ifndef __CONFIG_AM642_EVM_H
10 #define __CONFIG_AM642_EVM_H
11
12 #include <linux/sizes.h>
13 #include <config_distro_bootcmd.h>
14 #include <environment/ti/mmc.h>
15
16 /* DDR Configuration */
17 #define CONFIG_SYS_SDRAM_BASE1          0x880000000
18
19 #ifdef CONFIG_SYS_K3_SPL_ATF
20 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "tispl.bin"
21 #endif
22
23 #ifndef CONFIG_CPU_V7R
24 #define CONFIG_SKIP_LOWLEVEL_INIT
25 #endif
26
27 #define CONFIG_SPL_MAX_SIZE             CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE
28 #if defined(CONFIG_TARGET_AM642_A53_EVM)
29 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SPL_TEXT_BASE + \
30                                         CONFIG_SYS_K3_NON_SECURE_MSRAM_SIZE - 4)
31 #else
32 /*
33  * Maximum size in memory allocated to the SPL BSS. Keep it as tight as
34  * possible (to allow the build to go through), as this directly affects
35  * our memory footprint. The less we use for BSS the more we have available
36  * for everything else.
37  */
38 #define CONFIG_SPL_BSS_MAX_SIZE         0x1000
39 /*
40  * Link BSS to be within SPL in a dedicated region located near the top of
41  * the MCU SRAM, this way making it available also before relocation. Note
42  * that we are not using the actual top of the MCU SRAM as there is a memory
43  * location filled in by the boot ROM that we want to read out without any
44  * interference from the C context.
45  */
46 #define CONFIG_SPL_BSS_START_ADDR       (CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX -\
47                                          CONFIG_SPL_BSS_MAX_SIZE)
48 /* Set the stack right below the SPL BSS section */
49 #define CONFIG_SYS_INIT_SP_ADDR         CONFIG_SPL_BSS_START_ADDR
50 /* Configure R5 SPL post-relocation malloc pool in DDR */
51 #define CONFIG_SYS_SPL_MALLOC_START    0x84000000
52 #define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_16M
53 #endif
54
55 #define PARTS_DEFAULT \
56         /* Linux partitions */ \
57         "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
58
59 /* U-Boot general configuration */
60 #define EXTRA_ENV_AM642_BOARD_SETTINGS                                  \
61         "findfdt="                                                      \
62                 "if test $board_name = am64x_gpevm; then " \
63                         "setenv fdtfile k3-am642-evm.dtb; fi; " \
64                 "if test $board_name = am64x_skevm; then " \
65                         "setenv fdtfile k3-am642-sk.dtb; fi;" \
66                 "if test $fdtfile = undefined; then " \
67                         "echo WARNING: Could not determine device tree to use; fi; \0" \
68         "name_kern=Image\0"                                             \
69         "console=ttyS2,115200n8\0"                                      \
70         "args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 "  \
71                 "${mtdparts}\0"                                         \
72         "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
73
74 /* U-Boot MMC-specific configuration */
75 #define EXTRA_ENV_AM642_BOARD_SETTINGS_MMC                              \
76         "boot=mmc\0"                                                    \
77         "mmcdev=1\0"                                                    \
78         "bootpart=1:2\0"                                                \
79         "bootdir=/boot\0"                                               \
80         "rd_spec=-\0"                                                   \
81         "init_mmc=run args_all args_mmc\0"                              \
82         "get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
83         "get_overlay_mmc="                                              \
84                 "fdt address ${fdtaddr};"                               \
85                 "fdt resize 0x100000;"                                  \
86                 "for overlay in $name_overlays;"                        \
87                 "do;"                                                   \
88                 "load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "    \
89                 "fdt apply ${dtboaddr};"                                \
90                 "done;\0"                                               \
91         "get_kern_mmc=load mmc ${bootpart} ${loadaddr} "                \
92                 "${bootdir}/${name_kern}\0"                             \
93         "get_fit_mmc=load mmc ${bootpart} ${addr_fit} "                 \
94                 "${bootdir}/${name_fit}\0"                              \
95         "partitions=" PARTS_DEFAULT
96
97 /* Incorporate settings into the U-Boot environment */
98 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
99         DEFAULT_LINUX_BOOT_ENV                                          \
100         DEFAULT_MMC_TI_ARGS                                             \
101         EXTRA_ENV_AM642_BOARD_SETTINGS                                  \
102         EXTRA_ENV_AM642_BOARD_SETTINGS_MMC
103
104 /* Now for the remaining common defines */
105 #include <configs/ti_armv7_common.h>
106
107 /* MMC ENV related defines */
108 #ifdef CONFIG_ENV_IS_IN_MMC
109 #define CONFIG_SYS_MMC_ENV_DEV          0
110 #define CONFIG_SYS_MMC_ENV_PART 1
111 #endif
112
113 #endif /* __CONFIG_AM642_EVM_H */