blob: f2a70b1a35c87fcaed23f2eace5ded446d8a3f43 [file] [log] [blame]
Stephen Warrende17c292012-05-16 06:21:00 +00001/*
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 Warren22562a42012-09-04 17:00:24 -070024#ifndef __TEGRA_COMMON_POST_H
25#define __TEGRA_COMMON_POST_H
Stephen Warrende17c292012-05-16 06:21:00 +000026
27#ifdef CONFIG_BOOTCOMMAND
28
29#define BOOTCMDS_COMMON ""
30
31#else
32
Stephen Warrende17c292012-05-16 06:21:00 +000033#ifdef CONFIG_CMD_MMC
34#define BOOTCMDS_MMC \
35 "mmc_boot=" \
36 "setenv devtype mmc; " \
37 "if mmc dev ${devnum}; then " \
Stephen Warren6bb63c62012-06-04 10:59:22 +000038 "run scan_boot; " \
Stephen Warrende17c292012-05-16 06:21:00 +000039 "fi\0" \
Stephen Warren6bb63c62012-06-04 10:59:22 +000040 "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
41 "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
42#define BOOT_TARGETS_MMC "mmc1 mmc0"
Stephen Warrende17c292012-05-16 06:21:00 +000043#else
44#define BOOTCMDS_MMC ""
Stephen Warren6bb63c62012-06-04 10:59:22 +000045#define BOOT_TARGETS_MMC ""
Stephen Warrende17c292012-05-16 06:21:00 +000046#endif
47
48#ifdef CONFIG_CMD_USB
Stephen Warren86437a12012-06-04 10:59:23 +000049#define BOOTCMD_INIT_USB "run usb_init; "
Stephen Warrende17c292012-05-16 06:21:00 +000050#define BOOTCMDS_USB \
Stephen Warren86437a12012-06-04 10:59:23 +000051 "usb_init=" \
52 "if ${usb_need_init}; then " \
53 "set usb_need_init false; " \
54 "usb start 0; " \
55 "fi\0" \
56 \
Stephen Warrende17c292012-05-16 06:21:00 +000057 "usb_boot=" \
58 "setenv devtype usb; " \
Stephen Warren86437a12012-06-04 10:59:23 +000059 BOOTCMD_INIT_USB \
Stephen Warrende17c292012-05-16 06:21:00 +000060 "if usb dev ${devnum}; then " \
Stephen Warren6bb63c62012-06-04 10:59:22 +000061 "run scan_boot; " \
Stephen Warrende17c292012-05-16 06:21:00 +000062 "fi\0" \
Stephen Warren86437a12012-06-04 10:59:23 +000063 \
Stephen Warren6bb63c62012-06-04 10:59:22 +000064 "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
65#define BOOT_TARGETS_USB "usb0"
Stephen Warrende17c292012-05-16 06:21:00 +000066#else
Stephen Warren86437a12012-06-04 10:59:23 +000067#define BOOTCMD_INIT_USB ""
Stephen Warrende17c292012-05-16 06:21:00 +000068#define BOOTCMDS_USB ""
Stephen Warren6bb63c62012-06-04 10:59:22 +000069#define BOOT_TARGETS_USB ""
Stephen Warrende17c292012-05-16 06:21:00 +000070#endif
71
72#ifdef CONFIG_CMD_DHCP
73#define BOOTCMDS_DHCP \
74 "bootcmd_dhcp=" \
Stephen Warren86437a12012-06-04 10:59:23 +000075 BOOTCMD_INIT_USB \
Stephen Warrende17c292012-05-16 06:21:00 +000076 "if dhcp ${scriptaddr} boot.scr.uimg; then "\
77 "source ${scriptaddr}; " \
78 "fi\0"
Stephen Warren6bb63c62012-06-04 10:59:22 +000079#define BOOT_TARGETS_DHCP "dhcp"
Stephen Warrende17c292012-05-16 06:21:00 +000080#else
81#define BOOTCMDS_DHCP ""
Stephen Warren6bb63c62012-06-04 10:59:22 +000082#define BOOT_TARGETS_DHCP ""
Stephen Warrende17c292012-05-16 06:21:00 +000083#endif
84
85#define BOOTCMDS_COMMON \
Stephen Warrende17c292012-05-16 06:21:00 +000086 "rootpart=1\0" \
Stephen Warren6bb63c62012-06-04 10:59:22 +000087 \
88 "script_boot=" \
Stephen Warren480860c2012-11-05 13:22:00 +000089 "if load ${devtype} ${devnum}:${rootpart} " \
Stephen Warren6bb63c62012-06-04 10:59:22 +000090 "${scriptaddr} ${prefix}${script}; then " \
91 "echo ${script} found! Executing ...;" \
92 "source ${scriptaddr};" \
93 "fi;\0" \
94 \
95 "scan_boot=" \
96 "echo Scanning ${devtype} ${devnum}...; " \
Stephen Warren480860c2012-11-05 13:22:00 +000097 "for prefix in ${boot_prefixes}; do " \
98 "for script in ${boot_scripts}; do " \
99 "run script_boot; " \
Stephen Warren6bb63c62012-06-04 10:59:22 +0000100 "done; " \
101 "done;\0" \
102 \
103 "boot_targets=" \
104 BOOT_TARGETS_MMC " " \
105 BOOT_TARGETS_USB " " \
106 BOOT_TARGETS_DHCP " " \
107 "\0" \
108 \
Stephen Warren6bb63c62012-06-04 10:59:22 +0000109 "boot_prefixes=/ /boot/\0" \
110 \
111 "boot_scripts=boot.scr.uimg boot.scr\0" \
112 \
Stephen Warrende17c292012-05-16 06:21:00 +0000113 BOOTCMDS_MMC \
114 BOOTCMDS_USB \
115 BOOTCMDS_DHCP
116
Stephen Warren6bb63c62012-06-04 10:59:22 +0000117#define CONFIG_BOOTCOMMAND \
Stephen Warren6bb63c62012-06-04 10:59:22 +0000118 "for target in ${boot_targets}; do run bootcmd_${target}; done"
Stephen Warrende17c292012-05-16 06:21:00 +0000119
120#endif
121
Allen Martin50df8702012-10-24 08:32:05 +0000122#ifdef CONFIG_TEGRA_KEYBOARD
123#define STDIN_KBD_KBC ",tegra-kbc"
124#else
125#define STDIN_KBD_KBC ""
126#endif
127
128#ifdef CONFIG_USB_KEYBOARD
129#define STDIN_KBD_USB ",usbkbd"
130#define CONFIG_SYS_USB_EVENT_POLL
131#define CONFIG_PREBOOT "usb start"
132#else
133#define STDIN_KBD_USB ""
134#endif
135
Stephen Warren3f264792013-01-22 06:20:07 +0000136#ifdef CONFIG_VIDEO_TEGRA
137#define STDOUT_LCD ",lcd"
138#else
139#define STDOUT_LCD ""
140#endif
141
Allen Martin50df8702012-10-24 08:32:05 +0000142#define TEGRA_DEVICE_SETTINGS \
143 "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
Stephen Warren3f264792013-01-22 06:20:07 +0000144 "stdout=serial" STDOUT_LCD "\0" \
145 "stderr=serial" STDOUT_LCD "\0" \
146 ""
Allen Martin50df8702012-10-24 08:32:05 +0000147
Stephen Warrende17c292012-05-16 06:21:00 +0000148#define CONFIG_EXTRA_ENV_SETTINGS \
Tom Warren22562a42012-09-04 17:00:24 -0700149 TEGRA_DEVICE_SETTINGS \
Stephen Warren35305102012-10-02 09:26:51 +0000150 MEM_LAYOUT_ENV_SETTINGS \
Stephen Warrende17c292012-05-16 06:21:00 +0000151 BOOTCMDS_COMMON
152
Allen Martinc9c98462012-08-31 08:30:12 +0000153/* overrides for SPL build here */
154#ifdef CONFIG_SPL_BUILD
155
156/* remove devicetree support */
157#ifdef CONFIG_OF_CONTROL
158#undef CONFIG_OF_CONTROL
159#endif
160
Allen Martinc9c98462012-08-31 08:30:12 +0000161/* remove I2C support */
162#ifdef CONFIG_TEGRA_I2C
163#undef CONFIG_TEGRA_I2C
164#endif
165#ifdef CONFIG_CMD_I2C
166#undef CONFIG_CMD_I2C
167#endif
168
169/* remove MMC support */
170#ifdef CONFIG_MMC
171#undef CONFIG_MMC
172#endif
173#ifdef CONFIG_GENERIC_MMC
174#undef CONFIG_GENERIC_MMC
175#endif
Tom Warren22562a42012-09-04 17:00:24 -0700176#ifdef CONFIG_TEGRA_MMC
177#undef CONFIG_TEGRA_MMC
Allen Martinc9c98462012-08-31 08:30:12 +0000178#endif
179#ifdef CONFIG_CMD_MMC
180#undef CONFIG_CMD_MMC
181#endif
182
183/* remove partitions/filesystems */
184#ifdef CONFIG_DOS_PARTITION
185#undef CONFIG_DOS_PARTITION
186#endif
187#ifdef CONFIG_EFI_PARTITION
188#undef CONFIG_EFI_PARTITION
189#endif
Stephen Warren480860c2012-11-05 13:22:00 +0000190#ifdef CONFIG_CMD_FS_GENERIC
191#undef CONFIG_CMD_FS_GENERIC
192#endif
193#ifdef CONFIG_CMD_EXT4
194#undef CONFIG_CMD_EXT4
195#endif
Allen Martinc9c98462012-08-31 08:30:12 +0000196#ifdef CONFIG_CMD_EXT2
197#undef CONFIG_CMD_EXT2
198#endif
199#ifdef CONFIG_CMD_FAT
200#undef CONFIG_CMD_FAT
201#endif
Stephen Warren480860c2012-11-05 13:22:00 +0000202#ifdef CONFIG_FS_EXT4
203#undef CONFIG_FS_EXT4
204#endif
205#ifdef CONFIG_FS_FAT
206#undef CONFIG_FS_FAT
207#endif
Allen Martinc9c98462012-08-31 08:30:12 +0000208
209/* remove USB */
210#ifdef CONFIG_USB_EHCI
211#undef CONFIG_USB_EHCI
212#endif
213#ifdef CONFIG_USB_EHCI_TEGRA
214#undef CONFIG_USB_EHCI_TEGRA
215#endif
216#ifdef CONFIG_USB_STORAGE
217#undef CONFIG_USB_STORAGE
218#endif
219#ifdef CONFIG_CMD_USB
220#undef CONFIG_CMD_USB
221#endif
222
Stephen Warren91623dd2012-09-25 13:32:26 +0000223/* remove part command support */
224#ifdef CONFIG_PARTITION_UUIDS
225#undef CONFIG_PARTITION_UUIDS
226#endif
227
228#ifdef CONFIG_CMD_PART
229#undef CONFIG_CMD_PART
230#endif
231
Allen Martinc9c98462012-08-31 08:30:12 +0000232#endif /* CONFIG_SPL_BUILD */
233
Tom Warren22562a42012-09-04 17:00:24 -0700234#endif /* __TEGRA_COMMON_POST_H */