summaryrefslogtreecommitdiffstats
path: root/src/mainboard/google/oak/romstage.c
blob: c429859abeee43ba2a037b7ee16b15884dbea2b9 (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
/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */

#include <arch/stages.h>
#include <boardid.h>
#include <soc/emi.h>
#include <soc/mmu_operations.h>
#include <soc/mt6391.h>
#include <soc/pll.h>
#include <soc/rtc.h>
#include <timer.h>

void platform_romstage_main(void)
{
	int stabilize_usec;
	struct stopwatch sw;

	rtc_boot();

	/* Raise CPU voltage to allow higher frequency */
	stabilize_usec = mt6391_configure_ca53_voltage(1125000);

	stopwatch_init_usecs_expire(&sw, stabilize_usec);

	/* init memory */
	mt_mem_init(get_sdram_config());

	stopwatch_wait_until_expired(&sw);

	/* Set to maximum frequency */
	if (board_id() + CONFIG_BOARD_ID_ADJUSTMENT < 5)
		mt_pll_raise_ca53_freq(1600 * MHz);
	else
		mt_pll_raise_ca53_freq(1700 * MHz);

	mtk_mmu_after_dram();
}