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