Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Passing basic information from SPL to U-Boot proper |
| 4 | * |
| 5 | * Copyright 2018 Google, Inc |
| 6 | */ |
| 7 | |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 8 | #include <handoff.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 9 | #include <asm/global_data.h> |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 10 | |
| 11 | DECLARE_GLOBAL_DATA_PTR; |
| 12 | |
| 13 | void handoff_save_dram(struct spl_handoff *ho) |
| 14 | { |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 15 | struct bd_info *bd = gd->bd; |
| 16 | int i; |
| 17 | |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 18 | ho->ram_size = gd->ram_size; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 19 | |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 20 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 21 | ho->ram_bank[i].start = bd->bi_dram[i].start; |
| 22 | ho->ram_bank[i].size = bd->bi_dram[i].size; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 23 | } |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | void handoff_load_dram_size(struct spl_handoff *ho) |
| 27 | { |
| 28 | gd->ram_size = ho->ram_size; |
| 29 | } |
| 30 | |
| 31 | void handoff_load_dram_banks(struct spl_handoff *ho) |
| 32 | { |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 33 | struct bd_info *bd = gd->bd; |
| 34 | int i; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 35 | |
Stefan Roese | bbc8846 | 2020-08-12 11:55:46 +0200 | [diff] [blame] | 36 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 37 | bd->bi_dram[i].start = ho->ram_bank[i].start; |
| 38 | bd->bi_dram[i].size = ho->ram_bank[i].size; |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 39 | } |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 40 | } |