1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * ti_armv7_common.h 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+ 7*4882a593Smuzhiyun * 8*4882a593Smuzhiyun * The various ARMv7 SoCs from TI all share a number of IP blocks when 9*4882a593Smuzhiyun * implementing a given feature. Rather than define these in every 10*4882a593Smuzhiyun * board or even SoC common file, we define a common file to be re-used 11*4882a593Smuzhiyun * in all cases. While technically true that some of these details are 12*4882a593Smuzhiyun * configurable at the board design, they are common throughout SoC 13*4882a593Smuzhiyun * reference platforms as well as custom designs and become de facto 14*4882a593Smuzhiyun * standards. 15*4882a593Smuzhiyun */ 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun #ifndef __CONFIG_TI_ARMV7_COMMON_H__ 18*4882a593Smuzhiyun #define __CONFIG_TI_ARMV7_COMMON_H__ 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun /* Support both device trees and ATAGs. */ 21*4882a593Smuzhiyun #define CONFIG_CMDLINE_TAG 22*4882a593Smuzhiyun #define CONFIG_SETUP_MEMORY_TAGS 23*4882a593Smuzhiyun #define CONFIG_INITRD_TAG 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun /* 26*4882a593Smuzhiyun * Our DDR memory always starts at 0x80000000 and U-Boot shall have 27*4882a593Smuzhiyun * relocated itself to higher in memory by the time this value is used. 28*4882a593Smuzhiyun * However, set this to a 32MB offset to allow for easier Linux kernel 29*4882a593Smuzhiyun * booting as the default is often used as the kernel load address. 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun #define CONFIG_SYS_LOAD_ADDR 0x82000000 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun /* 34*4882a593Smuzhiyun * We setup defaults based on constraints from the Linux kernel, which should 35*4882a593Smuzhiyun * also be safe elsewhere. We have the default load at 32MB into DDR (for 36*4882a593Smuzhiyun * the kernel), FDT above 128MB (the maximum location for the end of the 37*4882a593Smuzhiyun * kernel), and the ramdisk 512KB above that (allowing for hopefully never 38*4882a593Smuzhiyun * seen large trees). We say all of this must be within the first 256MB 39*4882a593Smuzhiyun * as that will normally be within the kernel lowmem and thus visible via 40*4882a593Smuzhiyun * bootm_size and we only run on platforms with 256MB or more of memory. 41*4882a593Smuzhiyun */ 42*4882a593Smuzhiyun #define DEFAULT_LINUX_BOOT_ENV \ 43*4882a593Smuzhiyun "loadaddr=0x82000000\0" \ 44*4882a593Smuzhiyun "kernel_addr_r=0x82000000\0" \ 45*4882a593Smuzhiyun "fdtaddr=0x88000000\0" \ 46*4882a593Smuzhiyun "fdt_addr_r=0x88000000\0" \ 47*4882a593Smuzhiyun "rdaddr=0x88080000\0" \ 48*4882a593Smuzhiyun "ramdisk_addr_r=0x88080000\0" \ 49*4882a593Smuzhiyun "scriptaddr=0x80000000\0" \ 50*4882a593Smuzhiyun "pxefile_addr_r=0x80100000\0" \ 51*4882a593Smuzhiyun "bootm_size=0x10000000\0" \ 52*4882a593Smuzhiyun "boot_fdt=try\0" 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun #define DEFAULT_FIT_TI_ARGS \ 55*4882a593Smuzhiyun "boot_fit=0\0" \ 56*4882a593Smuzhiyun "fit_loadaddr=0x87000000\0" \ 57*4882a593Smuzhiyun "fit_bootfile=fitImage\0" \ 58*4882a593Smuzhiyun "update_to_fit=setenv loadaddr ${fit_loadaddr}; setenv bootfile ${fit_bootfile}\0" \ 59*4882a593Smuzhiyun "loadfit=run args_mmc; bootm ${loadaddr}#${fdtfile};\0" \ 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun /* 62*4882a593Smuzhiyun * DDR information. If the CONFIG_NR_DRAM_BANKS is not defined, 63*4882a593Smuzhiyun * we say (for simplicity) that we have 1 bank, always, even when 64*4882a593Smuzhiyun * we have more. We always start at 0x80000000, and we place the 65*4882a593Smuzhiyun * initial stack pointer in our SRAM. Otherwise, we can define 66*4882a593Smuzhiyun * CONFIG_NR_DRAM_BANKS before including this file. 67*4882a593Smuzhiyun */ 68*4882a593Smuzhiyun #ifndef CONFIG_NR_DRAM_BANKS 69*4882a593Smuzhiyun #define CONFIG_NR_DRAM_BANKS 1 70*4882a593Smuzhiyun #endif 71*4882a593Smuzhiyun #define CONFIG_SYS_SDRAM_BASE 0x80000000 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun #ifndef CONFIG_SYS_INIT_SP_ADDR 74*4882a593Smuzhiyun #define CONFIG_SYS_INIT_SP_ADDR (NON_SECURE_SRAM_END - \ 75*4882a593Smuzhiyun GENERATED_GBL_DATA_SIZE) 76*4882a593Smuzhiyun #endif 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun /* Timer information. */ 79*4882a593Smuzhiyun #define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */ 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun /* 82*4882a593Smuzhiyun * Disable DM_* for SPL build and can be re-enabled after adding 83*4882a593Smuzhiyun * DM support in SPL 84*4882a593Smuzhiyun */ 85*4882a593Smuzhiyun #ifdef CONFIG_SPL_BUILD 86*4882a593Smuzhiyun #undef CONFIG_DM_I2C 87*4882a593Smuzhiyun #endif 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun /* I2C IP block */ 90*4882a593Smuzhiyun #define CONFIG_I2C 91*4882a593Smuzhiyun #ifndef CONFIG_DM_I2C 92*4882a593Smuzhiyun #define CONFIG_SYS_I2C 93*4882a593Smuzhiyun #else 94*4882a593Smuzhiyun /* 95*4882a593Smuzhiyun * Enable CONFIG_DM_I2C_COMPAT temporarily until all the i2c client 96*4882a593Smuzhiyun * devices are adopted to DM 97*4882a593Smuzhiyun */ 98*4882a593Smuzhiyun #define CONFIG_DM_I2C_COMPAT 99*4882a593Smuzhiyun #endif 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun /* 102*4882a593Smuzhiyun * The following are general good-enough settings for U-Boot. We set a 103*4882a593Smuzhiyun * large malloc pool as we generally have a lot of DDR, and we opt for 104*4882a593Smuzhiyun * function over binary size in the main portion of U-Boot as this is 105*4882a593Smuzhiyun * generally easily constrained later if needed. We enable the config 106*4882a593Smuzhiyun * options that give us information in the environment about what board 107*4882a593Smuzhiyun * we are on so we do not need to rely on the command prompt. We set a 108*4882a593Smuzhiyun * console baudrate of 115200 and use the default baud rate table. 109*4882a593Smuzhiyun */ 110*4882a593Smuzhiyun #define CONFIG_SYS_MALLOC_LEN SZ_32M 111*4882a593Smuzhiyun #define CONFIG_ENV_VARS_UBOOT_CONFIG /* Strongly encouraged */ 112*4882a593Smuzhiyun #define CONFIG_ENV_OVERWRITE /* Overwrite ethaddr / serial# */ 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun /* As stated above, the following choices are optional. */ 115*4882a593Smuzhiyun #define CONFIG_SYS_LONGHELP 116*4882a593Smuzhiyun #define CONFIG_AUTO_COMPLETE 117*4882a593Smuzhiyun #define CONFIG_CMDLINE_EDITING 118*4882a593Smuzhiyun 119*4882a593Smuzhiyun /* We set the max number of command args high to avoid HUSH bugs. */ 120*4882a593Smuzhiyun #define CONFIG_SYS_MAXARGS 64 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun /* Console I/O Buffer Size */ 123*4882a593Smuzhiyun #define CONFIG_SYS_CBSIZE 1024 124*4882a593Smuzhiyun /* Boot Argument Buffer Size */ 125*4882a593Smuzhiyun #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun /* 128*4882a593Smuzhiyun * When we have SPI, NOR or NAND flash we expect to be making use of 129*4882a593Smuzhiyun * mtdparts, both for ease of use in U-Boot and for passing information 130*4882a593Smuzhiyun * on to the Linux kernel. 131*4882a593Smuzhiyun */ 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun #define CONFIG_SUPPORT_RAW_INITRD 134*4882a593Smuzhiyun 135*4882a593Smuzhiyun /* 136*4882a593Smuzhiyun * Our platforms make use of SPL to initalize the hardware (primarily 137*4882a593Smuzhiyun * memory) enough for full U-Boot to be loaded. We make use of the general 138*4882a593Smuzhiyun * SPL framework found under common/spl/. Given our generally common memory 139*4882a593Smuzhiyun * map, we set a number of related defaults and sizes here. 140*4882a593Smuzhiyun */ 141*4882a593Smuzhiyun #if !defined(CONFIG_NOR_BOOT) && \ 142*4882a593Smuzhiyun !(defined(CONFIG_QSPI_BOOT) && defined(CONFIG_AM43XX)) 143*4882a593Smuzhiyun #define CONFIG_SPL_FRAMEWORK 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun /* 146*4882a593Smuzhiyun * We also support Falcon Mode so that the Linux kernel can be booted 147*4882a593Smuzhiyun * directly from SPL. This is not currently available on HS devices. 148*4882a593Smuzhiyun */ 149*4882a593Smuzhiyun 150*4882a593Smuzhiyun /* 151*4882a593Smuzhiyun * Place the image at the start of the ROM defined image space (per 152*4882a593Smuzhiyun * CONFIG_SPL_TEXT_BASE and we limit our size to the ROM-defined 153*4882a593Smuzhiyun * downloaded image area minus 1KiB for scratch space. We initalize DRAM as 154*4882a593Smuzhiyun * soon as we can so that we can place stack, malloc and BSS there. We load 155*4882a593Smuzhiyun * U-Boot itself into memory at 0x80800000 for legacy reasons (to not conflict 156*4882a593Smuzhiyun * with older SPLs). We have our BSS be placed 2MiB after this, to allow for 157*4882a593Smuzhiyun * the default Linux kernel address of 0x80008000 to work with most sized 158*4882a593Smuzhiyun * kernels, in the Falcon Mode case. We have the SPL malloc pool at the end 159*4882a593Smuzhiyun * of the BSS area. We suggest that the stack be placed at 32MiB after the 160*4882a593Smuzhiyun * start of DRAM to allow room for all of the above (handled in Kconfig). 161*4882a593Smuzhiyun */ 162*4882a593Smuzhiyun #ifndef CONFIG_SYS_TEXT_BASE 163*4882a593Smuzhiyun #define CONFIG_SYS_TEXT_BASE 0x80800000 164*4882a593Smuzhiyun #endif 165*4882a593Smuzhiyun #ifndef CONFIG_SPL_BSS_START_ADDR 166*4882a593Smuzhiyun #define CONFIG_SPL_BSS_START_ADDR 0x80a00000 167*4882a593Smuzhiyun #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */ 168*4882a593Smuzhiyun #endif 169*4882a593Smuzhiyun #ifndef CONFIG_SYS_SPL_MALLOC_START 170*4882a593Smuzhiyun #define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SPL_BSS_START_ADDR + \ 171*4882a593Smuzhiyun CONFIG_SPL_BSS_MAX_SIZE) 172*4882a593Smuzhiyun #define CONFIG_SYS_SPL_MALLOC_SIZE SZ_8M 173*4882a593Smuzhiyun #endif 174*4882a593Smuzhiyun #ifndef CONFIG_SPL_MAX_SIZE 175*4882a593Smuzhiyun #define CONFIG_SPL_MAX_SIZE (SRAM_SCRATCH_SPACE_ADDR - \ 176*4882a593Smuzhiyun CONFIG_SPL_TEXT_BASE) 177*4882a593Smuzhiyun #endif 178*4882a593Smuzhiyun 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun /* FAT sd card locations. */ 181*4882a593Smuzhiyun #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 182*4882a593Smuzhiyun #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun #ifdef CONFIG_SPL_OS_BOOT 185*4882a593Smuzhiyun /* FAT */ 186*4882a593Smuzhiyun #define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" 187*4882a593Smuzhiyun #define CONFIG_SPL_FS_LOAD_ARGS_NAME "args" 188*4882a593Smuzhiyun 189*4882a593Smuzhiyun /* RAW SD card / eMMC */ 190*4882a593Smuzhiyun #define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1700 /* address 0x2E0000 */ 191*4882a593Smuzhiyun #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x1500 /* address 0x2A0000 */ 192*4882a593Smuzhiyun #define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS 0x200 /* 256KiB */ 193*4882a593Smuzhiyun #endif 194*4882a593Smuzhiyun 195*4882a593Smuzhiyun /* General parts of the framework, required. */ 196*4882a593Smuzhiyun 197*4882a593Smuzhiyun #ifdef CONFIG_NAND 198*4882a593Smuzhiyun #define CONFIG_SPL_NAND_BASE 199*4882a593Smuzhiyun #define CONFIG_SPL_NAND_DRIVERS 200*4882a593Smuzhiyun #define CONFIG_SPL_NAND_ECC 201*4882a593Smuzhiyun #define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE 202*4882a593Smuzhiyun #endif 203*4882a593Smuzhiyun #endif /* !CONFIG_NOR_BOOT */ 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun /* Generic Environment Variables */ 206*4882a593Smuzhiyun 207*4882a593Smuzhiyun #ifdef CONFIG_CMD_NET 208*4882a593Smuzhiyun #define NETARGS \ 209*4882a593Smuzhiyun "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \ 210*4882a593Smuzhiyun "::off\0" \ 211*4882a593Smuzhiyun "nfsopts=nolock\0" \ 212*4882a593Smuzhiyun "rootpath=/export/rootfs\0" \ 213*4882a593Smuzhiyun "netloadimage=tftp ${loadaddr} ${bootfile}\0" \ 214*4882a593Smuzhiyun "netloadfdt=tftp ${fdtaddr} ${fdtfile}\0" \ 215*4882a593Smuzhiyun "netargs=setenv bootargs console=${console} " \ 216*4882a593Smuzhiyun "${optargs} " \ 217*4882a593Smuzhiyun "root=/dev/nfs " \ 218*4882a593Smuzhiyun "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \ 219*4882a593Smuzhiyun "ip=dhcp\0" \ 220*4882a593Smuzhiyun "netboot=echo Booting from network ...; " \ 221*4882a593Smuzhiyun "setenv autoload no; " \ 222*4882a593Smuzhiyun "dhcp; " \ 223*4882a593Smuzhiyun "run netloadimage; " \ 224*4882a593Smuzhiyun "run netloadfdt; " \ 225*4882a593Smuzhiyun "run netargs; " \ 226*4882a593Smuzhiyun "bootz ${loadaddr} - ${fdtaddr}\0" 227*4882a593Smuzhiyun #else 228*4882a593Smuzhiyun #define NETARGS "" 229*4882a593Smuzhiyun #endif 230*4882a593Smuzhiyun 231*4882a593Smuzhiyun #include <config_distro_defaults.h> 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun #endif /* __CONFIG_TI_ARMV7_COMMON_H__ */ 234