Stephen Warren | bea2674 | 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 | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 24 | #ifndef __TEGRA_COMMON_POST_H |
| 25 | #define __TEGRA_COMMON_POST_H |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 26 | |
| 27 | #ifdef CONFIG_BOOTCOMMAND |
| 28 | |
| 29 | #define BOOTCMDS_COMMON "" |
| 30 | |
| 31 | #else |
| 32 | |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 33 | #ifdef CONFIG_CMD_MMC |
| 34 | #define BOOTCMDS_MMC \ |
| 35 | "mmc_boot=" \ |
| 36 | "setenv devtype mmc; " \ |
| 37 | "if mmc dev ${devnum}; then " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 38 | "run scan_boot; " \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 39 | "fi\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 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" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 43 | #else |
| 44 | #define BOOTCMDS_MMC "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 45 | #define BOOT_TARGETS_MMC "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 46 | #endif |
| 47 | |
| 48 | #ifdef CONFIG_CMD_USB |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 49 | #define BOOTCMD_INIT_USB "run usb_init; " |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 50 | #define BOOTCMDS_USB \ |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 51 | "usb_init=" \ |
| 52 | "if ${usb_need_init}; then " \ |
| 53 | "set usb_need_init false; " \ |
| 54 | "usb start 0; " \ |
| 55 | "fi\0" \ |
| 56 | \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 57 | "usb_boot=" \ |
| 58 | "setenv devtype usb; " \ |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 59 | BOOTCMD_INIT_USB \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 60 | "if usb dev ${devnum}; then " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 61 | "run scan_boot; " \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 62 | "fi\0" \ |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 63 | \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 64 | "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" |
| 65 | #define BOOT_TARGETS_USB "usb0" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 66 | #else |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 67 | #define BOOTCMD_INIT_USB "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 68 | #define BOOTCMDS_USB "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 69 | #define BOOT_TARGETS_USB "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 70 | #endif |
| 71 | |
| 72 | #ifdef CONFIG_CMD_DHCP |
| 73 | #define BOOTCMDS_DHCP \ |
| 74 | "bootcmd_dhcp=" \ |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 75 | BOOTCMD_INIT_USB \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 76 | "if dhcp ${scriptaddr} boot.scr.uimg; then "\ |
| 77 | "source ${scriptaddr}; " \ |
| 78 | "fi\0" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 79 | #define BOOT_TARGETS_DHCP "dhcp" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 80 | #else |
| 81 | #define BOOTCMDS_DHCP "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 82 | #define BOOT_TARGETS_DHCP "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 83 | #endif |
| 84 | |
| 85 | #define BOOTCMDS_COMMON \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 86 | "rootpart=1\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 87 | \ |
| 88 | "script_boot=" \ |
Stephen Warren | 3786a94 | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 89 | "if load ${devtype} ${devnum}:${rootpart} " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 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}...; " \ |
Stephen Warren | 3786a94 | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 97 | "for prefix in ${boot_prefixes}; do " \ |
| 98 | "for script in ${boot_scripts}; do " \ |
| 99 | "run script_boot; " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 100 | "done; " \ |
| 101 | "done;\0" \ |
| 102 | \ |
| 103 | "boot_targets=" \ |
| 104 | BOOT_TARGETS_MMC " " \ |
| 105 | BOOT_TARGETS_USB " " \ |
| 106 | BOOT_TARGETS_DHCP " " \ |
| 107 | "\0" \ |
| 108 | \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 109 | "boot_prefixes=/ /boot/\0" \ |
| 110 | \ |
| 111 | "boot_scripts=boot.scr.uimg boot.scr\0" \ |
| 112 | \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 113 | BOOTCMDS_MMC \ |
| 114 | BOOTCMDS_USB \ |
| 115 | BOOTCMDS_DHCP |
| 116 | |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 117 | #define CONFIG_BOOTCOMMAND \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 118 | "for target in ${boot_targets}; do run bootcmd_${target}; done" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 119 | |
| 120 | #endif |
| 121 | |
Stephen Warren | 938176a | 2012-10-02 09:26:51 +0000 | [diff] [blame] | 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 | |
Allen Martin | 7992bfb | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 149 | #ifdef CONFIG_TEGRA_KEYBOARD |
| 150 | #define STDIN_KBD_KBC ",tegra-kbc" |
| 151 | #else |
| 152 | #define STDIN_KBD_KBC "" |
| 153 | #endif |
| 154 | |
| 155 | #ifdef CONFIG_USB_KEYBOARD |
| 156 | #define STDIN_KBD_USB ",usbkbd" |
| 157 | #define CONFIG_SYS_USB_EVENT_POLL |
| 158 | #define CONFIG_PREBOOT "usb start" |
| 159 | #else |
| 160 | #define STDIN_KBD_USB "" |
| 161 | #endif |
| 162 | |
| 163 | #define TEGRA_DEVICE_SETTINGS \ |
| 164 | "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \ |
Allen Martin | a098cf4 | 2012-12-19 13:02:36 -0800 | [diff] [blame] | 165 | "stdout=serial,lcd\0" \ |
| 166 | "stderr=serial,lcd\0" \ |
Allen Martin | 7992bfb | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 167 | |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 168 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Tom Warren | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 169 | TEGRA_DEVICE_SETTINGS \ |
Stephen Warren | 938176a | 2012-10-02 09:26:51 +0000 | [diff] [blame] | 170 | MEM_LAYOUT_ENV_SETTINGS \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 171 | BOOTCMDS_COMMON |
| 172 | |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 173 | /* overrides for SPL build here */ |
| 174 | #ifdef CONFIG_SPL_BUILD |
| 175 | |
| 176 | /* remove devicetree support */ |
| 177 | #ifdef CONFIG_OF_CONTROL |
| 178 | #undef CONFIG_OF_CONTROL |
| 179 | #endif |
| 180 | |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 181 | /* remove I2C support */ |
| 182 | #ifdef CONFIG_TEGRA_I2C |
| 183 | #undef CONFIG_TEGRA_I2C |
| 184 | #endif |
| 185 | #ifdef CONFIG_CMD_I2C |
| 186 | #undef CONFIG_CMD_I2C |
| 187 | #endif |
| 188 | |
| 189 | /* remove MMC support */ |
| 190 | #ifdef CONFIG_MMC |
| 191 | #undef CONFIG_MMC |
| 192 | #endif |
| 193 | #ifdef CONFIG_GENERIC_MMC |
| 194 | #undef CONFIG_GENERIC_MMC |
| 195 | #endif |
Tom Warren | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 196 | #ifdef CONFIG_TEGRA_MMC |
| 197 | #undef CONFIG_TEGRA_MMC |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 198 | #endif |
| 199 | #ifdef CONFIG_CMD_MMC |
| 200 | #undef CONFIG_CMD_MMC |
| 201 | #endif |
| 202 | |
| 203 | /* remove partitions/filesystems */ |
| 204 | #ifdef CONFIG_DOS_PARTITION |
| 205 | #undef CONFIG_DOS_PARTITION |
| 206 | #endif |
| 207 | #ifdef CONFIG_EFI_PARTITION |
| 208 | #undef CONFIG_EFI_PARTITION |
| 209 | #endif |
Stephen Warren | 3786a94 | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 210 | #ifdef CONFIG_CMD_FS_GENERIC |
| 211 | #undef CONFIG_CMD_FS_GENERIC |
| 212 | #endif |
| 213 | #ifdef CONFIG_CMD_EXT4 |
| 214 | #undef CONFIG_CMD_EXT4 |
| 215 | #endif |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 216 | #ifdef CONFIG_CMD_EXT2 |
| 217 | #undef CONFIG_CMD_EXT2 |
| 218 | #endif |
| 219 | #ifdef CONFIG_CMD_FAT |
| 220 | #undef CONFIG_CMD_FAT |
| 221 | #endif |
Stephen Warren | 3786a94 | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 222 | #ifdef CONFIG_FS_EXT4 |
| 223 | #undef CONFIG_FS_EXT4 |
| 224 | #endif |
| 225 | #ifdef CONFIG_FS_FAT |
| 226 | #undef CONFIG_FS_FAT |
| 227 | #endif |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 228 | |
| 229 | /* remove USB */ |
| 230 | #ifdef CONFIG_USB_EHCI |
| 231 | #undef CONFIG_USB_EHCI |
| 232 | #endif |
| 233 | #ifdef CONFIG_USB_EHCI_TEGRA |
| 234 | #undef CONFIG_USB_EHCI_TEGRA |
| 235 | #endif |
| 236 | #ifdef CONFIG_USB_STORAGE |
| 237 | #undef CONFIG_USB_STORAGE |
| 238 | #endif |
| 239 | #ifdef CONFIG_CMD_USB |
| 240 | #undef CONFIG_CMD_USB |
| 241 | #endif |
| 242 | |
Stephen Warren | 01ca286 | 2012-09-25 13:32:26 +0000 | [diff] [blame] | 243 | /* remove part command support */ |
| 244 | #ifdef CONFIG_PARTITION_UUIDS |
| 245 | #undef CONFIG_PARTITION_UUIDS |
| 246 | #endif |
| 247 | |
| 248 | #ifdef CONFIG_CMD_PART |
| 249 | #undef CONFIG_CMD_PART |
| 250 | #endif |
| 251 | |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 252 | #endif /* CONFIG_SPL_BUILD */ |
| 253 | |
Tom Warren | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 254 | #endif /* __TEGRA_COMMON_POST_H */ |