blob: 687513bda353fc55bba6adef877c93101662ce06 [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>
Tom Rini728cb882024-04-27 08:11:00 -060010#include <asm/u-boot.h>
Simon Glasse14f1a22018-11-15 18:44:09 -070011
12DECLARE_GLOBAL_DATA_PTR;
13
14void handoff_save_dram(struct spl_handoff *ho)
15{
Stefan Roesebbc88462020-08-12 11:55:46 +020016 struct bd_info *bd = gd->bd;
17 int i;
18
Simon Glasse14f1a22018-11-15 18:44:09 -070019 ho->ram_size = gd->ram_size;
Simon Glasse14f1a22018-11-15 18:44:09 -070020
Stefan Roesebbc88462020-08-12 11:55:46 +020021 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
22 ho->ram_bank[i].start = bd->bi_dram[i].start;
23 ho->ram_bank[i].size = bd->bi_dram[i].size;
Simon Glasse14f1a22018-11-15 18:44:09 -070024 }
Simon Glasse14f1a22018-11-15 18:44:09 -070025}
26
27void handoff_load_dram_size(struct spl_handoff *ho)
28{
29 gd->ram_size = ho->ram_size;
30}
31
32void handoff_load_dram_banks(struct spl_handoff *ho)
33{
Stefan Roesebbc88462020-08-12 11:55:46 +020034 struct bd_info *bd = gd->bd;
35 int i;
Simon Glasse14f1a22018-11-15 18:44:09 -070036
Stefan Roesebbc88462020-08-12 11:55:46 +020037 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
38 bd->bi_dram[i].start = ho->ram_bank[i].start;
39 bd->bi_dram[i].size = ho->ram_bank[i].size;
Simon Glasse14f1a22018-11-15 18:44:09 -070040 }
Simon Glasse14f1a22018-11-15 18:44:09 -070041}