blob: 27ffb450378f5b3edf9d66ad8e4ef093551fe188 [file] [log] [blame]
Stefan Boschb4bb31d2020-07-10 19:07:37 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2016 Nexell
4 * Hyunseok, Jung <hsjung@nexell.co.kr>
5 */
6
Stefan Boschb4bb31d2020-07-10 19:07:37 +02007#include <command.h>
8#include <asm/system.h>
9#include <asm/cache.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Stefan Boschb4bb31d2020-07-10 19:07:37 +020011#include <asm/sections.h>
12#include <asm/io.h>
13#include <asm/arch/nexell.h>
14#include <asm/arch/clk.h>
Stefan Boschb4bb31d2020-07-10 19:07:37 +020015#include <asm/arch/tieoff.h>
16#include <cpu_func.h>
Stefan Boschb4bb31d2020-07-10 19:07:37 +020017
18DECLARE_GLOBAL_DATA_PTR;
19
20#ifndef CONFIG_ARCH_CPU_INIT
21#error must be define the macro "CONFIG_ARCH_CPU_INIT"
22#endif
23
24void s_init(void)
25{
26}
27
28static void cpu_soc_init(void)
29{
30 /*
31 * NOTE> ALIVE Power Gate must enable for Alive register access.
32 * must be clear wfi jump address
33 */
34 writel(1, ALIVEPWRGATEREG);
35 writel(0xFFFFFFFF, SCR_ARM_SECOND_BOOT);
36
37 /* write 0xf0 on alive scratchpad reg for boot success check */
38 writel(readl(SCR_SIGNAGURE_READ) | 0xF0, (SCR_SIGNAGURE_SET));
39
40 /* set l2 cache tieoff */
41 nx_tieoff_set(NX_TIEOFF_CORTEXA9MP_TOP_QUADL2C_L2RET1N_0, 1);
42 nx_tieoff_set(NX_TIEOFF_CORTEXA9MP_TOP_QUADL2C_L2RET1N_1, 1);
43}
44
Stefan Boschb4bb31d2020-07-10 19:07:37 +020045int arch_cpu_init(void)
46{
47 flush_dcache_all();
48 cpu_soc_init();
49 clk_init();
50
Stefan Boschb4bb31d2020-07-10 19:07:37 +020051 return 0;
52}
53
54#if defined(CONFIG_DISPLAY_CPUINFO)
55int print_cpuinfo(void)
56{
57 return 0;
58}
59#endif
60
Harald Seiler6f14d5f2020-12-15 16:47:52 +010061void reset_cpu(void)
Stefan Boschb4bb31d2020-07-10 19:07:37 +020062{
63 void *clkpwr_reg = (void *)PHY_BASEADDR_CLKPWR;
64 const u32 sw_rst_enb_bitpos = 3;
65 const u32 sw_rst_enb_mask = 1 << sw_rst_enb_bitpos;
66 const u32 sw_rst_bitpos = 12;
67 const u32 sw_rst_mask = 1 << sw_rst_bitpos;
68 int pwrcont = 0x224;
69 int pwrmode = 0x228;
70 u32 read_value;
71
72 read_value = readl((void *)(clkpwr_reg + pwrcont));
73
74 read_value &= ~sw_rst_enb_mask;
75 read_value |= 1 << sw_rst_enb_bitpos;
76
77 writel(read_value, (void *)(clkpwr_reg + pwrcont));
78 writel(sw_rst_mask, (void *)(clkpwr_reg + pwrmode));
79}
80
81void enable_caches(void)
82{
83 /* Enable D-cache. I-cache is already enabled in start.S */
84 dcache_enable();
85}