blob: 1c770c90fecaa3d98a144f5dcfe523c531a36f07 [file] [log] [blame]
Stephen Warrenbea26742012-05-16 06:21:00 +00001/*
2 * (C) Copyright 2010-2012
3 * NVIDIA Corporation <www.nvidia.com>
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Stephen Warrenbea26742012-05-16 06:21:00 +00006 */
7
Tom Warren29f3e3f2012-09-04 17:00:24 -07008#ifndef __TEGRA_COMMON_POST_H
9#define __TEGRA_COMMON_POST_H
Stephen Warrenbea26742012-05-16 06:21:00 +000010
11#ifdef CONFIG_BOOTCOMMAND
12
13#define BOOTCMDS_COMMON ""
14
15#else
16
Stephen Warrenbea26742012-05-16 06:21:00 +000017#ifdef CONFIG_CMD_MMC
18#define BOOTCMDS_MMC \
19 "mmc_boot=" \
20 "setenv devtype mmc; " \
21 "if mmc dev ${devnum}; then " \
Stephen Warren03cddf22012-06-04 10:59:22 +000022 "run scan_boot; " \
Stephen Warrenbea26742012-05-16 06:21:00 +000023 "fi\0" \
Stephen Warren03cddf22012-06-04 10:59:22 +000024 "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 Warrenbea26742012-05-16 06:21:00 +000027#else
28#define BOOTCMDS_MMC ""
Stephen Warren03cddf22012-06-04 10:59:22 +000029#define BOOT_TARGETS_MMC ""
Stephen Warrenbea26742012-05-16 06:21:00 +000030#endif
31
32#ifdef CONFIG_CMD_USB
Stephen Warrenf78d3482012-06-04 10:59:23 +000033#define BOOTCMD_INIT_USB "run usb_init; "
Stephen Warrenbea26742012-05-16 06:21:00 +000034#define BOOTCMDS_USB \
Stephen Warrenf78d3482012-06-04 10:59:23 +000035 "usb_init=" \
36 "if ${usb_need_init}; then " \
37 "set usb_need_init false; " \
38 "usb start 0; " \
39 "fi\0" \
40 \
Stephen Warrenbea26742012-05-16 06:21:00 +000041 "usb_boot=" \
42 "setenv devtype usb; " \
Stephen Warrenf78d3482012-06-04 10:59:23 +000043 BOOTCMD_INIT_USB \
Stephen Warrenbea26742012-05-16 06:21:00 +000044 "if usb dev ${devnum}; then " \
Stephen Warren03cddf22012-06-04 10:59:22 +000045 "run scan_boot; " \
Stephen Warrenbea26742012-05-16 06:21:00 +000046 "fi\0" \
Stephen Warrenf78d3482012-06-04 10:59:23 +000047 \
Stephen Warren03cddf22012-06-04 10:59:22 +000048 "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
49#define BOOT_TARGETS_USB "usb0"
Stephen Warrenbea26742012-05-16 06:21:00 +000050#else
Stephen Warrenf78d3482012-06-04 10:59:23 +000051#define BOOTCMD_INIT_USB ""
Stephen Warrenbea26742012-05-16 06:21:00 +000052#define BOOTCMDS_USB ""
Stephen Warren03cddf22012-06-04 10:59:22 +000053#define BOOT_TARGETS_USB ""
Stephen Warrenbea26742012-05-16 06:21:00 +000054#endif
55
56#ifdef CONFIG_CMD_DHCP
57#define BOOTCMDS_DHCP \
58 "bootcmd_dhcp=" \
Stephen Warrenf78d3482012-06-04 10:59:23 +000059 BOOTCMD_INIT_USB \
Stephen Warrenbea26742012-05-16 06:21:00 +000060 "if dhcp ${scriptaddr} boot.scr.uimg; then "\
61 "source ${scriptaddr}; " \
62 "fi\0"
Stephen Warren03cddf22012-06-04 10:59:22 +000063#define BOOT_TARGETS_DHCP "dhcp"
Stephen Warrenbea26742012-05-16 06:21:00 +000064#else
65#define BOOTCMDS_DHCP ""
Stephen Warren03cddf22012-06-04 10:59:22 +000066#define BOOT_TARGETS_DHCP ""
Stephen Warrenbea26742012-05-16 06:21:00 +000067#endif
68
Stephen Warrenf940c722014-02-05 09:24:59 -070069#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 Warrenbea26742012-05-16 06:21:00 +000083#define BOOTCMDS_COMMON \
Stephen Warrenbea26742012-05-16 06:21:00 +000084 "rootpart=1\0" \
Stephen Warren03cddf22012-06-04 10:59:22 +000085 \
Stephen Warren4d7d2e52014-02-05 09:24:58 -070086 "do_script_boot=" \
87 "load ${devtype} ${devnum}:${rootpart} " \
88 "${scriptaddr} ${prefix}${script}; " \
89 "source ${scriptaddr}\0" \
90 \
Stephen Warren03cddf22012-06-04 10:59:22 +000091 "script_boot=" \
Stephen Warren4d7d2e52014-02-05 09:24:58 -070092 "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 Warren72638b02014-06-19 10:52:58 -0600104 "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
Stephen Warren4d7d2e52014-02-05 09:24:58 -0700105 \
106 "sysboot_boot=" \
107 "if test -e ${devtype} ${devnum}:${rootpart} " \
Stephen Warren72638b02014-06-19 10:52:58 -0600108 "${prefix}extlinux/extlinux.conf; then " \
109 "echo Found ${prefix}extlinux/extlinux.conf; " \
Stephen Warren4d7d2e52014-02-05 09:24:58 -0700110 "run do_sysboot_boot; " \
111 "echo SCRIPT FAILED: continuing...; " \
112 "fi\0" \
Stephen Warren03cddf22012-06-04 10:59:22 +0000113 \
114 "scan_boot=" \
115 "echo Scanning ${devtype} ${devnum}...; " \
Stephen Warren3786a942012-11-05 13:22:00 +0000116 "for prefix in ${boot_prefixes}; do " \
Stephen Warren4d7d2e52014-02-05 09:24:58 -0700117 "run sysboot_boot; " \
118 "run script_boot; " \
119 "done\0" \
Stephen Warren03cddf22012-06-04 10:59:22 +0000120 \
121 "boot_targets=" \
122 BOOT_TARGETS_MMC " " \
123 BOOT_TARGETS_USB " " \
Stephen Warrenf940c722014-02-05 09:24:59 -0700124 BOOT_TARGETS_PXE " " \
Stephen Warren03cddf22012-06-04 10:59:22 +0000125 BOOT_TARGETS_DHCP " " \
126 "\0" \
127 \
Stephen Warren03cddf22012-06-04 10:59:22 +0000128 "boot_prefixes=/ /boot/\0" \
129 \
130 "boot_scripts=boot.scr.uimg boot.scr\0" \
131 \
Stephen Warrenbea26742012-05-16 06:21:00 +0000132 BOOTCMDS_MMC \
133 BOOTCMDS_USB \
Stephen Warrenf940c722014-02-05 09:24:59 -0700134 BOOTCMDS_DHCP \
135 BOOTCMDS_PXE
Stephen Warrenbea26742012-05-16 06:21:00 +0000136
Stephen Warren03cddf22012-06-04 10:59:22 +0000137#define CONFIG_BOOTCOMMAND \
Stephen Warren09266b22014-01-23 13:17:05 -0700138 "set usb_need_init; " \
Stephen Warren03cddf22012-06-04 10:59:22 +0000139 "for target in ${boot_targets}; do run bootcmd_${target}; done"
Stephen Warrenbea26742012-05-16 06:21:00 +0000140
141#endif
142
Allen Martin7992bfb2012-10-24 08:32:05 +0000143#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 Warrenc35eb562013-01-22 06:20:07 +0000157#ifdef CONFIG_VIDEO_TEGRA
158#define STDOUT_LCD ",lcd"
159#else
160#define STDOUT_LCD ""
161#endif
162
Allen Martin7992bfb2012-10-24 08:32:05 +0000163#define TEGRA_DEVICE_SETTINGS \
164 "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
Stephen Warrenc35eb562013-01-22 06:20:07 +0000165 "stdout=serial" STDOUT_LCD "\0" \
166 "stderr=serial" STDOUT_LCD "\0" \
167 ""
Allen Martin7992bfb2012-10-24 08:32:05 +0000168
Stephen Warrenb9b53a62014-01-23 13:17:01 -0700169#ifndef BOARD_EXTRA_ENV_SETTINGS
170#define BOARD_EXTRA_ENV_SETTINGS
171#endif
172
Stephen Warrenbea26742012-05-16 06:21:00 +0000173#define CONFIG_EXTRA_ENV_SETTINGS \
Tom Warren29f3e3f2012-09-04 17:00:24 -0700174 TEGRA_DEVICE_SETTINGS \
Stephen Warren938176a2012-10-02 09:26:51 +0000175 MEM_LAYOUT_ENV_SETTINGS \
Stephen Warrenfe7b7cd2014-06-19 10:52:59 -0600176 "fdt_high=ffffffff\0" \
177 "initrd_high=ffffffff\0" \
Stephen Warrenb9b53a62014-01-23 13:17:01 -0700178 BOOTCMDS_COMMON \
179 BOARD_EXTRA_ENV_SETTINGS
Stephen Warrenbea26742012-05-16 06:21:00 +0000180
Allen Martin77c42e82013-03-16 18:58:13 +0000181#if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
Allen Martin78f47b72013-03-16 18:58:07 +0000182#define CONFIG_FDT_SPI
183#endif
184
Allen Martin12b7b702012-08-31 08:30:12 +0000185/* overrides for SPL build here */
186#ifdef CONFIG_SPL_BUILD
187
Axel Lin60985bb2013-05-21 13:45:18 +0000188#define CONFIG_SKIP_LOWLEVEL_INIT
189
Allen Martin12b7b702012-08-31 08:30:12 +0000190/* remove devicetree support */
191#ifdef CONFIG_OF_CONTROL
192#undef CONFIG_OF_CONTROL
193#endif
194
Allen Martin12b7b702012-08-31 08:30:12 +0000195/* remove I2C support */
Simon Glass1f2ba722012-10-30 07:28:53 +0000196#ifdef CONFIG_SYS_I2C_TEGRA
197#undef CONFIG_SYS_I2C_TEGRA
Allen Martin12b7b702012-08-31 08:30:12 +0000198#endif
199#ifdef CONFIG_CMD_I2C
200#undef CONFIG_CMD_I2C
201#endif
202
203/* remove MMC support */
204#ifdef CONFIG_MMC
205#undef CONFIG_MMC
206#endif
207#ifdef CONFIG_GENERIC_MMC
208#undef CONFIG_GENERIC_MMC
209#endif
Tom Warren29f3e3f2012-09-04 17:00:24 -0700210#ifdef CONFIG_TEGRA_MMC
211#undef CONFIG_TEGRA_MMC
Allen Martin12b7b702012-08-31 08:30:12 +0000212#endif
213#ifdef CONFIG_CMD_MMC
214#undef CONFIG_CMD_MMC
215#endif
216
217/* remove partitions/filesystems */
218#ifdef CONFIG_DOS_PARTITION
219#undef CONFIG_DOS_PARTITION
220#endif
221#ifdef CONFIG_EFI_PARTITION
222#undef CONFIG_EFI_PARTITION
223#endif
Stephen Warren3786a942012-11-05 13:22:00 +0000224#ifdef CONFIG_CMD_FS_GENERIC
225#undef CONFIG_CMD_FS_GENERIC
226#endif
227#ifdef CONFIG_CMD_EXT4
228#undef CONFIG_CMD_EXT4
229#endif
Allen Martin12b7b702012-08-31 08:30:12 +0000230#ifdef CONFIG_CMD_EXT2
231#undef CONFIG_CMD_EXT2
232#endif
233#ifdef CONFIG_CMD_FAT
234#undef CONFIG_CMD_FAT
235#endif
Stephen Warren3786a942012-11-05 13:22:00 +0000236#ifdef CONFIG_FS_EXT4
237#undef CONFIG_FS_EXT4
238#endif
239#ifdef CONFIG_FS_FAT
240#undef CONFIG_FS_FAT
241#endif
Allen Martin12b7b702012-08-31 08:30:12 +0000242
243/* remove USB */
244#ifdef CONFIG_USB_EHCI
245#undef CONFIG_USB_EHCI
246#endif
247#ifdef CONFIG_USB_EHCI_TEGRA
248#undef CONFIG_USB_EHCI_TEGRA
249#endif
250#ifdef CONFIG_USB_STORAGE
251#undef CONFIG_USB_STORAGE
252#endif
253#ifdef CONFIG_CMD_USB
254#undef CONFIG_CMD_USB
255#endif
256
Stephen Warren01ca2862012-09-25 13:32:26 +0000257/* remove part command support */
258#ifdef CONFIG_PARTITION_UUIDS
259#undef CONFIG_PARTITION_UUIDS
260#endif
261
262#ifdef CONFIG_CMD_PART
263#undef CONFIG_CMD_PART
264#endif
265
Allen Martin12b7b702012-08-31 08:30:12 +0000266#endif /* CONFIG_SPL_BUILD */
267
Tom Warren29f3e3f2012-09-04 17:00:24 -0700268#endif /* __TEGRA_COMMON_POST_H */