f1bef40a7cad03f0ff660ebb458b9280a6540c4f
[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 #include <asm/arch/am64_hardware.h>
16 #include <environment/ti/k3_dfu.h>
17
18 /* DDR Configuration */
19 #define CONFIG_SYS_SDRAM_BASE1          0x880000000
20
21 #if defined(CONFIG_TARGET_AM642_A53_EVM)
22 #define CONFIG_SYS_INIT_SP_ADDR         (CONFIG_SPL_TEXT_BASE + SZ_4M)
23 #else
24 /*
25  * Link BSS to be within SPL in a dedicated region located near the top of
26  * the MCU SRAM, this way making it available also before relocation. Note
27  * that we are not using the actual top of the MCU SRAM as there is a memory
28  * location filled in by the boot ROM that we want to read out without any
29  * interference from the C context.
30  */
31 #define CONFIG_SPL_BSS_START_ADDR       (TI_SRAM_SCRATCH_BOARD_EEPROM_START -\
32                                          CONFIG_SPL_BSS_MAX_SIZE)
33 /* Set the stack right below the SPL BSS section */
34 #define CONFIG_SYS_INIT_SP_ADDR         CONFIG_SPL_BSS_START_ADDR
35 /* Configure R5 SPL post-relocation malloc pool in DDR */
36 #define CONFIG_SYS_SPL_MALLOC_START    0x84000000
37 #define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_16M
38 #endif
39
40 #define PARTS_DEFAULT \
41         /* Linux partitions */ \
42         "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
43
44 /* U-Boot general configuration */
45 #define EXTRA_ENV_AM642_BOARD_SETTINGS                                  \
46         "findfdt="                                                      \
47                 "if test $board_name = am64x_gpevm; then " \
48                         "setenv fdtfile k3-am642-evm.dtb; fi; " \
49                 "if test $board_name = am64x_skevm; then " \
50                         "setenv fdtfile k3-am642-sk.dtb; fi;" \
51                 "if test $fdtfile = undefined; then " \
52                         "echo WARNING: Could not determine device tree to use; fi; \0" \
53         "name_kern=Image\0"                                             \
54         "console=ttyS2,115200n8\0"                                      \
55         "args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 "  \
56                 "${mtdparts}\0"                                         \
57         "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
58
59 /* U-Boot MMC-specific configuration */
60 #define EXTRA_ENV_AM642_BOARD_SETTINGS_MMC                              \
61         "boot=mmc\0"                                                    \
62         "mmcdev=1\0"                                                    \
63         "bootpart=1:2\0"                                                \
64         "bootdir=/boot\0"                                               \
65         "rd_spec=-\0"                                                   \
66         "init_mmc=run args_all args_mmc\0"                              \
67         "get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
68         "get_overlay_mmc="                                              \
69                 "fdt address ${fdtaddr};"                               \
70                 "fdt resize 0x100000;"                                  \
71                 "for overlay in $name_overlays;"                        \
72                 "do;"                                                   \
73                 "load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "    \
74                 "fdt apply ${dtboaddr};"                                \
75                 "done;\0"                                               \
76         "get_kern_mmc=load mmc ${bootpart} ${loadaddr} "                \
77                 "${bootdir}/${name_kern}\0"                             \
78         "get_fit_mmc=load mmc ${bootpart} ${addr_fit} "                 \
79                 "${bootdir}/${name_fit}\0"                              \
80         "partitions=" PARTS_DEFAULT
81
82 #define EXTRA_ENV_AM642_BOARD_SETTING_USBMSC                            \
83         "args_usb=run finduuid;setenv bootargs console=${console} "     \
84                 "${optargs} "                                           \
85                 "root=PARTUUID=${uuid} rw "                             \
86                 "rootfstype=${mmcrootfstype}\0"                         \
87         "init_usb=run args_all args_usb\0"                              \
88         "get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
89         "get_overlay_usb="                                              \
90                 "fdt address ${fdtaddr};"                               \
91                 "fdt resize 0x100000;"                                  \
92                 "for overlay in $name_overlays;"                        \
93                 "do;"                                                   \
94                 "load usb ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "    \
95                 "fdt apply ${dtboaddr};"                                \
96                 "done;\0"                                               \
97         "get_kern_usb=load usb ${bootpart} ${loadaddr} "                \
98                 "${bootdir}/${name_kern}\0"                             \
99         "get_fit_usb=load usb ${bootpart} ${addr_fit} "                 \
100                 "${bootdir}/${name_fit}\0"                              \
101         "usbboot=setenv boot usb;"                                      \
102                 "setenv bootpart 0:2;"                                  \
103                 "usb start;"                                            \
104                 "run findfdt;"                                          \
105                 "run init_usb;"                                         \
106                 "run get_kern_usb;"                                     \
107                 "run get_fdt_usb;"                                      \
108                 "run run_kern\0"
109
110 #define EXTRA_ENV_DFUARGS \
111         DFU_ALT_INFO_MMC \
112         DFU_ALT_INFO_EMMC \
113         DFU_ALT_INFO_RAM \
114         DFU_ALT_INFO_OSPI
115
116 /* Incorporate settings into the U-Boot environment */
117 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
118         DEFAULT_LINUX_BOOT_ENV                                          \
119         DEFAULT_MMC_TI_ARGS                                             \
120         EXTRA_ENV_AM642_BOARD_SETTINGS                                  \
121         EXTRA_ENV_AM642_BOARD_SETTINGS_MMC                              \
122         EXTRA_ENV_DFUARGS                                               \
123         EXTRA_ENV_AM642_BOARD_SETTING_USBMSC
124
125 /* Now for the remaining common defines */
126 #include <configs/ti_armv7_common.h>
127
128 #define CONFIG_SYS_USB_FAT_BOOT_PARTITION 1
129
130 #endif /* __CONFIG_AM642_EVM_H */