summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8195/emi.c
blob: 6cbcae1bc5dd74b00c3e14fcc35adc4c0aa59810 (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
/* SPDX-License-Identifier: GPL-2.0-only */

#include <console/console.h>
#include <emi.h>
#include <soc/emi.h>

size_t sdram_size(void)
{
	int rank_num;
	u64 rank_size[RANK_MAX];
	static size_t dram_size = 0;

	if (dram_size)
		return dram_size;

	get_rank_size_by_emi(rank_size);
	rank_num = get_rank_nr_by_emi();

	for (int i = 0; i < rank_num; i++)
		dram_size += rank_size[i];

	printk(BIOS_INFO, "dram size = %#lx\n", dram_size);

	return dram_size;
}