blob: e8badb99ea367e56085e117d3cb851b4cf179c71 [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
Allen Martin55d98a12012-08-31 08:30:00 +000024#ifndef __TEGRA20_COMMON_POST_H
25#define __TEGRA20_COMMON_POST_H
Stephen Warrende17c292012-05-16 06:21:00 +000026
27#ifdef CONFIG_BOOTCOMMAND
28
29#define BOOTCMDS_COMMON ""
30
31#else
32
33#ifdef CONFIG_CMD_EXT2
Stephen Warren6bb63c62012-06-04 10:59:22 +000034#define BOOT_FSTYPE_EXT2 "ext2 "
Stephen Warrende17c292012-05-16 06:21:00 +000035#else
Stephen Warren6bb63c62012-06-04 10:59:22 +000036#define BOOT_FSTYPE_EXT2 ""
Stephen Warrende17c292012-05-16 06:21:00 +000037#endif
38
39#ifdef CONFIG_CMD_FAT
Stephen Warren6bb63c62012-06-04 10:59:22 +000040#define BOOT_FSTYPE_FAT "fat"
Stephen Warrende17c292012-05-16 06:21:00 +000041#else
Stephen Warren6bb63c62012-06-04 10:59:22 +000042#define BOOT_FSTYPE_FAT ""
Stephen Warrende17c292012-05-16 06:21:00 +000043#endif
44
45#ifdef CONFIG_CMD_MMC
46#define BOOTCMDS_MMC \
47 "mmc_boot=" \
48 "setenv devtype mmc; " \
49 "if mmc dev ${devnum}; then " \
Stephen Warren6bb63c62012-06-04 10:59:22 +000050 "run scan_boot; " \
Stephen Warrende17c292012-05-16 06:21:00 +000051 "fi\0" \
Stephen Warren6bb63c62012-06-04 10:59:22 +000052 "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
53 "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
54#define BOOT_TARGETS_MMC "mmc1 mmc0"
Stephen Warrende17c292012-05-16 06:21:00 +000055#else
56#define BOOTCMDS_MMC ""
Stephen Warren6bb63c62012-06-04 10:59:22 +000057#define BOOT_TARGETS_MMC ""
Stephen Warrende17c292012-05-16 06:21:00 +000058#endif
59
60#ifdef CONFIG_CMD_USB
Stephen Warren86437a12012-06-04 10:59:23 +000061#define BOOTCMD_INIT_USB "run usb_init; "
Stephen Warrende17c292012-05-16 06:21:00 +000062#define BOOTCMDS_USB \
Stephen Warren86437a12012-06-04 10:59:23 +000063 "usb_init=" \
64 "if ${usb_need_init}; then " \
65 "set usb_need_init false; " \
66 "usb start 0; " \
67 "fi\0" \
68 \
Stephen Warrende17c292012-05-16 06:21:00 +000069 "usb_boot=" \
70 "setenv devtype usb; " \
Stephen Warren86437a12012-06-04 10:59:23 +000071 BOOTCMD_INIT_USB \
Stephen Warrende17c292012-05-16 06:21:00 +000072 "if usb dev ${devnum}; then " \
Stephen Warren6bb63c62012-06-04 10:59:22 +000073 "run scan_boot; " \
Stephen Warrende17c292012-05-16 06:21:00 +000074 "fi\0" \
Stephen Warren86437a12012-06-04 10:59:23 +000075 \
Stephen Warren6bb63c62012-06-04 10:59:22 +000076 "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
77#define BOOT_TARGETS_USB "usb0"
Stephen Warrende17c292012-05-16 06:21:00 +000078#else
Stephen Warren86437a12012-06-04 10:59:23 +000079#define BOOTCMD_INIT_USB ""
Stephen Warrende17c292012-05-16 06:21:00 +000080#define BOOTCMDS_USB ""
Stephen Warren6bb63c62012-06-04 10:59:22 +000081#define BOOT_TARGETS_USB ""
Stephen Warrende17c292012-05-16 06:21:00 +000082#endif
83
84#ifdef CONFIG_CMD_DHCP
85#define BOOTCMDS_DHCP \
86 "bootcmd_dhcp=" \
Stephen Warren86437a12012-06-04 10:59:23 +000087 BOOTCMD_INIT_USB \
Stephen Warrende17c292012-05-16 06:21:00 +000088 "if dhcp ${scriptaddr} boot.scr.uimg; then "\
89 "source ${scriptaddr}; " \
90 "fi\0"
Stephen Warren6bb63c62012-06-04 10:59:22 +000091#define BOOT_TARGETS_DHCP "dhcp"
Stephen Warrende17c292012-05-16 06:21:00 +000092#else
93#define BOOTCMDS_DHCP ""
Stephen Warren6bb63c62012-06-04 10:59:22 +000094#define BOOT_TARGETS_DHCP ""
Stephen Warrende17c292012-05-16 06:21:00 +000095#endif
96
97#define BOOTCMDS_COMMON \
98 "scriptaddr=0x400000\0" \
Stephen Warren6bb63c62012-06-04 10:59:22 +000099 \
Stephen Warrende17c292012-05-16 06:21:00 +0000100 "rootpart=1\0" \
Stephen Warren6bb63c62012-06-04 10:59:22 +0000101 \
102 "script_boot=" \
103 "if ${fs}load ${devtype} ${devnum}:${rootpart} " \
104 "${scriptaddr} ${prefix}${script}; then " \
105 "echo ${script} found! Executing ...;" \
106 "source ${scriptaddr};" \
107 "fi;\0" \
108 \
109 "scan_boot=" \
110 "echo Scanning ${devtype} ${devnum}...; " \
111 "for fs in ${boot_fstypes}; do " \
112 "for prefix in ${boot_prefixes}; do " \
113 "for script in ${boot_scripts}; do " \
114 "run script_boot; " \
115 "done; " \
116 "done; " \
117 "done;\0" \
118 \
119 "boot_targets=" \
120 BOOT_TARGETS_MMC " " \
121 BOOT_TARGETS_USB " " \
122 BOOT_TARGETS_DHCP " " \
123 "\0" \
124 \
125 "boot_fstypes=" \
126 BOOT_FSTYPE_EXT2 " " \
127 BOOT_FSTYPE_FAT " " \
128 "\0" \
129 \
130 "boot_prefixes=/ /boot/\0" \
131 \
132 "boot_scripts=boot.scr.uimg boot.scr\0" \
133 \
Stephen Warrende17c292012-05-16 06:21:00 +0000134 BOOTCMDS_MMC \
135 BOOTCMDS_USB \
136 BOOTCMDS_DHCP
137
Stephen Warren6bb63c62012-06-04 10:59:22 +0000138#define CONFIG_BOOTCOMMAND \
Stephen Warren6bb63c62012-06-04 10:59:22 +0000139 "for target in ${boot_targets}; do run bootcmd_${target}; done"
Stephen Warrende17c292012-05-16 06:21:00 +0000140
141#endif
142
143#define CONFIG_EXTRA_ENV_SETTINGS \
Allen Martin55d98a12012-08-31 08:30:00 +0000144 TEGRA20_DEVICE_SETTINGS \
Stephen Warren09472882012-06-13 09:55:12 +0000145 "fdt_load=0x01000000\0" \
146 "fdt_high=01100000\0" \
Stephen Warrende17c292012-05-16 06:21:00 +0000147 BOOTCMDS_COMMON
148
Allen Martin55d98a12012-08-31 08:30:00 +0000149#endif /* __TEGRA20_COMMON_POST_H */