Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2015 Google, Inc |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <clk.h> |
| 8 | #include <dm.h> |
| 9 | #include <ram.h> |
| 10 | #include <syscon.h> |
Simon Glass | f473eba | 2019-01-21 14:53:31 -0700 | [diff] [blame] | 11 | #include <asm/gpio.h> |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 12 | #include <asm/io.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 13 | #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übner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 18 | |
Alexander Kochetkov | a546c56 | 2018-02-26 15:37:42 +0300 | [diff] [blame] | 19 | __weak int rk_board_late_init(void) |
| 20 | { |
| 21 | return 0; |
| 22 | } |
| 23 | |
Heiko Stübner | 015f69a | 2017-04-06 00:19:36 +0200 | [diff] [blame] | 24 | int board_late_init(void) |
| 25 | { |
| 26 | struct rk3188_grf *grf; |
| 27 | |
Andy Yan | 70378cb | 2017-10-11 15:00:16 +0800 | [diff] [blame] | 28 | setup_boot_mode(); |
Heiko Stübner | 015f69a | 2017-04-06 00:19:36 +0200 | [diff] [blame] | 29 | grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); |
| 30 | if (IS_ERR(grf)) { |
Masahiro Yamada | 81e1042 | 2017-09-16 14:10:41 +0900 | [diff] [blame] | 31 | pr_err("grf syscon returned %ld\n", PTR_ERR(grf)); |
Heiko Stübner | 015f69a | 2017-04-06 00:19:36 +0200 | [diff] [blame] | 32 | } 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 Kochetkov | a546c56 | 2018-02-26 15:37:42 +0300 | [diff] [blame] | 39 | return rk_board_late_init(); |
Heiko Stübner | 015f69a | 2017-04-06 00:19:36 +0200 | [diff] [blame] | 40 | } |
| 41 | |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 42 | int board_init(void) |
| 43 | { |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 44 | return 0; |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 45 | } |
| 46 | |
Trevor Woerner | 43ec7e0 | 2019-05-03 09:41:00 -0400 | [diff] [blame] | 47 | #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) |
Heiko Stübner | 0b3c26a | 2017-02-18 19:46:38 +0100 | [diff] [blame] | 48 | void enable_caches(void) |
| 49 | { |
| 50 | /* Enable D-cache. I-cache is already enabled in start.S */ |
| 51 | dcache_enable(); |
| 52 | } |
| 53 | #endif |