summaryrefslogtreecommitdiff
path: root/common/init/handoff.c
blob: e00b43e6a7bcdef233b25c4837a0f3e40ab6ed2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-2.0+
/*
 * Passing basic information from SPL to U-Boot proper
 *
 * Copyright 2018 Google, Inc
 */

#include <common.h>
#include <handoff.h>

DECLARE_GLOBAL_DATA_PTR;

void handoff_save_dram(struct spl_handoff *ho)
{
	ho->ram_size = gd->ram_size;
#ifdef CONFIG_NR_DRAM_BANKS
	{
		struct bd_info *bd = gd->bd;
		int i;

		for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
			ho->ram_bank[i].start = bd->bi_dram[i].start;
			ho->ram_bank[i].size = bd->bi_dram[i].size;
		}
	}
#endif
}

void handoff_load_dram_size(struct spl_handoff *ho)
{
	gd->ram_size = ho->ram_size;
}

void handoff_load_dram_banks(struct spl_handoff *ho)
{
#ifdef CONFIG_NR_DRAM_BANKS
	{
		struct bd_info *bd = gd->bd;
		int i;

		for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
			bd->bi_dram[i].start = ho->ram_bank[i].start;
			bd->bi_dram[i].size = ho->ram_bank[i].size;
		}
	}
#endif
}