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 /* 2187694558STom Rini * We typically do not contain NOR flash. In the cases where we do, we 2287694558STom Rini * undefine this later. 2387694558STom Rini */ 2487694558STom Rini #define CONFIG_SYS_NO_FLASH 2587694558STom Rini 2687694558STom Rini /* Support both device trees and ATAGs. */ 2787694558STom Rini #define CONFIG_CMDLINE_TAG 2887694558STom Rini #define CONFIG_SETUP_MEMORY_TAGS 2987694558STom Rini #define CONFIG_INITRD_TAG 3087694558STom Rini 3187694558STom Rini /* 3287694558STom Rini * Our DDR memory always starts at 0x80000000 and U-Boot shall have 3387694558STom Rini * relocated itself to higher in memory by the time this value is used. 34fb3ad9bdSTom Rini * However, set this to a 32MB offset to allow for easier Linux kernel 35fb3ad9bdSTom Rini * booting as the default is often used as the kernel load address. 3687694558STom Rini */ 37fb3ad9bdSTom Rini #define CONFIG_SYS_LOAD_ADDR 0x82000000 38fb3ad9bdSTom Rini 39fb3ad9bdSTom Rini /* 40fb3ad9bdSTom Rini * We setup defaults based on constraints from the Linux kernel, which should 41fb3ad9bdSTom Rini * also be safe elsewhere. We have the default load at 32MB into DDR (for 42fb3ad9bdSTom Rini * the kernel), FDT above 128MB (the maximum location for the end of the 43fb3ad9bdSTom Rini * kernel), and the ramdisk 512KB above that (allowing for hopefully never 44fb3ad9bdSTom Rini * seen large trees). We say all of this must be within the first 256MB 45fb3ad9bdSTom Rini * as that will normally be within the kernel lowmem and thus visible via 46fb3ad9bdSTom Rini * bootm_size and we only run on platforms with 256MB or more of memory. 47fb3ad9bdSTom Rini */ 48fb3ad9bdSTom Rini #define DEFAULT_LINUX_BOOT_ENV \ 49fb3ad9bdSTom Rini "loadaddr=0x82000000\0" \ 50fb3ad9bdSTom Rini "kernel_addr_r=0x82000000\0" \ 51fb3ad9bdSTom Rini "fdtaddr=0x88000000\0" \ 52fb3ad9bdSTom Rini "fdt_addr_r=0x88000000\0" \ 53fb3ad9bdSTom Rini "rdaddr=0x88080000\0" \ 54fb3ad9bdSTom Rini "ramdisk_addr_r=0x88080000\0" \ 557749b67fSSjoerd Simons "scriptaddr=0x80000000\0" \ 567749b67fSSjoerd Simons "pxefile_addr_r=0x80100000\0" \ 572a777884SLokesh Vutla "bootm_size=0x10000000\0" \ 582a777884SLokesh Vutla "boot_fdt=try\0" 5987694558STom Rini 6085d17be3SLokesh Vutla #define DEFAULT_MMC_TI_ARGS \ 6185d17be3SLokesh Vutla "mmcdev=0\0" \ 6285d17be3SLokesh Vutla "mmcrootfstype=ext4 rootwait\0" \ 6365eac4ccSB, Ravi "finduuid=part uuid mmc ${bootpart} uuid\0" \ 64437bc42eSLokesh Vutla "args_mmc=run finduuid;setenv bootargs console=${console} " \ 6585d17be3SLokesh Vutla "${optargs} " \ 66437bc42eSLokesh Vutla "root=PARTUUID=${uuid} rw " \ 6718c534bbSLokesh Vutla "rootfstype=${mmcrootfstype}\0" \ 6818c534bbSLokesh Vutla "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \ 6918c534bbSLokesh Vutla "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \ 7018c534bbSLokesh Vutla "source ${loadaddr}\0" \ 7118c534bbSLokesh Vutla "bootenvfile=uEnv.txt\0" \ 7218c534bbSLokesh Vutla "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \ 7318c534bbSLokesh Vutla "env import -t ${loadaddr} ${filesize}\0" \ 7418c534bbSLokesh Vutla "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \ 752a777884SLokesh Vutla "loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ 762a777884SLokesh Vutla "loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \ 7718c534bbSLokesh Vutla "envboot=mmc dev ${mmcdev}; " \ 7818c534bbSLokesh Vutla "if mmc rescan; then " \ 7918c534bbSLokesh Vutla "echo SD/MMC found on device ${mmcdev};" \ 8018c534bbSLokesh Vutla "if run loadbootscript; then " \ 8118c534bbSLokesh Vutla "run bootscript;" \ 8218c534bbSLokesh Vutla "else " \ 8318c534bbSLokesh Vutla "if run loadbootenv; then " \ 8418c534bbSLokesh Vutla "echo Loaded env from ${bootenvfile};" \ 8518c534bbSLokesh Vutla "run importbootenv;" \ 8618c534bbSLokesh Vutla "fi;" \ 8718c534bbSLokesh Vutla "if test -n $uenvcmd; then " \ 8818c534bbSLokesh Vutla "echo Running uenvcmd ...;" \ 8918c534bbSLokesh Vutla "run uenvcmd;" \ 9018c534bbSLokesh Vutla "fi;" \ 9118c534bbSLokesh Vutla "fi;" \ 9218c534bbSLokesh Vutla "fi;\0" \ 932a777884SLokesh Vutla "mmcloados=run args_mmc; " \ 942a777884SLokesh Vutla "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ 952a777884SLokesh Vutla "if run loadfdt; then " \ 962a777884SLokesh Vutla "bootz ${loadaddr} - ${fdtaddr}; " \ 972a777884SLokesh Vutla "else " \ 982a777884SLokesh Vutla "if test ${boot_fdt} = try; then " \ 992a777884SLokesh Vutla "bootz; " \ 1002a777884SLokesh Vutla "else " \ 1012a777884SLokesh Vutla "echo WARN: Cannot load the DT; " \ 1022a777884SLokesh Vutla "fi; " \ 1032a777884SLokesh Vutla "fi; " \ 1042a777884SLokesh Vutla "else " \ 1052a777884SLokesh Vutla "bootz; " \ 1062a777884SLokesh Vutla "fi;\0" \ 1072a777884SLokesh Vutla "mmcboot=mmc dev ${mmcdev}; " \ 1082a777884SLokesh Vutla "setenv devnum ${mmcdev}; " \ 1092a777884SLokesh Vutla "setenv devtype mmc; " \ 1102a777884SLokesh Vutla "if mmc rescan; then " \ 1112a777884SLokesh Vutla "echo SD/MMC found on device ${mmcdev};" \ 1122a777884SLokesh Vutla "if run loadimage; then " \ 1131e93cc84SLokesh Vutla "if test ${boot_fit} -eq 1; then " \ 1141e93cc84SLokesh Vutla "run loadfit; " \ 1151e93cc84SLokesh Vutla "else " \ 1162a777884SLokesh Vutla "run mmcloados;" \ 1172a777884SLokesh Vutla "fi;" \ 1181e93cc84SLokesh Vutla "fi;" \ 1192a777884SLokesh Vutla "fi;\0" \ 12085d17be3SLokesh Vutla 1211e93cc84SLokesh Vutla #define DEFAULT_FIT_TI_ARGS \ 1221e93cc84SLokesh Vutla "boot_fit=0\0" \ 1231e93cc84SLokesh Vutla "fit_loadaddr=0x88000000\0" \ 1241e93cc84SLokesh Vutla "fit_bootfile=fitImage.itb\0" \ 1251e93cc84SLokesh Vutla "update_to_fit=setenv loadaddr ${fit_loadaddr}; setenv bootfile ${fit_bootfile}\0" \ 1261e93cc84SLokesh Vutla "args_fit=setenv bootargs console=${console} \0" \ 1271e93cc84SLokesh Vutla "loadfit=run args_fit; bootm ${loadaddr}:kernel@1 " \ 1281e93cc84SLokesh Vutla "${loadaddr}:ramdisk@1 ${loadaddr}:${fdtfile};\0" \ 1291e93cc84SLokesh Vutla 13087694558STom Rini /* 131c6a7fce1SEnric Balletbò i Serra * DDR information. If the CONFIG_NR_DRAM_BANKS is not defined, 132c6a7fce1SEnric Balletbò i Serra * we say (for simplicity) that we have 1 bank, always, even when 133c6a7fce1SEnric Balletbò i Serra * we have more. We always start at 0x80000000, and we place the 134c6a7fce1SEnric Balletbò i Serra * initial stack pointer in our SRAM. Otherwise, we can define 135c6a7fce1SEnric Balletbò i Serra * CONFIG_NR_DRAM_BANKS before including this file. 13687694558STom Rini */ 137c6a7fce1SEnric Balletbò i Serra #ifndef CONFIG_NR_DRAM_BANKS 13887694558STom Rini #define CONFIG_NR_DRAM_BANKS 1 139c6a7fce1SEnric Balletbò i Serra #endif 14087694558STom Rini #define CONFIG_SYS_SDRAM_BASE 0x80000000 141e07cff11SNishanth Menon 142e07cff11SNishanth Menon #ifndef CONFIG_SYS_INIT_SP_ADDR 14387694558STom Rini #define CONFIG_SYS_INIT_SP_ADDR (NON_SECURE_SRAM_END - \ 14487694558STom Rini GENERATED_GBL_DATA_SIZE) 145e07cff11SNishanth Menon #endif 14687694558STom Rini 14787694558STom Rini /* Timer information. */ 14887694558STom Rini #define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ 14987694558STom Rini 150eff6b773SMugunthan V N /* 151eff6b773SMugunthan V N * Disable DM_* for SPL build and can be re-enabled after adding 152eff6b773SMugunthan V N * DM support in SPL 153eff6b773SMugunthan V N */ 154eff6b773SMugunthan V N #ifdef CONFIG_SPL_BUILD 155eff6b773SMugunthan V N #undef CONFIG_DM_I2C 156eff6b773SMugunthan V N #endif 157eff6b773SMugunthan V N 15887694558STom Rini /* I2C IP block */ 15987694558STom Rini #define CONFIG_I2C 160c50f2610SMugunthan V N #ifndef CONFIG_DM_I2C 1616789e84eSHeiko Schocher #define CONFIG_SYS_I2C 162c50f2610SMugunthan V N #else 163c50f2610SMugunthan V N /* 164c50f2610SMugunthan V N * Enable CONFIG_DM_I2C_COMPAT temporarily until all the i2c client 165c50f2610SMugunthan V N * devices are adopted to DM 166c50f2610SMugunthan V N */ 167c50f2610SMugunthan V N #define CONFIG_DM_I2C_COMPAT 168c50f2610SMugunthan V N #endif 16987694558STom Rini 17087694558STom Rini /* MMC/SD IP block */ 17187694558STom Rini #define CONFIG_MMC 17287694558STom Rini #define CONFIG_GENERIC_MMC 17387694558STom Rini 17487694558STom Rini /* McSPI IP block */ 17587694558STom Rini #define CONFIG_SPI 17687694558STom Rini 17787694558STom Rini /* GPIO block */ 17887694558STom Rini 17987694558STom Rini /* 18087694558STom Rini * The following are general good-enough settings for U-Boot. We set a 18187694558STom Rini * large malloc pool as we generally have a lot of DDR, and we opt for 18287694558STom Rini * function over binary size in the main portion of U-Boot as this is 18387694558STom Rini * generally easily constrained later if needed. We enable the config 18487694558STom Rini * options that give us information in the environment about what board 18587694558STom Rini * we are on so we do not need to rely on the command prompt. We set a 18687694558STom Rini * console baudrate of 115200 and use the default baud rate table. 18787694558STom Rini */ 1885e61b0dfSTom Rini #define CONFIG_SYS_MALLOC_LEN SZ_32M 1891dd44e5aSTom Rini #define CONFIG_BAUDRATE 115200 1901dd44e5aSTom Rini #define CONFIG_ENV_VARS_UBOOT_CONFIG /* Strongly encouraged */ 1911dd44e5aSTom Rini #define CONFIG_ENV_OVERWRITE /* Overwrite ethaddr / serial# */ 1921dd44e5aSTom Rini 1931dd44e5aSTom Rini /* As stated above, the following choices are optional. */ 1941dd44e5aSTom Rini #define CONFIG_SYS_LONGHELP 19587694558STom Rini #define CONFIG_AUTO_COMPLETE 19687694558STom Rini #define CONFIG_CMDLINE_EDITING 19787694558STom Rini 19887694558STom Rini /* We set the max number of command args high to avoid HUSH bugs. */ 19987694558STom Rini #define CONFIG_SYS_MAXARGS 64 20087694558STom Rini 20187694558STom Rini /* Console I/O Buffer Size */ 202*b9daed8aSLokesh Vutla #define CONFIG_SYS_CBSIZE 1024 20387694558STom Rini /* Print Buffer Size */ 20487694558STom Rini #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE \ 20587694558STom Rini + sizeof(CONFIG_SYS_PROMPT) + 16) 20687694558STom Rini /* Boot Argument Buffer Size */ 20787694558STom Rini #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE 20887694558STom Rini 20987694558STom Rini /* 21087694558STom Rini * When we have SPI, NOR or NAND flash we expect to be making use of 21187694558STom Rini * mtdparts, both for ease of use in U-Boot and for passing information 21287694558STom Rini * on to the Linux kernel. 21387694558STom Rini */ 214e07cff11SNishanth Menon #if defined(CONFIG_SPI_BOOT) || defined(CONFIG_NOR) || defined(CONFIG_NAND) || defined(CONFIG_NAND_DAVINCI) 21587694558STom Rini #define CONFIG_MTD_DEVICE /* Required for mtdparts */ 21687694558STom Rini #define CONFIG_CMD_MTDPARTS 21787694558STom Rini #endif 21887694558STom Rini 2196440b807SGuillaume GARDET #define CONFIG_SUPPORT_RAW_INITRD 22087694558STom Rini 22187694558STom Rini /* 22287694558STom Rini * Common filesystems support. When we have removable storage we 22387694558STom Rini * enabled a number of useful commands and support. 22487694558STom Rini */ 22587694558STom Rini #if defined(CONFIG_MMC) || defined(CONFIG_USB_STORAGE) 22687694558STom Rini #define CONFIG_DOS_PARTITION 22787694558STom Rini #define CONFIG_FAT_WRITE 2285b782e3fSNishanth Menon #define CONFIG_PARTITION_UUIDS 2295b782e3fSNishanth Menon #define CONFIG_CMD_PART 23087694558STom Rini #endif 23187694558STom Rini 23287694558STom Rini /* 23387694558STom Rini * Our platforms make use of SPL to initalize the hardware (primarily 234e95b9b44SAndrew F. Davis * memory) enough for full U-Boot to be loaded. We make use of the general 235e95b9b44SAndrew F. Davis * SPL framework found under common/spl/. Given our generally common memory 236e95b9b44SAndrew F. Davis * map, we set a number of related defaults and sizes here. 23787694558STom Rini */ 2387a5f71bcSSourav Poddar #if !defined(CONFIG_NOR_BOOT) && \ 2397a5f71bcSSourav Poddar !(defined(CONFIG_QSPI_BOOT) && defined(CONFIG_AM43XX)) 24087694558STom Rini #define CONFIG_SPL_FRAMEWORK 241e95b9b44SAndrew F. Davis 242e95b9b44SAndrew F. Davis /* 243e95b9b44SAndrew F. Davis * We also support Falcon Mode so that the Linux kernel can be booted 244e95b9b44SAndrew F. Davis * directly from SPL. This is not currently available on HS devices. 245e95b9b44SAndrew F. Davis */ 24687694558STom Rini 24787694558STom Rini /* 248865813edSTom Rini * Place the image at the start of the ROM defined image space (per 249865813edSTom Rini * CONFIG_SPL_TEXT_BASE and we limit our size to the ROM-defined 250fa2f81b0STom Rini * downloaded image area minus 1KiB for scratch space. We initalize DRAM as 251fa2f81b0STom Rini * soon as we can so that we can place stack, malloc and BSS there. We load 252fa2f81b0STom Rini * U-Boot itself into memory at 0x80800000 for legacy reasons (to not conflict 253fa2f81b0STom Rini * with older SPLs). We have our BSS be placed 2MiB after this, to allow for 254fa2f81b0STom Rini * the default Linux kernel address of 0x80008000 to work with most sized 255fa2f81b0STom Rini * kernels, in the Falcon Mode case. We have the SPL malloc pool at the end 256fa2f81b0STom Rini * of the BSS area. We suggest that the stack be placed at 32MiB after the 257fa2f81b0STom Rini * start of DRAM to allow room for all of the above (handled in Kconfig). 25887694558STom Rini */ 259df4dbb5dSTom Rini #ifndef CONFIG_SYS_TEXT_BASE 26087694558STom Rini #define CONFIG_SYS_TEXT_BASE 0x80800000 261df4dbb5dSTom Rini #endif 262df4dbb5dSTom Rini #ifndef CONFIG_SPL_BSS_START_ADDR 26387694558STom Rini #define CONFIG_SPL_BSS_START_ADDR 0x80a00000 26487694558STom Rini #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ 265df4dbb5dSTom Rini #endif 266df4dbb5dSTom Rini #ifndef CONFIG_SYS_SPL_MALLOC_START 26787694558STom Rini #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SPL_BSS_START_ADDR + \ 26887694558STom Rini CONFIG_SPL_BSS_MAX_SIZE) 2695e61b0dfSTom Rini #define CONFIG_SYS_SPL_MALLOC_SIZE SZ_8M 270df4dbb5dSTom Rini #endif 271fa2f81b0STom Rini #ifndef CONFIG_SPL_MAX_SIZE 272fa2f81b0STom Rini #define CONFIG_SPL_MAX_SIZE (SRAM_SCRATCH_SPACE_ADDR - \ 273fa2f81b0STom Rini CONFIG_SPL_TEXT_BASE) 274fa2f81b0STom Rini #endif 275fa2f81b0STom Rini 27687694558STom Rini 27787694558STom Rini /* FAT sd card locations. */ 278e2ccdf89SPaul Kocialkowski #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 279205b4f33SGuillaume GARDET #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" 28087694558STom Rini 28187694558STom Rini #ifdef CONFIG_SPL_OS_BOOT 28287694558STom Rini /* FAT */ 283205b4f33SGuillaume GARDET #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" 284205b4f33SGuillaume GARDET #define CONFIG_SPL_FS_LOAD_ARGS_NAME "args" 28587694558STom Rini 28687694558STom Rini /* RAW SD card / eMMC */ 28787694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x900 /* address 0x120000 */ 28887694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x80 /* address 0x10000 */ 28987694558STom Rini #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x80 /* 64KiB */ 29087694558STom Rini 29187694558STom Rini /* spl export command */ 29287694558STom Rini #define CONFIG_CMD_SPL 29387694558STom Rini #endif 29487694558STom Rini 2957f2f44daSNishanth Menon #define CONFIG_SYS_THUMB_BUILD 29687694558STom Rini 297a7142dd0STom Rini /* General parts of the framework, required. */ 29887694558STom Rini #define CONFIG_SPL_BOARD_INIT 29987694558STom Rini 30087694558STom Rini #ifdef CONFIG_NAND 30187694558STom Rini #define CONFIG_SPL_NAND_BASE 30287694558STom Rini #define CONFIG_SPL_NAND_DRIVERS 30387694558STom Rini #define CONFIG_SPL_NAND_ECC 30487694558STom Rini #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE 30587694558STom Rini #endif 30687694558STom Rini #endif /* !CONFIG_NOR_BOOT */ 30787694558STom Rini 3082320866bSCooper Jr., Franklin /* Generic Environment Variables */ 3092320866bSCooper Jr., Franklin 3102320866bSCooper Jr., Franklin #ifdef CONFIG_CMD_NET 3112320866bSCooper Jr., Franklin #define NETARGS \ 3122320866bSCooper Jr., Franklin "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ 3132320866bSCooper Jr., Franklin "::off\0" \ 3142320866bSCooper Jr., Franklin "nfsopts=nolock\0" \ 3152320866bSCooper Jr., Franklin "rootpath=/export/rootfs\0" \ 3162320866bSCooper Jr., Franklin "netloadimage=tftp ${loadaddr} ${bootfile}\0" \ 3172320866bSCooper Jr., Franklin "netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \ 3182320866bSCooper Jr., Franklin "netargs=setenv bootargs console=${console} " \ 3192320866bSCooper Jr., Franklin "${optargs} " \ 3202320866bSCooper Jr., Franklin "root=/dev/nfs " \ 3212320866bSCooper Jr., Franklin "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ 3222320866bSCooper Jr., Franklin "ip=dhcp\0" \ 3232320866bSCooper Jr., Franklin "netboot=echo Booting from network ...; " \ 3242320866bSCooper Jr., Franklin "setenv autoload no; " \ 3252320866bSCooper Jr., Franklin "dhcp; " \ 3262320866bSCooper Jr., Franklin "run netloadimage; " \ 3272320866bSCooper Jr., Franklin "run netloadfdt; " \ 3282320866bSCooper Jr., Franklin "run netargs; " \ 3292320866bSCooper Jr., Franklin "bootz ${loadaddr} - ${fdtaddr}\0" 33060480f81SCooper Jr., Franklin #else 33160480f81SCooper Jr., Franklin #define NETARGS "" 3322320866bSCooper Jr., Franklin #endif 3332320866bSCooper Jr., Franklin 334755324c4SMatwey V. Kornilov #include <config_distro_defaults.h> 335755324c4SMatwey V. Kornilov 33687694558STom Rini #endif /* __CONFIG_TI_ARMV7_COMMON_H__ */ 337