blob: a3242fe61299b2d34fb0d318fa04235cdf6c584c [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
69#define BOOTCMDS_COMMON \
Stephen Warrenbea26742012-05-16 06:21:00 +000070 "rootpart=1\0" \
Stephen Warren03cddf22012-06-04 10:59:22 +000071 \
72 "script_boot=" \
Stephen Warren3786a942012-11-05 13:22:00 +000073 "if load ${devtype} ${devnum}:${rootpart} " \
Stephen Warren03cddf22012-06-04 10:59:22 +000074 "${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 Warren3786a942012-11-05 13:22:00 +000081 "for prefix in ${boot_prefixes}; do " \
82 "for script in ${boot_scripts}; do " \
83 "run script_boot; " \
Stephen Warren03cddf22012-06-04 10:59:22 +000084 "done; " \
85 "done;\0" \
86 \
87 "boot_targets=" \
88 BOOT_TARGETS_MMC " " \
89 BOOT_TARGETS_USB " " \
90 BOOT_TARGETS_DHCP " " \
91 "\0" \
92 \
Stephen Warren03cddf22012-06-04 10:59:22 +000093 "boot_prefixes=/ /boot/\0" \
94 \
95 "boot_scripts=boot.scr.uimg boot.scr\0" \
96 \
Stephen Warrenbea26742012-05-16 06:21:00 +000097 BOOTCMDS_MMC \
98 BOOTCMDS_USB \
99 BOOTCMDS_DHCP
100
Stephen Warren03cddf22012-06-04 10:59:22 +0000101#define CONFIG_BOOTCOMMAND \
Stephen Warren03cddf22012-06-04 10:59:22 +0000102 "for target in ${boot_targets}; do run bootcmd_${target}; done"
Stephen Warrenbea26742012-05-16 06:21:00 +0000103
104#endif
105
Allen Martin7992bfb2012-10-24 08:32:05 +0000106#ifdef CONFIG_TEGRA_KEYBOARD
107#define STDIN_KBD_KBC ",tegra-kbc"
108#else
109#define STDIN_KBD_KBC ""
110#endif
111
112#ifdef CONFIG_USB_KEYBOARD
113#define STDIN_KBD_USB ",usbkbd"
114#define CONFIG_SYS_USB_EVENT_POLL
115#define CONFIG_PREBOOT "usb start"
116#else
117#define STDIN_KBD_USB ""
118#endif
119
Stephen Warrenc35eb562013-01-22 06:20:07 +0000120#ifdef CONFIG_VIDEO_TEGRA
121#define STDOUT_LCD ",lcd"
122#else
123#define STDOUT_LCD ""
124#endif
125
Allen Martin7992bfb2012-10-24 08:32:05 +0000126#define TEGRA_DEVICE_SETTINGS \
127 "stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB "\0" \
Stephen Warrenc35eb562013-01-22 06:20:07 +0000128 "stdout=serial" STDOUT_LCD "\0" \
129 "stderr=serial" STDOUT_LCD "\0" \
130 ""
Allen Martin7992bfb2012-10-24 08:32:05 +0000131
Stephen Warrenbea26742012-05-16 06:21:00 +0000132#define CONFIG_EXTRA_ENV_SETTINGS \
Tom Warren29f3e3f2012-09-04 17:00:24 -0700133 TEGRA_DEVICE_SETTINGS \
Stephen Warren938176a2012-10-02 09:26:51 +0000134 MEM_LAYOUT_ENV_SETTINGS \
Stephen Warrenbea26742012-05-16 06:21:00 +0000135 BOOTCMDS_COMMON
136
Allen Martin77c42e82013-03-16 18:58:13 +0000137#if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
Allen Martin78f47b72013-03-16 18:58:07 +0000138#define CONFIG_FDT_SPI
139#endif
140
Allen Martin12b7b702012-08-31 08:30:12 +0000141/* overrides for SPL build here */
142#ifdef CONFIG_SPL_BUILD
143
Axel Lin60985bb2013-05-21 13:45:18 +0000144#define CONFIG_SKIP_LOWLEVEL_INIT
145
Allen Martin12b7b702012-08-31 08:30:12 +0000146/* remove devicetree support */
147#ifdef CONFIG_OF_CONTROL
148#undef CONFIG_OF_CONTROL
149#endif
150
Allen Martin12b7b702012-08-31 08:30:12 +0000151/* remove I2C support */
Simon Glass1f2ba722012-10-30 07:28:53 +0000152#ifdef CONFIG_SYS_I2C_TEGRA
153#undef CONFIG_SYS_I2C_TEGRA
Allen Martin12b7b702012-08-31 08:30:12 +0000154#endif
155#ifdef CONFIG_CMD_I2C
156#undef CONFIG_CMD_I2C
157#endif
158
159/* remove MMC support */
160#ifdef CONFIG_MMC
161#undef CONFIG_MMC
162#endif
163#ifdef CONFIG_GENERIC_MMC
164#undef CONFIG_GENERIC_MMC
165#endif
Tom Warren29f3e3f2012-09-04 17:00:24 -0700166#ifdef CONFIG_TEGRA_MMC
167#undef CONFIG_TEGRA_MMC
Allen Martin12b7b702012-08-31 08:30:12 +0000168#endif
169#ifdef CONFIG_CMD_MMC
170#undef CONFIG_CMD_MMC
171#endif
172
173/* remove partitions/filesystems */
174#ifdef CONFIG_DOS_PARTITION
175#undef CONFIG_DOS_PARTITION
176#endif
177#ifdef CONFIG_EFI_PARTITION
178#undef CONFIG_EFI_PARTITION
179#endif
Stephen Warren3786a942012-11-05 13:22:00 +0000180#ifdef CONFIG_CMD_FS_GENERIC
181#undef CONFIG_CMD_FS_GENERIC
182#endif
183#ifdef CONFIG_CMD_EXT4
184#undef CONFIG_CMD_EXT4
185#endif
Allen Martin12b7b702012-08-31 08:30:12 +0000186#ifdef CONFIG_CMD_EXT2
187#undef CONFIG_CMD_EXT2
188#endif
189#ifdef CONFIG_CMD_FAT
190#undef CONFIG_CMD_FAT
191#endif
Stephen Warren3786a942012-11-05 13:22:00 +0000192#ifdef CONFIG_FS_EXT4
193#undef CONFIG_FS_EXT4
194#endif
195#ifdef CONFIG_FS_FAT
196#undef CONFIG_FS_FAT
197#endif
Allen Martin12b7b702012-08-31 08:30:12 +0000198
199/* remove USB */
200#ifdef CONFIG_USB_EHCI
201#undef CONFIG_USB_EHCI
202#endif
203#ifdef CONFIG_USB_EHCI_TEGRA
204#undef CONFIG_USB_EHCI_TEGRA
205#endif
206#ifdef CONFIG_USB_STORAGE
207#undef CONFIG_USB_STORAGE
208#endif
209#ifdef CONFIG_CMD_USB
210#undef CONFIG_CMD_USB
211#endif
212
Stephen Warren01ca2862012-09-25 13:32:26 +0000213/* remove part command support */
214#ifdef CONFIG_PARTITION_UUIDS
215#undef CONFIG_PARTITION_UUIDS
216#endif
217
218#ifdef CONFIG_CMD_PART
219#undef CONFIG_CMD_PART
220#endif
221
Allen Martin12b7b702012-08-31 08:30:12 +0000222#endif /* CONFIG_SPL_BUILD */
223
Tom Warren29f3e3f2012-09-04 17:00:24 -0700224#endif /* __TEGRA_COMMON_POST_H */