blob: 7c9bdc2d7d3ab486a1b9dee7cfc596c2c18ca1cd [file] [log] [blame]
Dave Gerlach3dc33f12021-04-23 11:27:42 -05001/* 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>
Aswath Govindraju832aed62021-06-04 22:00:38 +053015#include <asm/arch/am64_hardware.h>
Dave Gerlach3dc33f12021-04-23 11:27:42 -050016
17/* DDR Configuration */
18#define CONFIG_SYS_SDRAM_BASE1 0x880000000
19
20#ifdef CONFIG_SYS_K3_SPL_ATF
21#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "tispl.bin"
22#endif
23
24#ifndef CONFIG_CPU_V7R
25#define CONFIG_SKIP_LOWLEVEL_INIT
26#endif
27
28#define CONFIG_SPL_MAX_SIZE CONFIG_SYS_K3_MAX_DOWNLODABLE_IMAGE_SIZE
Lokesh Vutla31c47172021-05-06 16:44:53 +053029#if defined(CONFIG_TARGET_AM642_A53_EVM)
Dave Gerlach3dc33f12021-04-23 11:27:42 -050030#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SPL_TEXT_BASE + \
31 CONFIG_SYS_K3_NON_SECURE_MSRAM_SIZE - 4)
Lokesh Vutla31c47172021-05-06 16:44:53 +053032#else
Dave Gerlach3dc33f12021-04-23 11:27:42 -050033/*
34 * Maximum size in memory allocated to the SPL BSS. Keep it as tight as
35 * possible (to allow the build to go through), as this directly affects
36 * our memory footprint. The less we use for BSS the more we have available
37 * for everything else.
38 */
Lokesh Vutla9faad9b2021-05-06 16:44:54 +053039#define CONFIG_SPL_BSS_MAX_SIZE 0x1000
Dave Gerlach3dc33f12021-04-23 11:27:42 -050040/*
41 * Link BSS to be within SPL in a dedicated region located near the top of
42 * the MCU SRAM, this way making it available also before relocation. Note
43 * that we are not using the actual top of the MCU SRAM as there is a memory
44 * location filled in by the boot ROM that we want to read out without any
45 * interference from the C context.
46 */
Aswath Govindraju832aed62021-06-04 22:00:38 +053047#define CONFIG_SPL_BSS_START_ADDR (TI_SRAM_SCRATCH_BOARD_EEPROM_START -\
Dave Gerlach3dc33f12021-04-23 11:27:42 -050048 CONFIG_SPL_BSS_MAX_SIZE)
Lokesh Vutla31c47172021-05-06 16:44:53 +053049/* Set the stack right below the SPL BSS section */
50#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_BSS_START_ADDR
Dave Gerlach3dc33f12021-04-23 11:27:42 -050051/* Configure R5 SPL post-relocation malloc pool in DDR */
52#define CONFIG_SYS_SPL_MALLOC_START 0x84000000
53#define CONFIG_SYS_SPL_MALLOC_SIZE SZ_16M
Lokesh Vutla31c47172021-05-06 16:44:53 +053054#endif
Dave Gerlach3dc33f12021-04-23 11:27:42 -050055
56#define PARTS_DEFAULT \
57 /* Linux partitions */ \
58 "name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}\0"
59
60/* U-Boot general configuration */
61#define EXTRA_ENV_AM642_BOARD_SETTINGS \
Dave Gerlach3dc33f12021-04-23 11:27:42 -050062 "findfdt=" \
Lokesh Vutlab6587352021-05-06 16:44:55 +053063 "if test $board_name = am64x_gpevm; then " \
64 "setenv fdtfile k3-am642-evm.dtb; fi; " \
65 "if test $board_name = am64x_skevm; then " \
66 "setenv fdtfile k3-am642-sk.dtb; fi;" \
67 "if test $fdtfile = undefined; then " \
68 "echo WARNING: Could not determine device tree to use; fi; \0" \
Dave Gerlach3dc33f12021-04-23 11:27:42 -050069 "name_kern=Image\0" \
70 "console=ttyS2,115200n8\0" \
71 "args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 " \
72 "${mtdparts}\0" \
73 "run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}\0"
74
75/* U-Boot MMC-specific configuration */
76#define EXTRA_ENV_AM642_BOARD_SETTINGS_MMC \
77 "boot=mmc\0" \
78 "mmcdev=1\0" \
79 "bootpart=1:2\0" \
80 "bootdir=/boot\0" \
81 "rd_spec=-\0" \
82 "init_mmc=run args_all args_mmc\0" \
Lokesh Vutlab6587352021-05-06 16:44:55 +053083 "get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
Dave Gerlach3dc33f12021-04-23 11:27:42 -050084 "get_overlay_mmc=" \
85 "fdt address ${fdtaddr};" \
86 "fdt resize 0x100000;" \
87 "for overlay in $name_overlays;" \
88 "do;" \
89 "load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && " \
90 "fdt apply ${dtboaddr};" \
91 "done;\0" \
92 "get_kern_mmc=load mmc ${bootpart} ${loadaddr} " \
93 "${bootdir}/${name_kern}\0" \
94 "get_fit_mmc=load mmc ${bootpart} ${addr_fit} " \
95 "${bootdir}/${name_fit}\0" \
96 "partitions=" PARTS_DEFAULT
97
98/* Incorporate settings into the U-Boot environment */
99#define CONFIG_EXTRA_ENV_SETTINGS \
100 DEFAULT_LINUX_BOOT_ENV \
101 DEFAULT_MMC_TI_ARGS \
102 EXTRA_ENV_AM642_BOARD_SETTINGS \
103 EXTRA_ENV_AM642_BOARD_SETTINGS_MMC
104
105/* Now for the remaining common defines */
106#include <configs/ti_armv7_common.h>
107
108/* MMC ENV related defines */
109#ifdef CONFIG_ENV_IS_IN_MMC
110#define CONFIG_SYS_MMC_ENV_DEV 0
111#define CONFIG_SYS_MMC_ENV_PART 1
112#endif
113
114#endif /* __CONFIG_AM642_EVM_H */