1 /* 2 * (C) Copyright 2010-2012 3 * NVIDIA Corporation <www.nvidia.com> 4 * 5 * See file CREDITS for list of people who contributed to this 6 * project. 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License as 10 * published by the Free Software Foundation; either version 2 of 11 * the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 * MA 02111-1307 USA 22 */ 23 24 #ifndef __TEGRA_COMMON_POST_H 25 #define __TEGRA_COMMON_POST_H 26 27 #ifdef CONFIG_BOOTCOMMAND 28 29 #define BOOTCMDS_COMMON "" 30 31 #else 32 33 #ifdef CONFIG_CMD_MMC 34 #define BOOTCMDS_MMC \ 35 "mmc_boot=" \ 36 "setenv devtype mmc; " \ 37 "if mmc dev ${devnum}; then " \ 38 "run scan_boot; " \ 39 "fi\0" \ 40 "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \ 41 "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0" 42 #define BOOT_TARGETS_MMC "mmc1 mmc0" 43 #else 44 #define BOOTCMDS_MMC "" 45 #define BOOT_TARGETS_MMC "" 46 #endif 47 48 #ifdef CONFIG_CMD_USB 49 #define BOOTCMD_INIT_USB "run usb_init; " 50 #define BOOTCMDS_USB \ 51 "usb_init=" \ 52 "if ${usb_need_init}; then " \ 53 "set usb_need_init false; " \ 54 "usb start 0; " \ 55 "fi\0" \ 56 \ 57 "usb_boot=" \ 58 "setenv devtype usb; " \ 59 BOOTCMD_INIT_USB \ 60 "if usb dev ${devnum}; then " \ 61 "run scan_boot; " \ 62 "fi\0" \ 63 \ 64 "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" 65 #define BOOT_TARGETS_USB "usb0" 66 #else 67 #define BOOTCMD_INIT_USB "" 68 #define BOOTCMDS_USB "" 69 #define BOOT_TARGETS_USB "" 70 #endif 71 72 #ifdef CONFIG_CMD_DHCP 73 #define BOOTCMDS_DHCP \ 74 "bootcmd_dhcp=" \ 75 BOOTCMD_INIT_USB \ 76 "if dhcp ${scriptaddr} boot.scr.uimg; then "\ 77 "source ${scriptaddr}; " \ 78 "fi\0" 79 #define BOOT_TARGETS_DHCP "dhcp" 80 #else 81 #define BOOTCMDS_DHCP "" 82 #define BOOT_TARGETS_DHCP "" 83 #endif 84 85 #define BOOTCMDS_COMMON \ 86 "rootpart=1\0" \ 87 \ 88 "script_boot=" \ 89 "if load ${devtype} ${devnum}:${rootpart} " \ 90 "${scriptaddr} ${prefix}${script}; then " \ 91 "echo ${script} found! Executing ...;" \ 92 "source ${scriptaddr};" \ 93 "fi;\0" \ 94 \ 95 "scan_boot=" \ 96 "echo Scanning ${devtype} ${devnum}...; " \ 97 "for prefix in ${boot_prefixes}; do " \ 98 "for script in ${boot_scripts}; do " \ 99 "run script_boot; " \ 100 "done; " \ 101 "done;\0" \ 102 \ 103 "boot_targets=" \ 104 BOOT_TARGETS_MMC " " \ 105 BOOT_TARGETS_USB " " \ 106 BOOT_TARGETS_DHCP " " \ 107 "\0" \ 108 \ 109 "boot_prefixes=/ /boot/\0" \ 110 \ 111 "boot_scripts=boot.scr.uimg boot.scr\0" \ 112 \ 113 BOOTCMDS_MMC \ 114 BOOTCMDS_USB \ 115 BOOTCMDS_DHCP 116 117 #define CONFIG_BOOTCOMMAND \ 118 "for target in ${boot_targets}; do run bootcmd_${target}; done" 119 120 #endif 121 122 /* 123 * Memory layout for where various images get loaded by boot scripts: 124 * 125 * scriptaddr can be pretty much anywhere that doesn't conflict with something 126 * else. Put it above BOOTMAPSZ to eliminate conflicts. 127 * 128 * kernel_addr_r must be within the first 128M of RAM in order for the 129 * kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will 130 * decompress itself to 0x8000 after the start of RAM, kernel_addr_r 131 * should not overlap that area, or the kernel will have to copy itself 132 * somewhere else before decompression. Similarly, the address of any other 133 * data passed to the kernel shouldn't overlap the start of RAM. Pushing 134 * this up to 16M allows for a sizable kernel to be decompressed below the 135 * compressed load address. 136 * 137 * fdt_addr_r simply shouldn't overlap anything else. Choosing 32M allows for 138 * the compressed kernel to be up to 16M too. 139 * 140 * ramdisk_addr_r simply shouldn't overlap anything else. Choosing 33M allows 141 * for the FDT/DTB to be up to 1M, which is hopefully plenty. 142 */ 143 #define MEM_LAYOUT_ENV_SETTINGS \ 144 "scriptaddr=0x10000000\0" \ 145 "kernel_addr_r=0x01000000\0" \ 146 "fdt_addr_r=0x02000000\0" \ 147 "ramdisk_addr_r=0x02100000\0" \ 148 149 #define CONFIG_EXTRA_ENV_SETTINGS \ 150 TEGRA_DEVICE_SETTINGS \ 151 MEM_LAYOUT_ENV_SETTINGS \ 152 BOOTCMDS_COMMON 153 154 /* overrides for SPL build here */ 155 #ifdef CONFIG_SPL_BUILD 156 157 /* remove devicetree support */ 158 #ifdef CONFIG_OF_CONTROL 159 #undef CONFIG_OF_CONTROL 160 #endif 161 162 /* remove I2C support */ 163 #ifdef CONFIG_TEGRA_I2C 164 #undef CONFIG_TEGRA_I2C 165 #endif 166 #ifdef CONFIG_CMD_I2C 167 #undef CONFIG_CMD_I2C 168 #endif 169 170 /* remove MMC support */ 171 #ifdef CONFIG_MMC 172 #undef CONFIG_MMC 173 #endif 174 #ifdef CONFIG_GENERIC_MMC 175 #undef CONFIG_GENERIC_MMC 176 #endif 177 #ifdef CONFIG_TEGRA_MMC 178 #undef CONFIG_TEGRA_MMC 179 #endif 180 #ifdef CONFIG_CMD_MMC 181 #undef CONFIG_CMD_MMC 182 #endif 183 184 /* remove partitions/filesystems */ 185 #ifdef CONFIG_DOS_PARTITION 186 #undef CONFIG_DOS_PARTITION 187 #endif 188 #ifdef CONFIG_EFI_PARTITION 189 #undef CONFIG_EFI_PARTITION 190 #endif 191 #ifdef CONFIG_CMD_FS_GENERIC 192 #undef CONFIG_CMD_FS_GENERIC 193 #endif 194 #ifdef CONFIG_CMD_EXT4 195 #undef CONFIG_CMD_EXT4 196 #endif 197 #ifdef CONFIG_CMD_EXT2 198 #undef CONFIG_CMD_EXT2 199 #endif 200 #ifdef CONFIG_CMD_FAT 201 #undef CONFIG_CMD_FAT 202 #endif 203 #ifdef CONFIG_FS_EXT4 204 #undef CONFIG_FS_EXT4 205 #endif 206 #ifdef CONFIG_FS_FAT 207 #undef CONFIG_FS_FAT 208 #endif 209 210 /* remove USB */ 211 #ifdef CONFIG_USB_EHCI 212 #undef CONFIG_USB_EHCI 213 #endif 214 #ifdef CONFIG_USB_EHCI_TEGRA 215 #undef CONFIG_USB_EHCI_TEGRA 216 #endif 217 #ifdef CONFIG_USB_STORAGE 218 #undef CONFIG_USB_STORAGE 219 #endif 220 #ifdef CONFIG_CMD_USB 221 #undef CONFIG_CMD_USB 222 #endif 223 224 /* remove part command support */ 225 #ifdef CONFIG_PARTITION_UUIDS 226 #undef CONFIG_PARTITION_UUIDS 227 #endif 228 229 #ifdef CONFIG_CMD_PART 230 #undef CONFIG_CMD_PART 231 #endif 232 233 #endif /* CONFIG_SPL_BUILD */ 234 235 #endif /* __TEGRA_COMMON_POST_H */ 236