blob: df4eec88871d09f403180b63e6046ce079506a9d [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Michal Simekdea68a72012-09-13 20:23:35 +00002/*
3 * Copyright (C) 2012 Michal Simek <monstr@monstr.eu>
4 * Copyright (C) 2012 Xilinx, Inc. All rights reserved.
Michal Simekdea68a72012-09-13 20:23:35 +00005 */
6#include <common.h>
Michal Simek6d464802013-02-04 12:42:25 +01007#include <asm/io.h>
Soren Brinkmann102ad002013-11-21 13:38:54 -08008#include <asm/arch/clk.h>
Michal Simekeb1dfa72013-02-04 12:38:59 +01009#include <asm/arch/sys_proto.h>
Michal Simek6d464802013-02-04 12:42:25 +010010#include <asm/arch/hardware.h>
11
Siva Durga Prasad Paladugue26ef3b2013-11-29 19:01:25 +053012#define ZYNQ_SILICON_VER_MASK 0xF0000000
13#define ZYNQ_SILICON_VER_SHIFT 28
14
Michal Simekd1a428f2013-08-22 14:52:02 +020015int arch_cpu_init(void)
16{
Michal Simek6d464802013-02-04 12:42:25 +010017 zynq_slcr_unlock();
Michal Simeke60148d2014-01-14 14:21:52 +010018#ifndef CONFIG_SPL_BUILD
Michal Simek6d464802013-02-04 12:42:25 +010019 /* Device config APB, unlock the PCAP */
20 writel(0x757BDF0D, &devcfg_base->unlock);
21 writel(0xFFFFFFFF, &devcfg_base->rom_shadow);
22
Michal Simek9dc81ec2013-08-28 08:26:41 +020023#if (CONFIG_SYS_SDRAM_BASE == 0)
24 /* remap DDR to zero, FILTERSTART */
25 writel(0, &scu_base->filter_start);
26
Michal Simek6d464802013-02-04 12:42:25 +010027 /* OCM_CFG, Mask out the ROM, map ram into upper addresses */
28 writel(0x1F, &slcr_base->ocm_cfg);
29 /* FPGA_RST_CTRL, clear resets on AXI fabric ports */
30 writel(0x0, &slcr_base->fpga_rst_ctrl);
Michal Simek6d464802013-02-04 12:42:25 +010031 /* Set urgent bits with register */
32 writel(0x0, &slcr_base->ddr_urgent_sel);
33 /* Urgent write, ports S2/S3 */
34 writel(0xC, &slcr_base->ddr_urgent);
Michal Simek9dc81ec2013-08-28 08:26:41 +020035#endif
Michal Simeke60148d2014-01-14 14:21:52 +010036#endif
Michal Simek6d464802013-02-04 12:42:25 +010037 zynq_slcr_lock();
Michal Simekd1a428f2013-08-22 14:52:02 +020038
39 return 0;
Michal Simek6d464802013-02-04 12:42:25 +010040}
Michal Simekdea68a72012-09-13 20:23:35 +000041
Siva Durga Prasad Paladugue26ef3b2013-11-29 19:01:25 +053042unsigned int zynq_get_silicon_version(void)
43{
Masahiro Yamada04cfea52016-09-06 22:17:38 +090044 return (readl(&devcfg_base->mctrl) & ZYNQ_SILICON_VER_MASK)
45 >> ZYNQ_SILICON_VER_SHIFT;
Siva Durga Prasad Paladugue26ef3b2013-11-29 19:01:25 +053046}
47
Michal Simekdea68a72012-09-13 20:23:35 +000048void reset_cpu(ulong addr)
49{
Michal Simekeb1dfa72013-02-04 12:38:59 +010050 zynq_slcr_cpu_reset();
Michal Simekdea68a72012-09-13 20:23:35 +000051 while (1)
52 ;
53}
Michal Simek60264112014-01-03 09:32:35 +010054
55#ifndef CONFIG_SYS_DCACHE_OFF
56void enable_caches(void)
57{
58 /* Enable D-cache. I-cache is already enabled in start.S */
59 dcache_enable();
60}
61#endif