blob: 94fd6c01eb70160b9d661b5ee19c1a3c6e5399d0 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Heiko Stübner0b3c26a2017-02-18 19:46:38 +01002/*
3 * (C) Copyright 2015 Google, Inc
Heiko Stübner0b3c26a2017-02-18 19:46:38 +01004 */
5
6#include <common.h>
7#include <clk.h>
8#include <dm.h>
9#include <ram.h>
10#include <syscon.h>
Simon Glassf473eba2019-01-21 14:53:31 -070011#include <asm/gpio.h>
Heiko Stübner0b3c26a2017-02-18 19:46:38 +010012#include <asm/io.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +080013#include <asm/arch-rockchip/clock.h>
14#include <asm/arch-rockchip/grf_rk3188.h>
15#include <asm/arch-rockchip/periph.h>
16#include <asm/arch-rockchip/pmu_rk3288.h>
17#include <asm/arch-rockchip/boot_mode.h>
Heiko Stübner0b3c26a2017-02-18 19:46:38 +010018
Alexander Kochetkova546c562018-02-26 15:37:42 +030019__weak int rk_board_late_init(void)
20{
21 return 0;
22}
23
Heiko Stübner015f69a2017-04-06 00:19:36 +020024int board_late_init(void)
25{
26 struct rk3188_grf *grf;
27
Andy Yan70378cb2017-10-11 15:00:16 +080028 setup_boot_mode();
Heiko Stübner015f69a2017-04-06 00:19:36 +020029 grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
30 if (IS_ERR(grf)) {
Masahiro Yamada81e10422017-09-16 14:10:41 +090031 pr_err("grf syscon returned %ld\n", PTR_ERR(grf));
Heiko Stübner015f69a2017-04-06 00:19:36 +020032 } else {
33 /* enable noc remap to mimic legacy loaders */
34 rk_clrsetreg(&grf->soc_con0,
35 NOC_REMAP_MASK << NOC_REMAP_SHIFT,
36 NOC_REMAP_MASK << NOC_REMAP_SHIFT);
37 }
38
Alexander Kochetkova546c562018-02-26 15:37:42 +030039 return rk_board_late_init();
Heiko Stübner015f69a2017-04-06 00:19:36 +020040}
41
Heiko Stübner0b3c26a2017-02-18 19:46:38 +010042int board_init(void)
43{
Heiko Stübner0b3c26a2017-02-18 19:46:38 +010044 return 0;
Heiko Stübner0b3c26a2017-02-18 19:46:38 +010045}
46
Trevor Woerner43ec7e02019-05-03 09:41:00 -040047#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
Heiko Stübner0b3c26a2017-02-18 19:46:38 +010048void enable_caches(void)
49{
50 /* Enable D-cache. I-cache is already enabled in start.S */
51 dcache_enable();
52}
53#endif