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 | |
| 33 | #ifdef CONFIG_CMD_EXT2 |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 34 | #define BOOT_FSTYPE_EXT2 "ext2 " |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 35 | #else |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 36 | #define BOOT_FSTYPE_EXT2 "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | #ifdef CONFIG_CMD_FAT |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 40 | #define BOOT_FSTYPE_FAT "fat" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 41 | #else |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 42 | #define BOOT_FSTYPE_FAT "" |
Stephen Warren | bea2674 | 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 | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 50 | "run scan_boot; " \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 51 | "fi\0" \ |
Stephen Warren | 03cddf2 | 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 | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 55 | #else |
| 56 | #define BOOTCMDS_MMC "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 57 | #define BOOT_TARGETS_MMC "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 58 | #endif |
| 59 | |
| 60 | #ifdef CONFIG_CMD_USB |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 61 | #define BOOTCMD_INIT_USB "run usb_init; " |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 62 | #define BOOTCMDS_USB \ |
Stephen Warren | f78d348 | 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 | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 69 | "usb_boot=" \ |
| 70 | "setenv devtype usb; " \ |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 71 | BOOTCMD_INIT_USB \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 72 | "if usb dev ${devnum}; then " \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 73 | "run scan_boot; " \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 74 | "fi\0" \ |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 75 | \ |
Stephen Warren | 03cddf2 | 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 | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 78 | #else |
Stephen Warren | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 79 | #define BOOTCMD_INIT_USB "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 80 | #define BOOTCMDS_USB "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 81 | #define BOOT_TARGETS_USB "" |
Stephen Warren | bea2674 | 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 | f78d348 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 87 | BOOTCMD_INIT_USB \ |
Stephen Warren | bea2674 | 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 | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 91 | #define BOOT_TARGETS_DHCP "dhcp" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 92 | #else |
| 93 | #define BOOTCMDS_DHCP "" |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 94 | #define BOOT_TARGETS_DHCP "" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 95 | #endif |
| 96 | |
| 97 | #define BOOTCMDS_COMMON \ |
| 98 | "scriptaddr=0x400000\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 99 | \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 100 | "rootpart=1\0" \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 101 | \ |
| 102 | "script_boot=" \ |
| 103 | "if ${fs}load ${devtype} ${devnum}:${rootpart} " \ |
| 104 | "${scriptaddr} ${prefix}${script}; then " \ |
| 105 | "echo ${script} found! Executing ...;" \ |
| 106 | "source ${scriptaddr};" \ |
| 107 | "fi;\0" \ |
| 108 | \ |
| 109 | "scan_boot=" \ |
| 110 | "echo Scanning ${devtype} ${devnum}...; " \ |
| 111 | "for fs in ${boot_fstypes}; do " \ |
| 112 | "for prefix in ${boot_prefixes}; do " \ |
| 113 | "for script in ${boot_scripts}; do " \ |
| 114 | "run script_boot; " \ |
| 115 | "done; " \ |
| 116 | "done; " \ |
| 117 | "done;\0" \ |
| 118 | \ |
| 119 | "boot_targets=" \ |
| 120 | BOOT_TARGETS_MMC " " \ |
| 121 | BOOT_TARGETS_USB " " \ |
| 122 | BOOT_TARGETS_DHCP " " \ |
| 123 | "\0" \ |
| 124 | \ |
| 125 | "boot_fstypes=" \ |
| 126 | BOOT_FSTYPE_EXT2 " " \ |
| 127 | BOOT_FSTYPE_FAT " " \ |
| 128 | "\0" \ |
| 129 | \ |
| 130 | "boot_prefixes=/ /boot/\0" \ |
| 131 | \ |
| 132 | "boot_scripts=boot.scr.uimg boot.scr\0" \ |
| 133 | \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 134 | BOOTCMDS_MMC \ |
| 135 | BOOTCMDS_USB \ |
| 136 | BOOTCMDS_DHCP |
| 137 | |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 138 | #define CONFIG_BOOTCOMMAND \ |
Stephen Warren | 03cddf2 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 139 | "for target in ${boot_targets}; do run bootcmd_${target}; done" |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 140 | |
| 141 | #endif |
| 142 | |
| 143 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Tom Warren | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 144 | TEGRA_DEVICE_SETTINGS \ |
Stephen Warren | 63905f1 | 2012-06-13 09:55:12 +0000 | [diff] [blame] | 145 | "fdt_load=0x01000000\0" \ |
| 146 | "fdt_high=01100000\0" \ |
Stephen Warren | bea2674 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 147 | BOOTCMDS_COMMON |
| 148 | |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 149 | /* overrides for SPL build here */ |
| 150 | #ifdef CONFIG_SPL_BUILD |
| 151 | |
| 152 | /* remove devicetree support */ |
| 153 | #ifdef CONFIG_OF_CONTROL |
| 154 | #undef CONFIG_OF_CONTROL |
| 155 | #endif |
| 156 | |
| 157 | /* remove SERIAL_MULTI */ |
| 158 | #ifdef CONFIG_SERIAL_MULTI |
| 159 | #undef CONFIG_SERIAL_MULTI |
| 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 |
Tom Warren | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 177 | #ifdef CONFIG_TEGRA_MMC |
| 178 | #undef CONFIG_TEGRA_MMC |
Allen Martin | 12b7b70 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 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_EXT2 |
| 192 | #undef CONFIG_CMD_EXT2 |
| 193 | #endif |
| 194 | #ifdef CONFIG_CMD_FAT |
| 195 | #undef CONFIG_CMD_FAT |
| 196 | #endif |
| 197 | |
| 198 | /* remove USB */ |
| 199 | #ifdef CONFIG_USB_EHCI |
| 200 | #undef CONFIG_USB_EHCI |
| 201 | #endif |
| 202 | #ifdef CONFIG_USB_EHCI_TEGRA |
| 203 | #undef CONFIG_USB_EHCI_TEGRA |
| 204 | #endif |
| 205 | #ifdef CONFIG_USB_STORAGE |
| 206 | #undef CONFIG_USB_STORAGE |
| 207 | #endif |
| 208 | #ifdef CONFIG_CMD_USB |
| 209 | #undef CONFIG_CMD_USB |
| 210 | #endif |
| 211 | |
| 212 | #endif /* CONFIG_SPL_BUILD */ |
| 213 | |
Tom Warren | 29f3e3f | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 214 | #endif /* __TEGRA_COMMON_POST_H */ |