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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 8 | #ifndef __TEGRA_COMMON_POST_H |
| 9 | #define __TEGRA_COMMON_POST_H |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 10 | |
| 11 | #ifdef CONFIG_BOOTCOMMAND |
| 12 | |
| 13 | #define BOOTCMDS_COMMON "" |
| 14 | |
| 15 | #else |
| 16 | |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 17 | #ifdef CONFIG_CMD_MMC |
| 18 | #define BOOTCMDS_MMC \ |
| 19 | "mmc_boot=" \ |
| 20 | "setenv devtype mmc; " \ |
| 21 | "if mmc dev ${devnum}; then " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 22 | "run scan_boot; " \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 23 | "fi\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 24 | "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \ |
| 25 | "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0" |
| 26 | #define BOOT_TARGETS_MMC "mmc1 mmc0" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 27 | #else |
| 28 | #define BOOTCMDS_MMC "" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 29 | #define BOOT_TARGETS_MMC "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 30 | #endif |
| 31 | |
| 32 | #ifdef CONFIG_CMD_USB |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 33 | #define BOOTCMD_INIT_USB "run usb_init; " |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 34 | #define BOOTCMDS_USB \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 35 | "usb_init=" \ |
| 36 | "if ${usb_need_init}; then " \ |
| 37 | "set usb_need_init false; " \ |
| 38 | "usb start 0; " \ |
| 39 | "fi\0" \ |
| 40 | \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 41 | "usb_boot=" \ |
| 42 | "setenv devtype usb; " \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 43 | BOOTCMD_INIT_USB \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 44 | "if usb dev ${devnum}; then " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 45 | "run scan_boot; " \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 46 | "fi\0" \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 47 | \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 48 | "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" |
| 49 | #define BOOT_TARGETS_USB "usb0" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 50 | #else |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 51 | #define BOOTCMD_INIT_USB "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 52 | #define BOOTCMDS_USB "" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 53 | #define BOOT_TARGETS_USB "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 54 | #endif |
| 55 | |
| 56 | #ifdef CONFIG_CMD_DHCP |
| 57 | #define BOOTCMDS_DHCP \ |
| 58 | "bootcmd_dhcp=" \ |
Stephen Warren | 86437a1 | 2012-06-04 10:59:23 +0000 | [diff] [blame] | 59 | BOOTCMD_INIT_USB \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 60 | "if dhcp ${scriptaddr} boot.scr.uimg; then "\ |
| 61 | "source ${scriptaddr}; " \ |
| 62 | "fi\0" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 63 | #define BOOT_TARGETS_DHCP "dhcp" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 64 | #else |
| 65 | #define BOOTCMDS_DHCP "" |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 66 | #define BOOT_TARGETS_DHCP "" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 67 | #endif |
| 68 | |
Stephen Warren | 7434dfe | 2014-02-05 09:24:59 -0700 | [diff] [blame] | 69 | #if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE) |
| 70 | #define BOOTCMDS_PXE \ |
| 71 | "bootcmd_pxe=" \ |
| 72 | BOOTCMD_INIT_USB \ |
| 73 | "dhcp; " \ |
| 74 | "if pxe get; then " \ |
| 75 | "pxe boot; " \ |
| 76 | "fi\0" |
| 77 | #define BOOT_TARGETS_PXE "pxe" |
| 78 | #else |
| 79 | #define BOOTCMDS_PXE "" |
| 80 | #define BOOT_TARGETS_PXE "" |
| 81 | #endif |
| 82 | |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 83 | #define BOOTCMDS_COMMON \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 84 | "rootpart=1\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 85 | \ |
Stephen Warren | 3c02514 | 2014-02-05 09:24:58 -0700 | [diff] [blame] | 86 | "do_script_boot=" \ |
| 87 | "load ${devtype} ${devnum}:${rootpart} " \ |
| 88 | "${scriptaddr} ${prefix}${script}; " \ |
| 89 | "source ${scriptaddr}\0" \ |
| 90 | \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 91 | "script_boot=" \ |
Stephen Warren | 3c02514 | 2014-02-05 09:24:58 -0700 | [diff] [blame] | 92 | "for script in ${boot_scripts}; do " \ |
| 93 | "if test -e ${devtype} ${devnum}:${rootpart} " \ |
| 94 | "${prefix}${script}; then " \ |
| 95 | "echo Found U-Boot script " \ |
| 96 | "${prefix}${script}; " \ |
| 97 | "run do_script_boot; " \ |
| 98 | "echo SCRIPT FAILED: continuing...; " \ |
| 99 | "fi; " \ |
| 100 | "done\0" \ |
| 101 | \ |
| 102 | "do_sysboot_boot=" \ |
| 103 | "sysboot ${devtype} ${devnum}:${rootpart} any " \ |
Stephen Warren | e55bbfd | 2014-06-19 10:52:58 -0600 | [diff] [blame^] | 104 | "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \ |
Stephen Warren | 3c02514 | 2014-02-05 09:24:58 -0700 | [diff] [blame] | 105 | \ |
| 106 | "sysboot_boot=" \ |
| 107 | "if test -e ${devtype} ${devnum}:${rootpart} " \ |
Stephen Warren | e55bbfd | 2014-06-19 10:52:58 -0600 | [diff] [blame^] | 108 | "${prefix}extlinux/extlinux.conf; then " \ |
| 109 | "echo Found ${prefix}extlinux/extlinux.conf; " \ |
Stephen Warren | 3c02514 | 2014-02-05 09:24:58 -0700 | [diff] [blame] | 110 | "run do_sysboot_boot; " \ |
| 111 | "echo SCRIPT FAILED: continuing...; " \ |
| 112 | "fi\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 113 | \ |
| 114 | "scan_boot=" \ |
| 115 | "echo Scanning ${devtype} ${devnum}...; " \ |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 116 | "for prefix in ${boot_prefixes}; do " \ |
Stephen Warren | 3c02514 | 2014-02-05 09:24:58 -0700 | [diff] [blame] | 117 | "run sysboot_boot; " \ |
| 118 | "run script_boot; " \ |
| 119 | "done\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 120 | \ |
| 121 | "boot_targets=" \ |
| 122 | BOOT_TARGETS_MMC " " \ |
| 123 | BOOT_TARGETS_USB " " \ |
Stephen Warren | 7434dfe | 2014-02-05 09:24:59 -0700 | [diff] [blame] | 124 | BOOT_TARGETS_PXE " " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 125 | BOOT_TARGETS_DHCP " " \ |
| 126 | "\0" \ |
| 127 | \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 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 \ |
Stephen Warren | 7434dfe | 2014-02-05 09:24:59 -0700 | [diff] [blame] | 134 | BOOTCMDS_DHCP \ |
| 135 | BOOTCMDS_PXE |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 136 | |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 137 | #define CONFIG_BOOTCOMMAND \ |
Stephen Warren | a92409c | 2014-01-23 13:17:05 -0700 | [diff] [blame] | 138 | "set usb_need_init; " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 139 | "for target in ${boot_targets}; do run bootcmd_${target}; done" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 140 | |
| 141 | #endif |
| 142 | |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 143 | #ifdef CONFIG_TEGRA_KEYBOARD |
| 144 | #define STDIN_KBD_KBC ",tegra-kbc" |
| 145 | #else |
| 146 | #define STDIN_KBD_KBC "" |
| 147 | #endif |
| 148 | |
| 149 | #ifdef CONFIG_USB_KEYBOARD |
| 150 | #define STDIN_KBD_USB ",usbkbd" |
| 151 | #define CONFIG_SYS_USB_EVENT_POLL |
| 152 | #define CONFIG_PREBOOT "usb start" |
| 153 | #else |
| 154 | #define STDIN_KBD_USB "" |
| 155 | #endif |
| 156 | |
Stephen Warren | 3f26479 | 2013-01-22 06:20:07 +0000 | [diff] [blame] | 157 | #ifdef CONFIG_VIDEO_TEGRA |
| 158 | #define STDOUT_LCD ",lcd" |
| 159 | #else |
| 160 | #define STDOUT_LCD "" |
| 161 | #endif |
| 162 | |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 163 | #define TEGRA_DEVICE_SETTINGS \ |
| 164 | "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \ |
Stephen Warren | 3f26479 | 2013-01-22 06:20:07 +0000 | [diff] [blame] | 165 | "stdout=serial" STDOUT_LCD "\0" \ |
| 166 | "stderr=serial" STDOUT_LCD "\0" \ |
| 167 | "" |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 168 | |
Stephen Warren | 26b02f1 | 2014-01-23 13:17:01 -0700 | [diff] [blame] | 169 | #ifndef BOARD_EXTRA_ENV_SETTINGS |
| 170 | #define BOARD_EXTRA_ENV_SETTINGS |
| 171 | #endif |
| 172 | |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 173 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 174 | TEGRA_DEVICE_SETTINGS \ |
Stephen Warren | 3530510 | 2012-10-02 09:26:51 +0000 | [diff] [blame] | 175 | MEM_LAYOUT_ENV_SETTINGS \ |
Stephen Warren | 26b02f1 | 2014-01-23 13:17:01 -0700 | [diff] [blame] | 176 | BOOTCMDS_COMMON \ |
| 177 | BOARD_EXTRA_ENV_SETTINGS |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 178 | |
Allen Martin | 21f5b93 | 2013-03-16 18:58:13 +0000 | [diff] [blame] | 179 | #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI) |
Allen Martin | b98691c | 2013-03-16 18:58:07 +0000 | [diff] [blame] | 180 | #define CONFIG_FDT_SPI |
| 181 | #endif |
| 182 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 183 | /* overrides for SPL build here */ |
| 184 | #ifdef CONFIG_SPL_BUILD |
| 185 | |
Axel Lin | 53e512a | 2013-05-21 13:45:18 +0000 | [diff] [blame] | 186 | #define CONFIG_SKIP_LOWLEVEL_INIT |
| 187 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 188 | /* remove devicetree support */ |
| 189 | #ifdef CONFIG_OF_CONTROL |
| 190 | #undef CONFIG_OF_CONTROL |
| 191 | #endif |
| 192 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 193 | /* remove I2C support */ |
Simon Glass | 026fefb | 2012-10-30 07:28:53 +0000 | [diff] [blame] | 194 | #ifdef CONFIG_SYS_I2C_TEGRA |
| 195 | #undef CONFIG_SYS_I2C_TEGRA |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 196 | #endif |
| 197 | #ifdef CONFIG_CMD_I2C |
| 198 | #undef CONFIG_CMD_I2C |
| 199 | #endif |
| 200 | |
| 201 | /* remove MMC support */ |
| 202 | #ifdef CONFIG_MMC |
| 203 | #undef CONFIG_MMC |
| 204 | #endif |
| 205 | #ifdef CONFIG_GENERIC_MMC |
| 206 | #undef CONFIG_GENERIC_MMC |
| 207 | #endif |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 208 | #ifdef CONFIG_TEGRA_MMC |
| 209 | #undef CONFIG_TEGRA_MMC |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 210 | #endif |
| 211 | #ifdef CONFIG_CMD_MMC |
| 212 | #undef CONFIG_CMD_MMC |
| 213 | #endif |
| 214 | |
| 215 | /* remove partitions/filesystems */ |
| 216 | #ifdef CONFIG_DOS_PARTITION |
| 217 | #undef CONFIG_DOS_PARTITION |
| 218 | #endif |
| 219 | #ifdef CONFIG_EFI_PARTITION |
| 220 | #undef CONFIG_EFI_PARTITION |
| 221 | #endif |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 222 | #ifdef CONFIG_CMD_FS_GENERIC |
| 223 | #undef CONFIG_CMD_FS_GENERIC |
| 224 | #endif |
| 225 | #ifdef CONFIG_CMD_EXT4 |
| 226 | #undef CONFIG_CMD_EXT4 |
| 227 | #endif |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 228 | #ifdef CONFIG_CMD_EXT2 |
| 229 | #undef CONFIG_CMD_EXT2 |
| 230 | #endif |
| 231 | #ifdef CONFIG_CMD_FAT |
| 232 | #undef CONFIG_CMD_FAT |
| 233 | #endif |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 234 | #ifdef CONFIG_FS_EXT4 |
| 235 | #undef CONFIG_FS_EXT4 |
| 236 | #endif |
| 237 | #ifdef CONFIG_FS_FAT |
| 238 | #undef CONFIG_FS_FAT |
| 239 | #endif |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 240 | |
| 241 | /* remove USB */ |
| 242 | #ifdef CONFIG_USB_EHCI |
| 243 | #undef CONFIG_USB_EHCI |
| 244 | #endif |
| 245 | #ifdef CONFIG_USB_EHCI_TEGRA |
| 246 | #undef CONFIG_USB_EHCI_TEGRA |
| 247 | #endif |
| 248 | #ifdef CONFIG_USB_STORAGE |
| 249 | #undef CONFIG_USB_STORAGE |
| 250 | #endif |
| 251 | #ifdef CONFIG_CMD_USB |
| 252 | #undef CONFIG_CMD_USB |
| 253 | #endif |
| 254 | |
Stephen Warren | 91623dd | 2012-09-25 13:32:26 +0000 | [diff] [blame] | 255 | /* remove part command support */ |
| 256 | #ifdef CONFIG_PARTITION_UUIDS |
| 257 | #undef CONFIG_PARTITION_UUIDS |
| 258 | #endif |
| 259 | |
| 260 | #ifdef CONFIG_CMD_PART |
| 261 | #undef CONFIG_CMD_PART |
| 262 | #endif |
| 263 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 264 | #endif /* CONFIG_SPL_BUILD */ |
| 265 | |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 266 | #endif /* __TEGRA_COMMON_POST_H */ |