b8a25e95f3661e4d81d2a6b1782feee546318abd
[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 /* Set the stack right below the SPL BSS section */
23 /* Configure R5 SPL post-relocation malloc pool in DDR */
24 #define CONFIG_SYS_SPL_MALLOC_START    0x84000000
25 #define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_16M
26 #endif
27
28 #define PARTS_DEFAULT \
29         /* Linux partitions */ \
30         "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
31
32 /* U-Boot general configuration */
33 #define EXTRA_ENV_AM642_BOARD_SETTINGS                                  \
34         "findfdt="                                                      \
35                 "if test $board_name = am64x_gpevm; then " \
36                         "setenv fdtfile k3-am642-evm.dtb; fi; " \
37                 "if test $board_name = am64x_skevm; then " \
38                         "setenv fdtfile k3-am642-sk.dtb; fi;" \
39                 "if test $fdtfile = undefined; then " \
40                         "echo WARNING: Could not determine device tree to use; fi; \0" \
41         "name_kern=Image\0"                                             \
42         "console=ttyS2,115200n8\0"                                      \
43         "args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 "  \
44                 "${mtdparts}\0"                                         \
45         "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
46
47 /* U-Boot MMC-specific configuration */
48 #define EXTRA_ENV_AM642_BOARD_SETTINGS_MMC                              \
49         "boot=mmc\0"                                                    \
50         "mmcdev=1\0"                                                    \
51         "bootpart=1:2\0"                                                \
52         "bootdir=/boot\0"                                               \
53         "rd_spec=-\0"                                                   \
54         "init_mmc=run args_all args_mmc\0"                              \
55         "get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
56         "get_overlay_mmc="                                              \
57                 "fdt address ${fdtaddr};"                               \
58                 "fdt resize 0x100000;"                                  \
59                 "for overlay in $name_overlays;"                        \
60                 "do;"                                                   \
61                 "load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "    \
62                 "fdt apply ${dtboaddr};"                                \
63                 "done;\0"                                               \
64         "get_kern_mmc=load mmc ${bootpart} ${loadaddr} "                \
65                 "${bootdir}/${name_kern}\0"                             \
66         "get_fit_mmc=load mmc ${bootpart} ${addr_fit} "                 \
67                 "${bootdir}/${name_fit}\0"                              \
68         "partitions=" PARTS_DEFAULT
69
70 #define EXTRA_ENV_AM642_BOARD_SETTING_USBMSC                            \
71         "args_usb=run finduuid;setenv bootargs console=${console} "     \
72                 "${optargs} "                                           \
73                 "root=PARTUUID=${uuid} rw "                             \
74                 "rootfstype=${mmcrootfstype}\0"                         \
75         "init_usb=run args_all args_usb\0"                              \
76         "get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
77         "get_overlay_usb="                                              \
78                 "fdt address ${fdtaddr};"                               \
79                 "fdt resize 0x100000;"                                  \
80                 "for overlay in $name_overlays;"                        \
81                 "do;"                                                   \
82                 "load usb ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "    \
83                 "fdt apply ${dtboaddr};"                                \
84                 "done;\0"                                               \
85         "get_kern_usb=load usb ${bootpart} ${loadaddr} "                \
86                 "${bootdir}/${name_kern}\0"                             \
87         "get_fit_usb=load usb ${bootpart} ${addr_fit} "                 \
88                 "${bootdir}/${name_fit}\0"                              \
89         "usbboot=setenv boot usb;"                                      \
90                 "setenv bootpart 0:2;"                                  \
91                 "usb start;"                                            \
92                 "run findfdt;"                                          \
93                 "run init_usb;"                                         \
94                 "run get_kern_usb;"                                     \
95                 "run get_fdt_usb;"                                      \
96                 "run run_kern\0"
97
98 #define EXTRA_ENV_DFUARGS \
99         DFU_ALT_INFO_MMC \
100         DFU_ALT_INFO_EMMC \
101         DFU_ALT_INFO_RAM \
102         DFU_ALT_INFO_OSPI
103
104 /* Incorporate settings into the U-Boot environment */
105 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
106         DEFAULT_LINUX_BOOT_ENV                                          \
107         DEFAULT_MMC_TI_ARGS                                             \
108         EXTRA_ENV_AM642_BOARD_SETTINGS                                  \
109         EXTRA_ENV_AM642_BOARD_SETTINGS_MMC                              \
110         EXTRA_ENV_DFUARGS                                               \
111         EXTRA_ENV_AM642_BOARD_SETTING_USBMSC
112
113 /* Now for the remaining common defines */
114 #include <configs/ti_armv7_common.h>
115
116 #define CONFIG_SYS_USB_FAT_BOOT_PARTITION 1
117
118 #endif /* __CONFIG_AM642_EVM_H */