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 | |
| 69 | #define BOOTCMDS_COMMON \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 70 | "rootpart=1\0" \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 71 | \ |
| 72 | "script_boot=" \ |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 73 | "if load ${devtype} ${devnum}:${rootpart} " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 74 | "${scriptaddr} ${prefix}${script}; then " \ |
| 75 | "echo ${script} found! Executing ...;" \ |
| 76 | "source ${scriptaddr};" \ |
| 77 | "fi;\0" \ |
| 78 | \ |
| 79 | "scan_boot=" \ |
| 80 | "echo Scanning ${devtype} ${devnum}...; " \ |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 81 | "for prefix in ${boot_prefixes}; do " \ |
| 82 | "for script in ${boot_scripts}; do " \ |
| 83 | "run script_boot; " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 84 | "done; " \ |
| 85 | "done;\0" \ |
| 86 | \ |
| 87 | "boot_targets=" \ |
| 88 | BOOT_TARGETS_MMC " " \ |
| 89 | BOOT_TARGETS_USB " " \ |
| 90 | BOOT_TARGETS_DHCP " " \ |
| 91 | "\0" \ |
| 92 | \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 93 | "boot_prefixes=/ /boot/\0" \ |
| 94 | \ |
| 95 | "boot_scripts=boot.scr.uimg boot.scr\0" \ |
| 96 | \ |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 97 | BOOTCMDS_MMC \ |
| 98 | BOOTCMDS_USB \ |
| 99 | BOOTCMDS_DHCP |
| 100 | |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 101 | #define CONFIG_BOOTCOMMAND \ |
Stephen Warren | a92409c | 2014-01-23 13:17:05 -0700 | [diff] [blame^] | 102 | "set usb_need_init; " \ |
Stephen Warren | 6bb63c6 | 2012-06-04 10:59:22 +0000 | [diff] [blame] | 103 | "for target in ${boot_targets}; do run bootcmd_${target}; done" |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 104 | |
| 105 | #endif |
| 106 | |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 107 | #ifdef CONFIG_TEGRA_KEYBOARD |
| 108 | #define STDIN_KBD_KBC ",tegra-kbc" |
| 109 | #else |
| 110 | #define STDIN_KBD_KBC "" |
| 111 | #endif |
| 112 | |
| 113 | #ifdef CONFIG_USB_KEYBOARD |
| 114 | #define STDIN_KBD_USB ",usbkbd" |
| 115 | #define CONFIG_SYS_USB_EVENT_POLL |
| 116 | #define CONFIG_PREBOOT "usb start" |
| 117 | #else |
| 118 | #define STDIN_KBD_USB "" |
| 119 | #endif |
| 120 | |
Stephen Warren | 3f26479 | 2013-01-22 06:20:07 +0000 | [diff] [blame] | 121 | #ifdef CONFIG_VIDEO_TEGRA |
| 122 | #define STDOUT_LCD ",lcd" |
| 123 | #else |
| 124 | #define STDOUT_LCD "" |
| 125 | #endif |
| 126 | |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 127 | #define TEGRA_DEVICE_SETTINGS \ |
| 128 | "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \ |
Stephen Warren | 3f26479 | 2013-01-22 06:20:07 +0000 | [diff] [blame] | 129 | "stdout=serial" STDOUT_LCD "\0" \ |
| 130 | "stderr=serial" STDOUT_LCD "\0" \ |
| 131 | "" |
Allen Martin | 50df870 | 2012-10-24 08:32:05 +0000 | [diff] [blame] | 132 | |
Stephen Warren | 26b02f1 | 2014-01-23 13:17:01 -0700 | [diff] [blame] | 133 | #ifndef BOARD_EXTRA_ENV_SETTINGS |
| 134 | #define BOARD_EXTRA_ENV_SETTINGS |
| 135 | #endif |
| 136 | |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 137 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 138 | TEGRA_DEVICE_SETTINGS \ |
Stephen Warren | 3530510 | 2012-10-02 09:26:51 +0000 | [diff] [blame] | 139 | MEM_LAYOUT_ENV_SETTINGS \ |
Stephen Warren | 26b02f1 | 2014-01-23 13:17:01 -0700 | [diff] [blame] | 140 | BOOTCMDS_COMMON \ |
| 141 | BOARD_EXTRA_ENV_SETTINGS |
Stephen Warren | de17c29 | 2012-05-16 06:21:00 +0000 | [diff] [blame] | 142 | |
Allen Martin | 21f5b93 | 2013-03-16 18:58:13 +0000 | [diff] [blame] | 143 | #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] | 144 | #define CONFIG_FDT_SPI |
| 145 | #endif |
| 146 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 147 | /* overrides for SPL build here */ |
| 148 | #ifdef CONFIG_SPL_BUILD |
| 149 | |
Axel Lin | 53e512a | 2013-05-21 13:45:18 +0000 | [diff] [blame] | 150 | #define CONFIG_SKIP_LOWLEVEL_INIT |
| 151 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 152 | /* remove devicetree support */ |
| 153 | #ifdef CONFIG_OF_CONTROL |
| 154 | #undef CONFIG_OF_CONTROL |
| 155 | #endif |
| 156 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 157 | /* remove I2C support */ |
Simon Glass | 026fefb | 2012-10-30 07:28:53 +0000 | [diff] [blame] | 158 | #ifdef CONFIG_SYS_I2C_TEGRA |
| 159 | #undef CONFIG_SYS_I2C_TEGRA |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 160 | #endif |
| 161 | #ifdef CONFIG_CMD_I2C |
| 162 | #undef CONFIG_CMD_I2C |
| 163 | #endif |
| 164 | |
| 165 | /* remove MMC support */ |
| 166 | #ifdef CONFIG_MMC |
| 167 | #undef CONFIG_MMC |
| 168 | #endif |
| 169 | #ifdef CONFIG_GENERIC_MMC |
| 170 | #undef CONFIG_GENERIC_MMC |
| 171 | #endif |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 172 | #ifdef CONFIG_TEGRA_MMC |
| 173 | #undef CONFIG_TEGRA_MMC |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 174 | #endif |
| 175 | #ifdef CONFIG_CMD_MMC |
| 176 | #undef CONFIG_CMD_MMC |
| 177 | #endif |
| 178 | |
| 179 | /* remove partitions/filesystems */ |
| 180 | #ifdef CONFIG_DOS_PARTITION |
| 181 | #undef CONFIG_DOS_PARTITION |
| 182 | #endif |
| 183 | #ifdef CONFIG_EFI_PARTITION |
| 184 | #undef CONFIG_EFI_PARTITION |
| 185 | #endif |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 186 | #ifdef CONFIG_CMD_FS_GENERIC |
| 187 | #undef CONFIG_CMD_FS_GENERIC |
| 188 | #endif |
| 189 | #ifdef CONFIG_CMD_EXT4 |
| 190 | #undef CONFIG_CMD_EXT4 |
| 191 | #endif |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 192 | #ifdef CONFIG_CMD_EXT2 |
| 193 | #undef CONFIG_CMD_EXT2 |
| 194 | #endif |
| 195 | #ifdef CONFIG_CMD_FAT |
| 196 | #undef CONFIG_CMD_FAT |
| 197 | #endif |
Stephen Warren | 480860c | 2012-11-05 13:22:00 +0000 | [diff] [blame] | 198 | #ifdef CONFIG_FS_EXT4 |
| 199 | #undef CONFIG_FS_EXT4 |
| 200 | #endif |
| 201 | #ifdef CONFIG_FS_FAT |
| 202 | #undef CONFIG_FS_FAT |
| 203 | #endif |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 204 | |
| 205 | /* remove USB */ |
| 206 | #ifdef CONFIG_USB_EHCI |
| 207 | #undef CONFIG_USB_EHCI |
| 208 | #endif |
| 209 | #ifdef CONFIG_USB_EHCI_TEGRA |
| 210 | #undef CONFIG_USB_EHCI_TEGRA |
| 211 | #endif |
| 212 | #ifdef CONFIG_USB_STORAGE |
| 213 | #undef CONFIG_USB_STORAGE |
| 214 | #endif |
| 215 | #ifdef CONFIG_CMD_USB |
| 216 | #undef CONFIG_CMD_USB |
| 217 | #endif |
| 218 | |
Stephen Warren | 91623dd | 2012-09-25 13:32:26 +0000 | [diff] [blame] | 219 | /* remove part command support */ |
| 220 | #ifdef CONFIG_PARTITION_UUIDS |
| 221 | #undef CONFIG_PARTITION_UUIDS |
| 222 | #endif |
| 223 | |
| 224 | #ifdef CONFIG_CMD_PART |
| 225 | #undef CONFIG_CMD_PART |
| 226 | #endif |
| 227 | |
Allen Martin | c9c9846 | 2012-08-31 08:30:12 +0000 | [diff] [blame] | 228 | #endif /* CONFIG_SPL_BUILD */ |
| 229 | |
Tom Warren | 22562a4 | 2012-09-04 17:00:24 -0700 | [diff] [blame] | 230 | #endif /* __TEGRA_COMMON_POST_H */ |