1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2016 Google, Inc
4  * Written by Simon Glass <sjg@chromium.org>
5  */
6 
7 #include <common.h>
8 #include <bloblist.h>
9 #include <cpu_func.h>
10 #include <debug_uart.h>
11 #include <handoff.h>
12 #include <init.h>
13 #include <log.h>
14 #include <asm/mtrr.h>
15 
misc_init_r(void)16 int misc_init_r(void)
17 {
18 	return 0;
19 }
20 
dram_init(void)21 int dram_init(void)
22 {
23 	struct spl_handoff *ho;
24 
25 	ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(*ho));
26 	if (!ho)
27 		return log_msg_ret("Missing SPL hand-off info", -ENOENT);
28 	handoff_load_dram_size(ho);
29 #ifdef CONFIG_TPL
30 	/* TODO(sjg@chromium.org): MTRR cannot be adjusted without a hang */
31 	mtrr_add_request(MTRR_TYPE_WRBACK, 0, 2ULL << 30);
32 #else
33 	mtrr_add_request(MTRR_TYPE_WRBACK, 0, gd->ram_size);
34 	mtrr_commit(true);
35 #endif
36 
37 	return 0;
38 }
39 
checkcpu(void)40 int checkcpu(void)
41 {
42 	return 0;
43 }
44 
print_cpuinfo(void)45 int print_cpuinfo(void)
46 {
47 	return 0;
48 }
49 
board_debug_uart_init(void)50 void board_debug_uart_init(void)
51 {
52 }
53 
dram_init_banksize(void)54 int dram_init_banksize(void)
55 {
56 #ifdef CONFIG_NR_DRAM_BANKS
57 	struct spl_handoff *ho;
58 
59 	ho = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(*ho));
60 	if (!ho)
61 		return log_msg_ret("Missing SPL hand-off info", -ENOENT);
62 	handoff_load_dram_banks(ho);
63 #endif
64 
65 	return 0;
66 }
67