Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Michal Simek <monstr@monstr.eu> |
| 3 | * Copyright (C) 2012 Xilinx, Inc. All rights reserved. |
| 4 | * |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 6 | */ |
| 7 | #include <common.h> |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 8 | #include <asm/io.h> |
Soren Brinkmann | 102ad00 | 2013-11-21 13:38:54 -0800 | [diff] [blame] | 9 | #include <asm/arch/clk.h> |
Michal Simek | eb1dfa7 | 2013-02-04 12:38:59 +0100 | [diff] [blame] | 10 | #include <asm/arch/sys_proto.h> |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 11 | #include <asm/arch/hardware.h> |
| 12 | |
| 13 | void lowlevel_init(void) |
| 14 | { |
Michal Simek | d1a428f | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 15 | } |
| 16 | |
Siva Durga Prasad Paladugu | e26ef3b | 2013-11-29 19:01:25 +0530 | [diff] [blame^] | 17 | #define ZYNQ_SILICON_VER_MASK 0xF0000000 |
| 18 | #define ZYNQ_SILICON_VER_SHIFT 28 |
| 19 | |
Michal Simek | d1a428f | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 20 | int arch_cpu_init(void) |
| 21 | { |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 22 | zynq_slcr_unlock(); |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 23 | #ifndef CONFIG_SPL_BUILD |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 24 | /* Device config APB, unlock the PCAP */ |
| 25 | writel(0x757BDF0D, &devcfg_base->unlock); |
| 26 | writel(0xFFFFFFFF, &devcfg_base->rom_shadow); |
| 27 | |
Michal Simek | 9dc81ec | 2013-08-28 08:26:41 +0200 | [diff] [blame] | 28 | #if (CONFIG_SYS_SDRAM_BASE == 0) |
| 29 | /* remap DDR to zero, FILTERSTART */ |
| 30 | writel(0, &scu_base->filter_start); |
| 31 | |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 32 | /* OCM_CFG, Mask out the ROM, map ram into upper addresses */ |
| 33 | writel(0x1F, &slcr_base->ocm_cfg); |
| 34 | /* FPGA_RST_CTRL, clear resets on AXI fabric ports */ |
| 35 | writel(0x0, &slcr_base->fpga_rst_ctrl); |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 36 | /* Set urgent bits with register */ |
| 37 | writel(0x0, &slcr_base->ddr_urgent_sel); |
| 38 | /* Urgent write, ports S2/S3 */ |
| 39 | writel(0xC, &slcr_base->ddr_urgent); |
Michal Simek | 9dc81ec | 2013-08-28 08:26:41 +0200 | [diff] [blame] | 40 | #endif |
Michal Simek | e60148d | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 41 | #endif |
Soren Brinkmann | 102ad00 | 2013-11-21 13:38:54 -0800 | [diff] [blame] | 42 | zynq_clk_early_init(); |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 43 | zynq_slcr_lock(); |
Michal Simek | d1a428f | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 44 | |
| 45 | return 0; |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 46 | } |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 47 | |
Siva Durga Prasad Paladugu | e26ef3b | 2013-11-29 19:01:25 +0530 | [diff] [blame^] | 48 | unsigned int zynq_get_silicon_version(void) |
| 49 | { |
| 50 | unsigned int ver; |
| 51 | |
| 52 | ver = (readl(&devcfg_base->mctrl) & |
| 53 | ZYNQ_SILICON_VER_MASK) >> ZYNQ_SILICON_VER_SHIFT; |
| 54 | |
| 55 | return ver; |
| 56 | } |
| 57 | |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 58 | void reset_cpu(ulong addr) |
| 59 | { |
Michal Simek | eb1dfa7 | 2013-02-04 12:38:59 +0100 | [diff] [blame] | 60 | zynq_slcr_cpu_reset(); |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 61 | while (1) |
| 62 | ; |
| 63 | } |
Michal Simek | 6026411 | 2014-01-03 09:32:35 +0100 | [diff] [blame] | 64 | |
| 65 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 66 | void enable_caches(void) |
| 67 | { |
| 68 | /* Enable D-cache. I-cache is already enabled in start.S */ |
| 69 | dcache_enable(); |
| 70 | } |
| 71 | #endif |