blob: a7cd065fb385cb05089d059038dd987e5e83fd23 [file] [log] [blame]
Simon Glasse14f1a22018-11-15 18:44:09 -07001// 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 Glasse14f1a22018-11-15 18:44:09 -07008#include <handoff.h>
Simon Glass3ba929a2020-10-30 21:38:53 -06009#include <asm/global_data.h>
Simon Glasse14f1a22018-11-15 18:44:09 -070010
11DECLARE_GLOBAL_DATA_PTR;
12
13void handoff_save_dram(struct spl_handoff *ho)
14{
Stefan Roesebbc88462020-08-12 11:55:46 +020015 struct bd_info *bd = gd->bd;
16 int i;
17
Simon Glasse14f1a22018-11-15 18:44:09 -070018 ho->ram_size = gd->ram_size;
Simon Glasse14f1a22018-11-15 18:44:09 -070019
Stefan Roesebbc88462020-08-12 11:55:46 +020020 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 Glasse14f1a22018-11-15 18:44:09 -070023 }
Simon Glasse14f1a22018-11-15 18:44:09 -070024}
25
26void handoff_load_dram_size(struct spl_handoff *ho)
27{
28 gd->ram_size = ho->ram_size;
29}
30
31void handoff_load_dram_banks(struct spl_handoff *ho)
32{
Stefan Roesebbc88462020-08-12 11:55:46 +020033 struct bd_info *bd = gd->bd;
34 int i;
Simon Glasse14f1a22018-11-15 18:44:09 -070035
Stefan Roesebbc88462020-08-12 11:55:46 +020036 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 Glasse14f1a22018-11-15 18:44:09 -070039 }
Simon Glasse14f1a22018-11-15 18:44:09 -070040}