xref: /rk3399_rockchip-uboot/include/configs/ti_armv7_common.h (revision 437bc42e7ff930dc4d4bd47199d2e823cf84bf4c)
187694558STom Rini /*
287694558STom Rini  * ti_armv7_common.h
387694558STom Rini  *
487694558STom Rini  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
587694558STom Rini  *
687694558STom Rini  * SPDX-License-Identifier:	GPL-2.0+
787694558STom Rini  *
887694558STom Rini  * The various ARMv7 SoCs from TI all share a number of IP blocks when
987694558STom Rini  * implementing a given feature.  Rather than define these in every
1087694558STom Rini  * board or even SoC common file, we define a common file to be re-used
1187694558STom Rini  * in all cases.  While technically true that some of these details are
1287694558STom Rini  * configurable at the board design, they are common throughout SoC
1387694558STom Rini  * reference platforms as well as custom designs and become de facto
1487694558STom Rini  * standards.
1587694558STom Rini  */
1687694558STom Rini 
1787694558STom Rini #ifndef __CONFIG_TI_ARMV7_COMMON_H__
1887694558STom Rini #define __CONFIG_TI_ARMV7_COMMON_H__
1987694558STom Rini 
2087694558STom Rini /* Common define for many platforms. */
210dd54619STom Rini #define CONFIG_SYS_GENERIC_BOARD
2287694558STom Rini 
2387694558STom Rini /*
2487694558STom Rini  * We typically do not contain NOR flash.  In the cases where we do, we
2587694558STom Rini  * undefine this later.
2687694558STom Rini  */
2787694558STom Rini #define CONFIG_SYS_NO_FLASH
2887694558STom Rini 
2987694558STom Rini /* Support both device trees and ATAGs. */
3087694558STom Rini #define CONFIG_OF_LIBFDT
3187694558STom Rini #define CONFIG_CMDLINE_TAG
3287694558STom Rini #define CONFIG_SETUP_MEMORY_TAGS
3387694558STom Rini #define CONFIG_INITRD_TAG
3487694558STom Rini 
3587694558STom Rini /*
3687694558STom Rini  * Our DDR memory always starts at 0x80000000 and U-Boot shall have
3787694558STom Rini  * relocated itself to higher in memory by the time this value is used.
38fb3ad9bdSTom Rini  * However, set this to a 32MB offset to allow for easier Linux kernel
39fb3ad9bdSTom Rini  * booting as the default is often used as the kernel load address.
4087694558STom Rini  */
41fb3ad9bdSTom Rini #define CONFIG_SYS_LOAD_ADDR		0x82000000
42fb3ad9bdSTom Rini 
43fb3ad9bdSTom Rini /*
44fb3ad9bdSTom Rini  * We setup defaults based on constraints from the Linux kernel, which should
45fb3ad9bdSTom Rini  * also be safe elsewhere.  We have the default load at 32MB into DDR (for
46fb3ad9bdSTom Rini  * the kernel), FDT above 128MB (the maximum location for the end of the
47fb3ad9bdSTom Rini  * kernel), and the ramdisk 512KB above that (allowing for hopefully never
48fb3ad9bdSTom Rini  * seen large trees).  We say all of this must be within the first 256MB
49fb3ad9bdSTom Rini  * as that will normally be within the kernel lowmem and thus visible via
50fb3ad9bdSTom Rini  * bootm_size and we only run on platforms with 256MB or more of memory.
51fb3ad9bdSTom Rini  */
52fb3ad9bdSTom Rini #define DEFAULT_LINUX_BOOT_ENV \
53fb3ad9bdSTom Rini 	"loadaddr=0x82000000\0" \
54fb3ad9bdSTom Rini 	"kernel_addr_r=0x82000000\0" \
55fb3ad9bdSTom Rini 	"fdtaddr=0x88000000\0" \
56fb3ad9bdSTom Rini 	"fdt_addr_r=0x88000000\0" \
57fb3ad9bdSTom Rini 	"rdaddr=0x88080000\0" \
58fb3ad9bdSTom Rini 	"ramdisk_addr_r=0x88080000\0" \
59fb3ad9bdSTom Rini 	"bootm_size=0x10000000\0"
6087694558STom Rini 
6185d17be3SLokesh Vutla #define DEFAULT_MMC_TI_ARGS \
6285d17be3SLokesh Vutla 	"mmcdev=0\0" \
6385d17be3SLokesh Vutla 	"mmcrootfstype=ext4 rootwait\0" \
64*437bc42eSLokesh Vutla 	"finduuid=part uuid mmc 0:2 uuid\0" \
65*437bc42eSLokesh Vutla 	"args_mmc=run finduuid;setenv bootargs console=${console} " \
6685d17be3SLokesh Vutla 		"${optargs} " \
67*437bc42eSLokesh Vutla 		"root=PARTUUID=${uuid} rw " \
6885d17be3SLokesh Vutla 		"rootfstype=${mmcrootfstype}\0"
6985d17be3SLokesh Vutla 
7087694558STom Rini /*
7187694558STom Rini  * Default to a quick boot delay.
7287694558STom Rini  */
7387694558STom Rini #define CONFIG_BOOTDELAY		1
7487694558STom Rini 
7587694558STom Rini /*
76c6a7fce1SEnric Balletbò i Serra  * DDR information.  If the CONFIG_NR_DRAM_BANKS is not defined,
77c6a7fce1SEnric Balletbò i Serra  * we say (for simplicity) that we have 1 bank, always, even when
78c6a7fce1SEnric Balletbò i Serra  * we have more.  We always start at 0x80000000, and we place the
79c6a7fce1SEnric Balletbò i Serra  * initial stack pointer in our SRAM. Otherwise, we can define
80c6a7fce1SEnric Balletbò i Serra  * CONFIG_NR_DRAM_BANKS before including this file.
8187694558STom Rini  */
82c6a7fce1SEnric Balletbò i Serra #ifndef CONFIG_NR_DRAM_BANKS
8387694558STom Rini #define CONFIG_NR_DRAM_BANKS		1
84c6a7fce1SEnric Balletbò i Serra #endif
8587694558STom Rini #define CONFIG_SYS_SDRAM_BASE		0x80000000
86e07cff11SNishanth Menon 
87e07cff11SNishanth Menon #ifndef CONFIG_SYS_INIT_SP_ADDR
8887694558STom Rini #define CONFIG_SYS_INIT_SP_ADDR         (NON_SECURE_SRAM_END - \
8987694558STom Rini 						GENERATED_GBL_DATA_SIZE)
90e07cff11SNishanth Menon #endif
9187694558STom Rini 
9287694558STom Rini /* Timer information. */
9387694558STom Rini #define CONFIG_SYS_PTV			2	/* Divisor: 2^(PTV+1) => 8 */
9487694558STom Rini 
9587694558STom Rini /* I2C IP block */
9687694558STom Rini #define CONFIG_I2C
971dd44e5aSTom Rini #define CONFIG_CMD_I2C
986789e84eSHeiko Schocher #define CONFIG_SYS_I2C
9987694558STom Rini 
10087694558STom Rini /* MMC/SD IP block */
10187694558STom Rini #define CONFIG_MMC
10287694558STom Rini #define CONFIG_GENERIC_MMC
10387694558STom Rini #define CONFIG_CMD_MMC
10487694558STom Rini 
10587694558STom Rini /* McSPI IP block */
10687694558STom Rini #define CONFIG_SPI
1070fedc4a5STom Rini #define CONFIG_CMD_SPI
10887694558STom Rini 
10987694558STom Rini /* GPIO block */
110a1665ed1STom Rini #define CONFIG_CMD_GPIO
11187694558STom Rini 
11287694558STom Rini /*
11387694558STom Rini  * The following are general good-enough settings for U-Boot.  We set a
11487694558STom Rini  * large malloc pool as we generally have a lot of DDR, and we opt for
11587694558STom Rini  * function over binary size in the main portion of U-Boot as this is
11687694558STom Rini  * generally easily constrained later if needed.  We enable the config
11787694558STom Rini  * options that give us information in the environment about what board
11887694558STom Rini  * we are on so we do not need to rely on the command prompt.  We set a
11987694558STom Rini  * console baudrate of 115200 and use the default baud rate table.
12087694558STom Rini  */
121b648a789SPrzemyslaw Marczak #ifdef CONFIG_DFU_MMC
122b648a789SPrzemyslaw Marczak #define CONFIG_SYS_MALLOC_LEN	((16 << 20) + CONFIG_SYS_DFU_DATA_BUF_SIZE)
123b648a789SPrzemyslaw Marczak #else
1240e1612a7SSimon Glass #define CONFIG_SYS_MALLOC_LEN	(16 << 20)
125b648a789SPrzemyslaw Marczak #endif
12687694558STom Rini #define CONFIG_SYS_HUSH_PARSER
1271dd44e5aSTom Rini #define CONFIG_SYS_CONSOLE_INFO_QUIET
1281dd44e5aSTom Rini #define CONFIG_BAUDRATE			115200
1291dd44e5aSTom Rini #define CONFIG_ENV_VARS_UBOOT_CONFIG	/* Strongly encouraged */
1301dd44e5aSTom Rini #define CONFIG_ENV_OVERWRITE		/* Overwrite ethaddr / serial# */
1311dd44e5aSTom Rini 
1321dd44e5aSTom Rini /* As stated above, the following choices are optional. */
1331dd44e5aSTom Rini #define CONFIG_SYS_LONGHELP
13487694558STom Rini #define CONFIG_AUTO_COMPLETE
13587694558STom Rini #define CONFIG_CMDLINE_EDITING
13687694558STom Rini #define CONFIG_VERSION_VARIABLE
13787694558STom Rini 
13887694558STom Rini /* We set the max number of command args high to avoid HUSH bugs. */
13987694558STom Rini #define CONFIG_SYS_MAXARGS		64
14087694558STom Rini 
14187694558STom Rini /* Console I/O Buffer Size */
14287694558STom Rini #define CONFIG_SYS_CBSIZE		512
14387694558STom Rini /* Print Buffer Size */
14487694558STom Rini #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE \
14587694558STom Rini 					+ sizeof(CONFIG_SYS_PROMPT) + 16)
14687694558STom Rini /* Boot Argument Buffer Size */
14787694558STom Rini #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
14887694558STom Rini 
14987694558STom Rini /*
15087694558STom Rini  * When we have SPI, NOR or NAND flash we expect to be making use of
15187694558STom Rini  * mtdparts, both for ease of use in U-Boot and for passing information
15287694558STom Rini  * on to the Linux kernel.
15387694558STom Rini  */
154e07cff11SNishanth Menon #if defined(CONFIG_SPI_BOOT) || defined(CONFIG_NOR) || defined(CONFIG_NAND) || defined(CONFIG_NAND_DAVINCI)
15587694558STom Rini #define CONFIG_MTD_DEVICE		/* Required for mtdparts */
15687694558STom Rini #define CONFIG_CMD_MTDPARTS
15787694558STom Rini #endif
15887694558STom Rini 
15987694558STom Rini #define CONFIG_CMD_ASKENV
16087694558STom Rini #define CONFIG_CMD_BOOTZ
1616440b807SGuillaume GARDET #define CONFIG_SUPPORT_RAW_INITRD
16287694558STom Rini 
16387694558STom Rini /*
16487694558STom Rini  * Common filesystems support.  When we have removable storage we
16587694558STom Rini  * enabled a number of useful commands and support.
16687694558STom Rini  */
16787694558STom Rini #if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE)
16887694558STom Rini #define CONFIG_DOS_PARTITION
16987694558STom Rini #define CONFIG_CMD_FAT
17087694558STom Rini #define CONFIG_FAT_WRITE
17187694558STom Rini #define CONFIG_CMD_EXT2
17287694558STom Rini #define CONFIG_CMD_EXT4
17387694558STom Rini #define CONFIG_CMD_FS_GENERIC
1745b782e3fSNishanth Menon #define CONFIG_PARTITION_UUIDS
1755b782e3fSNishanth Menon #define CONFIG_CMD_PART
17687694558STom Rini #endif
17787694558STom Rini 
17887694558STom Rini /*
17987694558STom Rini  * Our platforms make use of SPL to initalize the hardware (primarily
18087694558STom Rini  * memory) enough for full U-Boot to be loaded.  We also support Falcon
18187694558STom Rini  * Mode so that the Linux kernel can be booted directly from SPL
18287694558STom Rini  * instead, if desired.  We make use of the general SPL framework found
18387694558STom Rini  * under common/spl/.  Given our generally common memory map, we set a
18487694558STom Rini  * number of related defaults and sizes here.
18587694558STom Rini  */
1867a5f71bcSSourav Poddar #if !defined(CONFIG_NOR_BOOT) && \
1877a5f71bcSSourav Poddar 	!(defined(CONFIG_QSPI_BOOT) && defined(CONFIG_AM43XX))
18887694558STom Rini #define CONFIG_SPL_FRAMEWORK
18987694558STom Rini #define CONFIG_SPL_OS_BOOT
19087694558STom Rini 
19187694558STom Rini /*
192865813edSTom Rini  * Place the image at the start of the ROM defined image space (per
193865813edSTom Rini  * CONFIG_SPL_TEXT_BASE and we limit our size to the ROM-defined
194865813edSTom Rini  * downloaded image area.  We initalize DRAM as soon as we can so that
195865813edSTom Rini  * we can place stack, malloc and BSS there.  We load U-Boot itself into
196865813edSTom Rini  * memory at 0x80800000 for legacy reasons (to not conflict with older
197865813edSTom Rini  * SPLs).  We have our BSS be placed 2MiB after this, to allow for the
198865813edSTom Rini  * default Linux kernel address of 0x80008000 to work with most sized
199865813edSTom Rini  * kernels, in the Falcon Mode case.  We have the SPL malloc pool at the
2007ae8350fSSimon Glass  * end of the BSS area.  We suggest that the stack be placed at 32MiB after
2017ae8350fSSimon Glass  * the start of DRAM to allow room for all of the above (handled in Kconfig).
20287694558STom Rini  */
203df4dbb5dSTom Rini #ifndef CONFIG_SYS_TEXT_BASE
20487694558STom Rini #define CONFIG_SYS_TEXT_BASE		0x80800000
205df4dbb5dSTom Rini #endif
206df4dbb5dSTom Rini #ifndef CONFIG_SPL_BSS_START_ADDR
20787694558STom Rini #define CONFIG_SPL_BSS_START_ADDR	0x80a00000
20887694558STom Rini #define CONFIG_SPL_BSS_MAX_SIZE		0x80000		/* 512 KB */
209df4dbb5dSTom Rini #endif
210df4dbb5dSTom Rini #ifndef CONFIG_SYS_SPL_MALLOC_START
21187694558STom Rini #define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SPL_BSS_START_ADDR + \
21287694558STom Rini 					 CONFIG_SPL_BSS_MAX_SIZE)
21387694558STom Rini #define CONFIG_SYS_SPL_MALLOC_SIZE	CONFIG_SYS_MALLOC_LEN
214df4dbb5dSTom Rini #endif
21587694558STom Rini 
21687694558STom Rini /* RAW SD card / eMMC locations. */
21787694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x300 /* address 0x60000 */
21887694558STom Rini #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	0x200 /* 256 KB */
21987694558STom Rini 
22087694558STom Rini /* FAT sd card locations. */
221e2ccdf89SPaul Kocialkowski #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
222205b4f33SGuillaume GARDET #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
22387694558STom Rini 
22487694558STom Rini #ifdef CONFIG_SPL_OS_BOOT
22587694558STom Rini /* FAT */
226205b4f33SGuillaume GARDET #define CONFIG_SPL_FS_LOAD_KERNEL_NAME		"uImage"
227205b4f33SGuillaume GARDET #define CONFIG_SPL_FS_LOAD_ARGS_NAME		"args"
22887694558STom Rini 
22987694558STom Rini /* RAW SD card / eMMC */
23087694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR	0x900	/* address 0x120000 */
23187694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR	0x80	/* address 0x10000 */
23287694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS	0x80	/* 64KiB */
23387694558STom Rini 
23487694558STom Rini /* spl export command */
23587694558STom Rini #define CONFIG_CMD_SPL
23687694558STom Rini #endif
23787694558STom Rini 
23887694558STom Rini #ifdef CONFIG_MMC
239a7142dd0STom Rini #define CONFIG_SPL_LIBDISK_SUPPORT
24087694558STom Rini #define CONFIG_SPL_MMC_SUPPORT
24187694558STom Rini #define CONFIG_SPL_FAT_SUPPORT
242bd2c4522SGuillaume GARDET #define CONFIG_SPL_EXT_SUPPORT
243bd2c4522SGuillaume GARDET #endif
244bd2c4522SGuillaume GARDET 
2457f2f44daSNishanth Menon #define CONFIG_SYS_THUMB_BUILD
24687694558STom Rini 
247a7142dd0STom Rini /* General parts of the framework, required. */
24887694558STom Rini #define CONFIG_SPL_I2C_SUPPORT
24987694558STom Rini #define CONFIG_SPL_LIBCOMMON_SUPPORT
25087694558STom Rini #define CONFIG_SPL_LIBGENERIC_SUPPORT
25187694558STom Rini #define CONFIG_SPL_SERIAL_SUPPORT
252d6fc0cefSPaul Kocialkowski #define CONFIG_SPL_POWER_SUPPORT
25387694558STom Rini #define CONFIG_SPL_GPIO_SUPPORT
25487694558STom Rini #define CONFIG_SPL_BOARD_INIT
25587694558STom Rini 
25687694558STom Rini #ifdef CONFIG_NAND
25787694558STom Rini #define CONFIG_SPL_NAND_SUPPORT
25887694558STom Rini #define CONFIG_SPL_NAND_BASE
25987694558STom Rini #define CONFIG_SPL_NAND_DRIVERS
26087694558STom Rini #define CONFIG_SPL_NAND_ECC
2616dd3b566STom Rini #define CONFIG_SPL_MTD_SUPPORT
26287694558STom Rini #define CONFIG_SYS_NAND_U_BOOT_START	CONFIG_SYS_TEXT_BASE
26387694558STom Rini #endif
26487694558STom Rini #endif /* !CONFIG_NOR_BOOT */
26587694558STom Rini 
2662320866bSCooper Jr., Franklin /* Generic Environment Variables */
2672320866bSCooper Jr., Franklin 
2682320866bSCooper Jr., Franklin #ifdef CONFIG_CMD_NET
2692320866bSCooper Jr., Franklin #define NETARGS \
2702320866bSCooper Jr., Franklin 	"static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
2712320866bSCooper Jr., Franklin 		"::off\0" \
2722320866bSCooper Jr., Franklin 	"nfsopts=nolock\0" \
2732320866bSCooper Jr., Franklin 	"rootpath=/export/rootfs\0" \
2742320866bSCooper Jr., Franklin 	"netloadimage=tftp ${loadaddr} ${bootfile}\0" \
2752320866bSCooper Jr., Franklin 	"netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \
2762320866bSCooper Jr., Franklin 	"netargs=setenv bootargs console=${console} " \
2772320866bSCooper Jr., Franklin 		"${optargs} " \
2782320866bSCooper Jr., Franklin 		"root=/dev/nfs " \
2792320866bSCooper Jr., Franklin 		"nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
2802320866bSCooper Jr., Franklin 		"ip=dhcp\0" \
2812320866bSCooper Jr., Franklin 	"netboot=echo Booting from network ...; " \
2822320866bSCooper Jr., Franklin 		"setenv autoload no; " \
2832320866bSCooper Jr., Franklin 		"dhcp; " \
2842320866bSCooper Jr., Franklin 		"run netloadimage; " \
2852320866bSCooper Jr., Franklin 		"run netloadfdt; " \
2862320866bSCooper Jr., Franklin 		"run netargs; " \
2872320866bSCooper Jr., Franklin 		"bootz ${loadaddr} - ${fdtaddr}\0"
28860480f81SCooper Jr., Franklin #else
28960480f81SCooper Jr., Franklin #define NETARGS ""
2902320866bSCooper Jr., Franklin #endif
2912320866bSCooper Jr., Franklin 
29287694558STom Rini #endif	/* __CONFIG_TI_ARMV7_COMMON_H__ */
293