blob: 62081b7efa20a52744ba74a7a4d65f57951b48ee [file] [log] [blame]
Vitaly Andrianov7bcf4d62014-04-04 13:16:53 -04001/*
2 * Keystone2: Architecture initialization
3 *
4 * (C) Copyright 2012-2014
5 * Texas Instruments Incorporated, <www.ti.com>
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9
10#include <common.h>
Murali Karicherif90901c2014-05-29 18:57:12 +030011#include <ns16550.h>
Vitaly Andrianov7bcf4d62014-04-04 13:16:53 -040012#include <asm/io.h>
Hao Zhangbccf0b72014-07-16 00:59:24 +030013#include <asm/arch/msmc.h>
Vitaly Andrianov7bcf4d62014-04-04 13:16:53 -040014#include <asm/arch/clock.h>
15#include <asm/arch/hardware.h>
16
17void chip_configuration_unlock(void)
18{
Khoronzhuk, Ivand5cb1bb2014-07-09 23:44:44 +030019 __raw_writel(KS2_KICK0_MAGIC, KS2_KICK0);
20 __raw_writel(KS2_KICK1_MAGIC, KS2_KICK1);
Vitaly Andrianov7bcf4d62014-04-04 13:16:53 -040021}
22
23int arch_cpu_init(void)
24{
25 chip_configuration_unlock();
26 icache_enable();
27
Hao Zhang9000ea92014-10-22 16:32:30 +030028 msmc_share_all_segments(KS2_MSMC_SEGMENT_TETRIS);
29 msmc_share_all_segments(KS2_MSMC_SEGMENT_NETCP);
30 msmc_share_all_segments(KS2_MSMC_SEGMENT_QM_PDSP);
31 msmc_share_all_segments(KS2_MSMC_SEGMENT_PCIE0);
32#if defined(CONFIG_SOC_K2E) || defined(CONFIG_SOC_K2L)
33 msmc_share_all_segments(KS2_MSMC_SEGMENT_PCIE1);
Vitaly Andrianov7bcf4d62014-04-04 13:16:53 -040034#endif
35
Murali Karicherif90901c2014-05-29 18:57:12 +030036 /*
37 * just initialise the COM2 port so that TI specific
38 * UART register PWREMU_MGMT is initialized. Linux UART
39 * driver doesn't handle this.
40 */
41 NS16550_init((NS16550_t)(CONFIG_SYS_NS16550_COM2),
42 CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
43
Vitaly Andrianov7bcf4d62014-04-04 13:16:53 -040044 return 0;
45}
46
47void reset_cpu(ulong addr)
48{
49 volatile u32 *rstctrl = (volatile u32 *)(KS2_RSTCTRL);
50 u32 tmp;
51
52 tmp = *rstctrl & KS2_RSTCTRL_MASK;
53 *rstctrl = tmp | KS2_RSTCTRL_KEY;
54
55 *rstctrl &= KS2_RSTCTRL_SWRST;
56
57 for (;;)
58 ;
59}
60
61void enable_caches(void)
62{
63#ifndef CONFIG_SYS_DCACHE_OFF
64 /* Enable D-cache. I-cache is already enabled in start.S */
65 dcache_enable();
66#endif
67}