1 /* 2 * (C) Copyright 2010-2012 3 * NVIDIA Corporation <www.nvidia.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #ifndef __TEGRA_COMMON_POST_H 9 #define __TEGRA_COMMON_POST_H 10 11 #ifdef CONFIG_BOOTCOMMAND 12 13 #define BOOTCMDS_COMMON "" 14 15 #else 16 17 #ifdef CONFIG_CMD_MMC 18 #define BOOTCMDS_MMC \ 19 "mmc_boot=" \ 20 "setenv devtype mmc; " \ 21 "if mmc dev ${devnum}; then " \ 22 "run scan_boot; " \ 23 "fi\0" \ 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" 27 #else 28 #define BOOTCMDS_MMC "" 29 #define BOOT_TARGETS_MMC "" 30 #endif 31 32 #ifdef CONFIG_CMD_USB 33 #define BOOTCMD_INIT_USB "run usb_init; " 34 #define BOOTCMDS_USB \ 35 "usb_init=" \ 36 "if ${usb_need_init}; then " \ 37 "set usb_need_init false; " \ 38 "usb start 0; " \ 39 "fi\0" \ 40 \ 41 "usb_boot=" \ 42 "setenv devtype usb; " \ 43 BOOTCMD_INIT_USB \ 44 "if usb dev ${devnum}; then " \ 45 "run scan_boot; " \ 46 "fi\0" \ 47 \ 48 "bootcmd_usb0=setenv devnum 0; run usb_boot;\0" 49 #define BOOT_TARGETS_USB "usb0" 50 #else 51 #define BOOTCMD_INIT_USB "" 52 #define BOOTCMDS_USB "" 53 #define BOOT_TARGETS_USB "" 54 #endif 55 56 #ifdef CONFIG_CMD_DHCP 57 #define BOOTCMDS_DHCP \ 58 "bootcmd_dhcp=" \ 59 BOOTCMD_INIT_USB \ 60 "if dhcp ${scriptaddr} boot.scr.uimg; then "\ 61 "source ${scriptaddr}; " \ 62 "fi\0" 63 #define BOOT_TARGETS_DHCP "dhcp" 64 #else 65 #define BOOTCMDS_DHCP "" 66 #define BOOT_TARGETS_DHCP "" 67 #endif 68 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 83 #define BOOTCMDS_COMMON \ 84 "rootpart=1\0" \ 85 \ 86 "do_script_boot=" \ 87 "load ${devtype} ${devnum}:${rootpart} " \ 88 "${scriptaddr} ${prefix}${script}; " \ 89 "source ${scriptaddr}\0" \ 90 \ 91 "script_boot=" \ 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 " \ 104 "${scriptaddr} ${prefix}extlinux.conf\0" \ 105 \ 106 "sysboot_boot=" \ 107 "if test -e ${devtype} ${devnum}:${rootpart} " \ 108 "${prefix}extlinux.conf; then " \ 109 "echo Found extlinux config " \ 110 "${prefix}extlinux.conf; " \ 111 "run do_sysboot_boot; " \ 112 "echo SCRIPT FAILED: continuing...; " \ 113 "fi\0" \ 114 \ 115 "scan_boot=" \ 116 "echo Scanning ${devtype} ${devnum}...; " \ 117 "for prefix in ${boot_prefixes}; do " \ 118 "run sysboot_boot; " \ 119 "run script_boot; " \ 120 "done\0" \ 121 \ 122 "boot_targets=" \ 123 BOOT_TARGETS_MMC " " \ 124 BOOT_TARGETS_USB " " \ 125 BOOT_TARGETS_PXE " " \ 126 BOOT_TARGETS_DHCP " " \ 127 "\0" \ 128 \ 129 "boot_prefixes=/ /boot/\0" \ 130 \ 131 "boot_scripts=boot.scr.uimg boot.scr\0" \ 132 \ 133 BOOTCMDS_MMC \ 134 BOOTCMDS_USB \ 135 BOOTCMDS_DHCP \ 136 BOOTCMDS_PXE 137 138 #define CONFIG_BOOTCOMMAND \ 139 "set usb_need_init; " \ 140 "for target in ${boot_targets}; do run bootcmd_${target}; done" 141 142 #endif 143 144 #ifdef CONFIG_TEGRA_KEYBOARD 145 #define STDIN_KBD_KBC ",tegra-kbc" 146 #else 147 #define STDIN_KBD_KBC "" 148 #endif 149 150 #ifdef CONFIG_USB_KEYBOARD 151 #define STDIN_KBD_USB ",usbkbd" 152 #define CONFIG_SYS_USB_EVENT_POLL 153 #define CONFIG_PREBOOT "usb start" 154 #else 155 #define STDIN_KBD_USB "" 156 #endif 157 158 #ifdef CONFIG_VIDEO_TEGRA 159 #define STDOUT_LCD ",lcd" 160 #else 161 #define STDOUT_LCD "" 162 #endif 163 164 #define TEGRA_DEVICE_SETTINGS \ 165 "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \ 166 "stdout=serial" STDOUT_LCD "\0" \ 167 "stderr=serial" STDOUT_LCD "\0" \ 168 "" 169 170 #ifndef BOARD_EXTRA_ENV_SETTINGS 171 #define BOARD_EXTRA_ENV_SETTINGS 172 #endif 173 174 #define CONFIG_EXTRA_ENV_SETTINGS \ 175 TEGRA_DEVICE_SETTINGS \ 176 MEM_LAYOUT_ENV_SETTINGS \ 177 BOOTCMDS_COMMON \ 178 BOARD_EXTRA_ENV_SETTINGS 179 180 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI) 181 #define CONFIG_FDT_SPI 182 #endif 183 184 /* overrides for SPL build here */ 185 #ifdef CONFIG_SPL_BUILD 186 187 #define CONFIG_SKIP_LOWLEVEL_INIT 188 189 /* remove devicetree support */ 190 #ifdef CONFIG_OF_CONTROL 191 #undef CONFIG_OF_CONTROL 192 #endif 193 194 /* remove I2C support */ 195 #ifdef CONFIG_SYS_I2C_TEGRA 196 #undef CONFIG_SYS_I2C_TEGRA 197 #endif 198 #ifdef CONFIG_CMD_I2C 199 #undef CONFIG_CMD_I2C 200 #endif 201 202 /* remove MMC support */ 203 #ifdef CONFIG_MMC 204 #undef CONFIG_MMC 205 #endif 206 #ifdef CONFIG_GENERIC_MMC 207 #undef CONFIG_GENERIC_MMC 208 #endif 209 #ifdef CONFIG_TEGRA_MMC 210 #undef CONFIG_TEGRA_MMC 211 #endif 212 #ifdef CONFIG_CMD_MMC 213 #undef CONFIG_CMD_MMC 214 #endif 215 216 /* remove partitions/filesystems */ 217 #ifdef CONFIG_DOS_PARTITION 218 #undef CONFIG_DOS_PARTITION 219 #endif 220 #ifdef CONFIG_EFI_PARTITION 221 #undef CONFIG_EFI_PARTITION 222 #endif 223 #ifdef CONFIG_CMD_FS_GENERIC 224 #undef CONFIG_CMD_FS_GENERIC 225 #endif 226 #ifdef CONFIG_CMD_EXT4 227 #undef CONFIG_CMD_EXT4 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 #ifdef CONFIG_FS_EXT4 236 #undef CONFIG_FS_EXT4 237 #endif 238 #ifdef CONFIG_FS_FAT 239 #undef CONFIG_FS_FAT 240 #endif 241 242 /* remove USB */ 243 #ifdef CONFIG_USB_EHCI 244 #undef CONFIG_USB_EHCI 245 #endif 246 #ifdef CONFIG_USB_EHCI_TEGRA 247 #undef CONFIG_USB_EHCI_TEGRA 248 #endif 249 #ifdef CONFIG_USB_STORAGE 250 #undef CONFIG_USB_STORAGE 251 #endif 252 #ifdef CONFIG_CMD_USB 253 #undef CONFIG_CMD_USB 254 #endif 255 256 /* remove part command support */ 257 #ifdef CONFIG_PARTITION_UUIDS 258 #undef CONFIG_PARTITION_UUIDS 259 #endif 260 261 #ifdef CONFIG_CMD_PART 262 #undef CONFIG_CMD_PART 263 #endif 264 265 #endif /* CONFIG_SPL_BUILD */ 266 267 #endif /* __TEGRA_COMMON_POST_H */ 268