2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-08-12 09:58:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Rockchip Electronics Co., Ltd
|
|
|
|
*/
|
2019-07-09 13:58:44 +00:00
|
|
|
#include <asm/armv7.h>
|
2016-08-12 09:58:12 +00:00
|
|
|
#include <asm/io.h>
|
2019-03-28 03:01:23 +00:00
|
|
|
#include <asm/arch-rockchip/hardware.h>
|
2019-03-29 01:09:03 +00:00
|
|
|
#include <asm/arch-rockchip/grf_rk3288.h>
|
2016-08-12 09:58:12 +00:00
|
|
|
|
2019-03-29 01:09:03 +00:00
|
|
|
#define GRF_BASE 0xff770000
|
2016-08-12 09:58:12 +00:00
|
|
|
|
2019-07-09 13:58:44 +00:00
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
|
|
static void configure_l2ctlr(void)
|
|
|
|
{
|
|
|
|
u32 l2ctlr;
|
|
|
|
|
|
|
|
l2ctlr = read_l2ctlr();
|
|
|
|
l2ctlr &= 0xfffc0000; /* clear bit0~bit17 */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Data RAM write latency: 2 cycles
|
|
|
|
* Data RAM read latency: 2 cycles
|
|
|
|
* Data RAM setup latency: 1 cycle
|
|
|
|
* Tag RAM write latency: 1 cycle
|
|
|
|
* Tag RAM read latency: 1 cycle
|
|
|
|
* Tag RAM setup latency: 1 cycle
|
|
|
|
*/
|
|
|
|
l2ctlr |= (1 << 3 | 1 << 0);
|
|
|
|
write_l2ctlr(l2ctlr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-08-12 09:58:12 +00:00
|
|
|
int arch_cpu_init(void)
|
|
|
|
{
|
2019-07-09 13:58:43 +00:00
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
|
|
configure_l2ctlr();
|
|
|
|
#else
|
2016-08-12 09:58:12 +00:00
|
|
|
/* We do some SoC one time setting here. */
|
2019-03-29 01:09:03 +00:00
|
|
|
struct rk3288_grf * const grf = (void *)GRF_BASE;
|
2016-08-12 09:58:12 +00:00
|
|
|
|
|
|
|
/* Use rkpwm by default */
|
2019-03-29 01:09:03 +00:00
|
|
|
rk_setreg(&grf->soc_con2, 1 << 0);
|
2019-07-09 13:58:43 +00:00
|
|
|
#endif
|
2016-08-12 09:58:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2019-03-29 01:09:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_UART_BOARD_INIT
|
|
|
|
void board_debug_uart_init(void)
|
|
|
|
{
|
|
|
|
/* Enable early UART on the RK3288 */
|
|
|
|
struct rk3288_grf * const grf = (void *)GRF_BASE;
|
|
|
|
|
|
|
|
rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT |
|
|
|
|
GPIO7C6_MASK << GPIO7C6_SHIFT,
|
|
|
|
GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT |
|
|
|
|
GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT);
|
|
|
|
}
|
|
|
|
#endif
|