diff options
Diffstat (limited to 'arch/arm/mach-tegra/board.c')
-rw-r--r-- | arch/arm/mach-tegra/board.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c index f8fc042a1d..abcae15ea3 100644 --- a/arch/arm/mach-tegra/board.c +++ b/arch/arm/mach-tegra/board.c | |||
@@ -9,12 +9,19 @@ | |||
9 | #include <ns16550.h> | 9 | #include <ns16550.h> |
10 | #include <spl.h> | 10 | #include <spl.h> |
11 | #include <asm/io.h> | 11 | #include <asm/io.h> |
12 | #if IS_ENABLED(CONFIG_TEGRA_CLKRST) | ||
12 | #include <asm/arch/clock.h> | 13 | #include <asm/arch/clock.h> |
14 | #endif | ||
15 | #if IS_ENABLED(CONFIG_TEGRA_PINCTRL) | ||
13 | #include <asm/arch/funcmux.h> | 16 | #include <asm/arch/funcmux.h> |
17 | #endif | ||
18 | #if IS_ENABLED(CONFIG_TEGRA_MC) | ||
14 | #include <asm/arch/mc.h> | 19 | #include <asm/arch/mc.h> |
20 | #endif | ||
15 | #include <asm/arch/tegra.h> | 21 | #include <asm/arch/tegra.h> |
16 | #include <asm/arch-tegra/ap.h> | 22 | #include <asm/arch-tegra/ap.h> |
17 | #include <asm/arch-tegra/board.h> | 23 | #include <asm/arch-tegra/board.h> |
24 | #include <asm/arch-tegra/cboot.h> | ||
18 | #include <asm/arch-tegra/pmc.h> | 25 | #include <asm/arch-tegra/pmc.h> |
19 | #include <asm/arch-tegra/sys_proto.h> | 26 | #include <asm/arch-tegra/sys_proto.h> |
20 | #include <asm/arch-tegra/warmboot.h> | 27 | #include <asm/arch-tegra/warmboot.h> |
@@ -36,9 +43,25 @@ enum { | |||
36 | static bool from_spl __attribute__ ((section(".data"))); | 43 | static bool from_spl __attribute__ ((section(".data"))); |
37 | 44 | ||
38 | #ifndef CONFIG_SPL_BUILD | 45 | #ifndef CONFIG_SPL_BUILD |
39 | void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3) | 46 | void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2, |
47 | unsigned long r3) | ||
40 | { | 48 | { |
41 | from_spl = r0 != UBOOT_NOT_LOADED_FROM_SPL; | 49 | from_spl = r0 != UBOOT_NOT_LOADED_FROM_SPL; |
50 | |||
51 | /* | ||
52 | * The logic for this is somewhat indirect. The purpose of the marker | ||
53 | * (UBOOT_NOT_LOADED_FROM_SPL) is in fact used to determine if U-Boot | ||
54 | * was loaded from a read-only instance of itself, which is something | ||
55 | * that can happen in secure boot setups. So basically the presence | ||
56 | * of the marker is an indication that U-Boot was loaded by one such | ||
57 | * special variant of U-Boot. Conversely, the absence of the marker | ||
58 | * indicates that this instance of U-Boot was loaded by something | ||
59 | * other than a special U-Boot. This could be SPL, but it could just | ||
60 | * as well be one of any number of other first stage bootloaders. | ||
61 | */ | ||
62 | if (from_spl) | ||
63 | cboot_save_boot_params(r0, r1, r2, r3); | ||
64 | |||
42 | save_boot_params_ret(); | 65 | save_boot_params_ret(); |
43 | } | 66 | } |
44 | #endif | 67 | #endif |
@@ -66,6 +89,7 @@ bool tegra_cpu_is_non_secure(void) | |||
66 | } | 89 | } |
67 | #endif | 90 | #endif |
68 | 91 | ||
92 | #if IS_ENABLED(CONFIG_TEGRA_MC) | ||
69 | /* Read the RAM size directly from the memory controller */ | 93 | /* Read the RAM size directly from the memory controller */ |
70 | static phys_size_t query_sdram_size(void) | 94 | static phys_size_t query_sdram_size(void) |
71 | { | 95 | { |
@@ -115,14 +139,26 @@ static phys_size_t query_sdram_size(void) | |||
115 | 139 | ||
116 | return size_bytes; | 140 | return size_bytes; |
117 | } | 141 | } |
142 | #endif | ||
118 | 143 | ||
119 | int dram_init(void) | 144 | int dram_init(void) |
120 | { | 145 | { |
146 | int err; | ||
147 | |||
148 | /* try to initialize DRAM from cboot DTB first */ | ||
149 | err = cboot_dram_init(); | ||
150 | if (err == 0) | ||
151 | return 0; | ||
152 | |||
153 | #if IS_ENABLED(CONFIG_TEGRA_MC) | ||
121 | /* We do not initialise DRAM here. We just query the size */ | 154 | /* We do not initialise DRAM here. We just query the size */ |
122 | gd->ram_size = query_sdram_size(); | 155 | gd->ram_size = query_sdram_size(); |
156 | #endif | ||
157 | |||
123 | return 0; | 158 | return 0; |
124 | } | 159 | } |
125 | 160 | ||
161 | #if IS_ENABLED(CONFIG_TEGRA_PINCTRL) | ||
126 | static int uart_configs[] = { | 162 | static int uart_configs[] = { |
127 | #if defined(CONFIG_TEGRA20) | 163 | #if defined(CONFIG_TEGRA20) |
128 | #if defined(CONFIG_TEGRA_UARTA_UAA_UAB) | 164 | #if defined(CONFIG_TEGRA_UARTA_UAA_UAB) |
@@ -190,9 +226,11 @@ static void setup_uarts(int uart_ids) | |||
190 | } | 226 | } |
191 | } | 227 | } |
192 | } | 228 | } |
229 | #endif | ||
193 | 230 | ||
194 | void board_init_uart_f(void) | 231 | void board_init_uart_f(void) |
195 | { | 232 | { |
233 | #if IS_ENABLED(CONFIG_TEGRA_PINCTRL) | ||
196 | int uart_ids = 0; /* bit mask of which UART ids to enable */ | 234 | int uart_ids = 0; /* bit mask of which UART ids to enable */ |
197 | 235 | ||
198 | #ifdef CONFIG_TEGRA_ENABLE_UARTA | 236 | #ifdef CONFIG_TEGRA_ENABLE_UARTA |
@@ -211,6 +249,7 @@ void board_init_uart_f(void) | |||
211 | uart_ids |= UARTE; | 249 | uart_ids |= UARTE; |
212 | #endif | 250 | #endif |
213 | setup_uarts(uart_ids); | 251 | setup_uarts(uart_ids); |
252 | #endif | ||
214 | } | 253 | } |
215 | 254 | ||
216 | #if !CONFIG_IS_ENABLED(OF_CONTROL) | 255 | #if !CONFIG_IS_ENABLED(OF_CONTROL) |
@@ -226,7 +265,7 @@ U_BOOT_DEVICE(ns16550_com1) = { | |||
226 | }; | 265 | }; |
227 | #endif | 266 | #endif |
228 | 267 | ||
229 | #if !defined(CONFIG_SYS_DCACHE_OFF) && !defined(CONFIG_ARM64) | 268 | #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) && !defined(CONFIG_ARM64) |
230 | void enable_caches(void) | 269 | void enable_caches(void) |
231 | { | 270 | { |
232 | /* Enable D-cache. I-cache is already enabled in start.S */ | 271 | /* Enable D-cache. I-cache is already enabled in start.S */ |