Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 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 | |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 24 | #ifndef __TEGRA_COMMON_POST_H |
| 25 | #define __TEGRA_COMMON_POST_H |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 26 | |
| 27 | #ifdef CONFIG_BOOTCOMMAND |
| 28 | |
| 29 | #define BOOTCMDS_COMMON "" |
| 30 | |
| 31 | #else |
| 32 | |
| 33 | #ifdef CONFIG_CMD_EXT2 |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 34 | #define BOOT_FSTYPE_EXT2 "ext2 " |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 35 | #else |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 36 | #define BOOT_FSTYPE_EXT2 "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | #ifdef CONFIG_CMD_FAT |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 40 | #define BOOT_FSTYPE_FAT "fat" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 41 | #else |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 42 | #define BOOT_FSTYPE_FAT "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 43 | #endif |
| 44 | |
| 45 | #ifdef CONFIG_CMD_MMC |
| 46 | #define BOOTCMDS_MMC \ |
| 47 | "mmc_boot=" \ |
| 48 | "setenv devtype mmc; " \ |
| 49 | "if mmc dev ${devnum}; then " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 50 | "run scan_boot; " \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 51 | "fi\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 52 | "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \ |
| 53 | "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0" |
| 54 | #define BOOT_TARGETS_MMC "mmc1 mmc0" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 55 | #else |
| 56 | #define BOOTCMDS_MMC "" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 57 | #define BOOT_TARGETS_MMC "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 58 | #endif |
| 59 | |
| 60 | #ifdef CONFIG_CMD_USB |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 61 | #define BOOTCMD_INIT_USB "run usb_init; " |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 62 | #define BOOTCMDS_USB \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 63 | "usb_init=" \ |
| 64 | "if ${usb_need_init}; then " \ |
| 65 | "set usb_need_init false; " \ |
| 66 | "usb start 0; " \ |
| 67 | "fi\0" \ |
| 68 | \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 69 | "usb_boot=" \ |
| 70 | "setenv devtype usb; " \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 71 | BOOTCMD_INIT_USB \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 72 | "if usb dev ${devnum}; then " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 73 | "run scan_boot; " \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 74 | "fi\0" \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 75 | \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 76 | "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" |
| 77 | #define BOOT_TARGETS_USB "usb0" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 78 | #else |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 79 | #define BOOTCMD_INIT_USB "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 80 | #define BOOTCMDS_USB "" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 81 | #define BOOT_TARGETS_USB "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 82 | #endif |
| 83 | |
| 84 | #ifdef CONFIG_CMD_DHCP |
| 85 | #define BOOTCMDS_DHCP \ |
| 86 | "bootcmd_dhcp=" \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 87 | BOOTCMD_INIT_USB \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 88 | "if dhcp ${scriptaddr} boot.scr.uimg; then "\ |
| 89 | "source ${scriptaddr}; " \ |
| 90 | "fi\0" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 91 | #define BOOT_TARGETS_DHCP "dhcp" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 92 | #else |
| 93 | #define BOOTCMDS_DHCP "" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 94 | #define BOOT_TARGETS_DHCP "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 95 | #endif |
| 96 | |
| 97 | #define BOOTCMDS_COMMON \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 98 | "rootpart=1\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 99 | \ |
| 100 | "script_boot=" \ |
| 101 | "if ${fs}load ${devtype} ${devnum}:${rootpart} " \ |
| 102 | "${scriptaddr} ${prefix}${script}; then " \ |
| 103 | "echo ${script} found! Executing ...;" \ |
| 104 | "source ${scriptaddr};" \ |
| 105 | "fi;\0" \ |
| 106 | \ |
| 107 | "scan_boot=" \ |
| 108 | "echo Scanning ${devtype} ${devnum}...; " \ |
| 109 | "for fs in ${boot_fstypes}; do " \ |
| 110 | "for prefix in ${boot_prefixes}; do " \ |
| 111 | "for script in ${boot_scripts}; do " \ |
| 112 | "run script_boot; " \ |
| 113 | "done; " \ |
| 114 | "done; " \ |
| 115 | "done;\0" \ |
| 116 | \ |
| 117 | "boot_targets=" \ |
| 118 | BOOT_TARGETS_MMC " " \ |
| 119 | BOOT_TARGETS_USB " " \ |
| 120 | BOOT_TARGETS_DHCP " " \ |
| 121 | "\0" \ |
| 122 | \ |
| 123 | "boot_fstypes=" \ |
| 124 | BOOT_FSTYPE_EXT2 " " \ |
| 125 | BOOT_FSTYPE_FAT " " \ |
| 126 | "\0" \ |
| 127 | \ |
| 128 | "boot_prefixes=/ /boot/\0" \ |
| 129 | \ |
| 130 | "boot_scripts=boot.scr.uimg boot.scr\0" \ |
| 131 | \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 132 | BOOTCMDS_MMC \ |
| 133 | BOOTCMDS_USB \ |
| 134 | BOOTCMDS_DHCP |
| 135 | |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 136 | #define CONFIG_BOOTCOMMAND \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 137 | "for target in ${boot_targets}; do run bootcmd_${target}; done" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 138 | |
| 139 | #endif |
| 140 | |
Stephen Warren | 3530510 | 2012-10-02 09:26:51 +0000 | [diff] [blame] | 141 | /* |
| 142 | * Memory layout for where various images get loaded by boot scripts: |
| 143 | * |
| 144 | * scriptaddr can be pretty much anywhere that doesn't conflict with something |
| 145 | * else. Put it above BOOTMAPSZ to eliminate conflicts. |
| 146 | * |
| 147 | * kernel_addr_r must be within the first 128M of RAM in order for the |
| 148 | * kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will |
| 149 | * decompress itself to 0x8000 after the start of RAM, kernel_addr_r |
| 150 | * should not overlap that area, or the kernel will have to copy itself |
| 151 | * somewhere else before decompression. Similarly, the address of any other |
| 152 | * data passed to the kernel shouldn't overlap the start of RAM. Pushing |
| 153 | * this up to 16M allows for a sizable kernel to be decompressed below the |
| 154 | * compressed load address. |
| 155 | * |
| 156 | * fdt_addr_r simply shouldn't overlap anything else. Choosing 32M allows for |
| 157 | * the compressed kernel to be up to 16M too. |
| 158 | * |
| 159 | * ramdisk_addr_r simply shouldn't overlap anything else. Choosing 33M allows |
| 160 | * for the FDT/DTB to be up to 1M, which is hopefully plenty. |
| 161 | */ |
| 162 | #define MEM_LAYOUT_ENV_SETTINGS \ |
| 163 | "scriptaddr=0x10000000\0" \ |
| 164 | "kernel_addr_r=0x01000000\0" \ |
| 165 | "fdt_addr_r=0x02000000\0" \ |
| 166 | "ramdisk_addr_r=0x02100000\0" \ |
| 167 | |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 168 | #ifdef CONFIG_TEGRA_KEYBOARD |
| 169 | #define STDIN_KBD_KBC ",tegra-kbc" |
| 170 | #else |
| 171 | #define STDIN_KBD_KBC "" |
| 172 | #endif |
| 173 | |
| 174 | #ifdef CONFIG_USB_KEYBOARD |
| 175 | #define STDIN_KBD_USB ",usbkbd" |
| 176 | #define CONFIG_SYS_USB_EVENT_POLL |
| 177 | #define CONFIG_PREBOOT "usb start" |
| 178 | #else |
| 179 | #define STDIN_KBD_USB "" |
| 180 | #endif |
| 181 | |
| 182 | #define TEGRA_DEVICE_SETTINGS \ |
| 183 | "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \ |
| 184 | "stdout=serial\0" \ |
| 185 | "stderr=serial\0" \ |
| 186 | |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 187 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 188 | TEGRA_DEVICE_SETTINGS \ |
Stephen Warren | 3530510 | 2012-10-02 09:26:51 +0000 | [diff] [blame] | 189 | MEM_LAYOUT_ENV_SETTINGS \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 190 | BOOTCMDS_COMMON |
| 191 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 192 | /* overrides for SPL build here */ |
| 193 | #ifdef CONFIG_SPL_BUILD |
| 194 | |
| 195 | /* remove devicetree support */ |
| 196 | #ifdef CONFIG_OF_CONTROL |
| 197 | #undef CONFIG_OF_CONTROL |
| 198 | #endif |
| 199 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 200 | /* remove I2C support */ |
| 201 | #ifdef CONFIG_TEGRA_I2C |
| 202 | #undef CONFIG_TEGRA_I2C |
| 203 | #endif |
| 204 | #ifdef CONFIG_CMD_I2C |
| 205 | #undef CONFIG_CMD_I2C |
| 206 | #endif |
| 207 | |
| 208 | /* remove MMC support */ |
| 209 | #ifdef CONFIG_MMC |
| 210 | #undef CONFIG_MMC |
| 211 | #endif |
| 212 | #ifdef CONFIG_GENERIC_MMC |
| 213 | #undef CONFIG_GENERIC_MMC |
| 214 | #endif |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 215 | #ifdef CONFIG_TEGRA_MMC |
| 216 | #undef CONFIG_TEGRA_MMC |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 217 | #endif |
| 218 | #ifdef CONFIG_CMD_MMC |
| 219 | #undef CONFIG_CMD_MMC |
| 220 | #endif |
| 221 | |
| 222 | /* remove partitions/filesystems */ |
| 223 | #ifdef CONFIG_DOS_PARTITION |
| 224 | #undef CONFIG_DOS_PARTITION |
| 225 | #endif |
| 226 | #ifdef CONFIG_EFI_PARTITION |
| 227 | #undef CONFIG_EFI_PARTITION |
| 228 | #endif |
| 229 | #ifdef CONFIG_CMD_EXT2 |
| 230 | #undef CONFIG_CMD_EXT2 |
| 231 | #endif |
| 232 | #ifdef CONFIG_CMD_FAT |
| 233 | #undef CONFIG_CMD_FAT |
| 234 | #endif |
| 235 | |
| 236 | /* remove USB */ |
| 237 | #ifdef CONFIG_USB_EHCI |
| 238 | #undef CONFIG_USB_EHCI |
| 239 | #endif |
| 240 | #ifdef CONFIG_USB_EHCI_TEGRA |
| 241 | #undef CONFIG_USB_EHCI_TEGRA |
| 242 | #endif |
| 243 | #ifdef CONFIG_USB_STORAGE |
| 244 | #undef CONFIG_USB_STORAGE |
| 245 | #endif |
| 246 | #ifdef CONFIG_CMD_USB |
| 247 | #undef CONFIG_CMD_USB |
| 248 | #endif |
| 249 | |
Stephen Warren | 91623dd | 2012-09-25 13:32:26 +0000 | [diff] [blame] | 250 | /* remove part command support */ |
| 251 | #ifdef CONFIG_PARTITION_UUIDS |
| 252 | #undef CONFIG_PARTITION_UUIDS |
| 253 | #endif |
| 254 | |
| 255 | #ifdef CONFIG_CMD_PART |
| 256 | #undef CONFIG_CMD_PART |
| 257 | #endif |
| 258 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 259 | #endif /* CONFIG_SPL_BUILD */ |
| 260 | |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 261 | #endif /* __TEGRA_COMMON_POST_H */ |