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 /*
12  * Size of malloc() pool
13  */
14 #ifdef CONFIG_USB_FUNCTION_DFU
15 #define CONFIG_SYS_MALLOC_LEN	(SZ_4M + \
16 					CONFIG_SYS_DFU_DATA_BUF_SIZE + \
17 					CONFIG_SYS_DFU_MAX_FILE_SIZE)
18 #else
19 #define CONFIG_SYS_MALLOC_LEN		(4 << 20)	/* 4MB  */
20 #endif
21 
22 #ifndef CONFIG_ARM64
23 #define CONFIG_SYS_NONCACHED_MEMORY	(1 << 20)	/* 1 MiB */
24 #endif
25 
26 #ifndef CONFIG_SPL_BUILD
27 #define BOOT_TARGET_DEVICES(func) \
28 	func(MMC, mmc, 1) \
29 	func(MMC, mmc, 0) \
30 	func(USB, usb, 0) \
31 	func(PXE, pxe, na) \
32 	func(DHCP, dhcp, na)
33 #include <config_distro_bootcmd.h>
34 #else
35 #define BOOTENV
36 #endif
37 
38 #ifdef CONFIG_TEGRA_KEYBOARD
39 #define STDIN_KBD_KBC ",tegra-kbc"
40 #else
41 #define STDIN_KBD_KBC ""
42 #endif
43 
44 #ifdef CONFIG_USB_KEYBOARD
45 #define STDIN_KBD_USB ",usbkbd"
46 #define CONFIG_SYS_USB_EVENT_POLL
47 #define CONFIG_PREBOOT			"usb start"
48 #else
49 #define STDIN_KBD_USB ""
50 #endif
51 
52 #ifdef CONFIG_LCD
53 #define STDOUT_LCD ",lcd"
54 #else
55 #define STDOUT_LCD ""
56 #endif
57 
58 #ifdef CONFIG_CROS_EC_KEYB
59 #define STDOUT_CROS_EC	",cros-ec-keyb"
60 #else
61 #define STDOUT_CROS_EC	""
62 #endif
63 
64 #define TEGRA_DEVICE_SETTINGS \
65 	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB STDOUT_CROS_EC "\0" \
66 	"stdout=serial" STDOUT_LCD "\0" \
67 	"stderr=serial" STDOUT_LCD "\0" \
68 	""
69 
70 #ifndef BOARD_EXTRA_ENV_SETTINGS
71 #define BOARD_EXTRA_ENV_SETTINGS
72 #endif
73 
74 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
75 
76 #ifndef CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
77 #define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
78 #endif
79 
80 #ifdef CONFIG_ARM64
81 #define FDT_HIGH "ffffffffffffffff"
82 #define INITRD_HIGH "ffffffffffffffff"
83 #else
84 #define FDT_HIGH "ffffffff"
85 #define INITRD_HIGH "ffffffff"
86 #endif
87 
88 #define CONFIG_EXTRA_ENV_SETTINGS \
89 	TEGRA_DEVICE_SETTINGS \
90 	MEM_LAYOUT_ENV_SETTINGS \
91 	"fdt_high=" FDT_HIGH "\0" \
92 	"initrd_high=" INITRD_HIGH "\0" \
93 	BOOTENV \
94 	BOARD_EXTRA_ENV_SETTINGS \
95 	CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
96 
97 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
98 #define CONFIG_TEGRA_SPI
99 #endif
100 
101 /* overrides for SPL build here */
102 #ifdef CONFIG_SPL_BUILD
103 
104 #define CONFIG_SKIP_LOWLEVEL_INIT
105 
106 /* remove I2C support */
107 #ifdef CONFIG_SYS_I2C_TEGRA
108 #undef CONFIG_SYS_I2C_TEGRA
109 #endif
110 #ifdef CONFIG_CMD_I2C
111 #undef CONFIG_CMD_I2C
112 #endif
113 
114 /* remove MMC support */
115 #ifdef CONFIG_MMC
116 #undef CONFIG_MMC
117 #endif
118 #ifdef CONFIG_GENERIC_MMC
119 #undef CONFIG_GENERIC_MMC
120 #endif
121 #ifdef CONFIG_TEGRA_MMC
122 #undef CONFIG_TEGRA_MMC
123 #endif
124 #ifdef CONFIG_CMD_MMC
125 #undef CONFIG_CMD_MMC
126 #endif
127 
128 /* remove partitions/filesystems */
129 #ifdef CONFIG_DOS_PARTITION
130 #undef CONFIG_DOS_PARTITION
131 #endif
132 #ifdef CONFIG_EFI_PARTITION
133 #undef CONFIG_EFI_PARTITION
134 #endif
135 #ifdef CONFIG_CMD_FS_GENERIC
136 #undef CONFIG_CMD_FS_GENERIC
137 #endif
138 #ifdef CONFIG_CMD_EXT4
139 #undef CONFIG_CMD_EXT4
140 #endif
141 #ifdef CONFIG_CMD_EXT2
142 #undef CONFIG_CMD_EXT2
143 #endif
144 #ifdef CONFIG_CMD_FAT
145 #undef CONFIG_CMD_FAT
146 #endif
147 #ifdef CONFIG_FS_EXT4
148 #undef CONFIG_FS_EXT4
149 #endif
150 #ifdef CONFIG_FS_FAT
151 #undef CONFIG_FS_FAT
152 #endif
153 
154 /* remove USB */
155 #ifdef CONFIG_USB_EHCI
156 #undef CONFIG_USB_EHCI
157 #endif
158 #ifdef CONFIG_USB_EHCI_TEGRA
159 #undef CONFIG_USB_EHCI_TEGRA
160 #endif
161 #ifdef CONFIG_USB_STORAGE
162 #undef CONFIG_USB_STORAGE
163 #endif
164 #ifdef CONFIG_CMD_USB
165 #undef CONFIG_CMD_USB
166 #endif
167 
168 /* remove part command support */
169 #ifdef CONFIG_PARTITION_UUIDS
170 #undef CONFIG_PARTITION_UUIDS
171 #endif
172 
173 #ifdef CONFIG_CMD_PART
174 #undef CONFIG_CMD_PART
175 #endif
176 
177 #endif /* CONFIG_SPL_BUILD */
178 
179 #endif /* __TEGRA_COMMON_POST_H */
180