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 #define CONFIG_SYS_NONCACHED_MEMORY	(1 << 20)	/* 1 MiB */
23 
24 #ifndef CONFIG_SPL_BUILD
25 #define BOOT_TARGET_DEVICES(func) \
26 	func(MMC, mmc, 1) \
27 	func(MMC, mmc, 0) \
28 	func(USB, usb, 0) \
29 	func(PXE, pxe, na) \
30 	func(DHCP, dhcp, na)
31 #include <config_distro_bootcmd.h>
32 #else
33 #define BOOTENV
34 #endif
35 
36 #ifdef CONFIG_TEGRA_KEYBOARD
37 #define STDIN_KBD_KBC ",tegra-kbc"
38 #else
39 #define STDIN_KBD_KBC ""
40 #endif
41 
42 #ifdef CONFIG_USB_KEYBOARD
43 #define STDIN_KBD_USB ",usbkbd"
44 #define CONFIG_PREBOOT			"usb start"
45 #else
46 #define STDIN_KBD_USB ""
47 #endif
48 
49 #ifdef CONFIG_LCD
50 #define STDOUT_LCD ",lcd"
51 #else
52 #define STDOUT_LCD ""
53 #endif
54 
55 #ifdef CONFIG_DM_VIDEO
56 #define STDOUT_VIDEO ",vidconsole"
57 #else
58 #define STDOUT_VIDEO ""
59 #endif
60 
61 #ifdef CONFIG_CROS_EC_KEYB
62 #define STDOUT_CROS_EC	",cros-ec-keyb"
63 #else
64 #define STDOUT_CROS_EC	""
65 #endif
66 
67 #define TEGRA_DEVICE_SETTINGS \
68 	"stdin=serial" STDIN_KBD_KBC STDIN_KBD_USB STDOUT_CROS_EC "\0" \
69 	"stdout=serial" STDOUT_LCD STDOUT_VIDEO "\0" \
70 	"stderr=serial" STDOUT_LCD STDOUT_VIDEO "\0" \
71 	""
72 
73 #ifndef BOARD_EXTRA_ENV_SETTINGS
74 #define BOARD_EXTRA_ENV_SETTINGS
75 #endif
76 
77 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
78 
79 #ifndef CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
80 #define CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
81 #endif
82 
83 #ifdef CONFIG_ARM64
84 #define FDT_HIGH "ffffffffffffffff"
85 #define INITRD_HIGH "ffffffffffffffff"
86 #else
87 #define FDT_HIGH "ffffffff"
88 #define INITRD_HIGH "ffffffff"
89 #endif
90 
91 #define CONFIG_EXTRA_ENV_SETTINGS \
92 	TEGRA_DEVICE_SETTINGS \
93 	MEM_LAYOUT_ENV_SETTINGS \
94 	"fdt_high=" FDT_HIGH "\0" \
95 	"initrd_high=" INITRD_HIGH "\0" \
96 	BOOTENV \
97 	BOARD_EXTRA_ENV_SETTINGS \
98 	CONFIG_CHROMEOS_EXTRA_ENV_SETTINGS
99 
100 #if defined(CONFIG_TEGRA20_SFLASH) || defined(CONFIG_TEGRA20_SLINK) || defined(CONFIG_TEGRA114_SPI)
101 #define CONFIG_TEGRA_SPI
102 #endif
103 
104 /* overrides for SPL build here */
105 #ifdef CONFIG_SPL_BUILD
106 
107 #define CONFIG_SKIP_LOWLEVEL_INIT_ONLY
108 
109 /* remove I2C support */
110 #ifdef CONFIG_SYS_I2C_TEGRA
111 #undef CONFIG_SYS_I2C_TEGRA
112 #endif
113 #ifdef CONFIG_CMD_I2C
114 #endif
115 
116 /* remove USB */
117 #ifdef CONFIG_USB_EHCI_TEGRA
118 #undef CONFIG_USB_EHCI_TEGRA
119 #endif
120 #ifdef CONFIG_CMD_USB
121 #endif
122 
123 #endif /* CONFIG_SPL_BUILD */
124 
125 #endif /* __TEGRA_COMMON_POST_H */
126