Michal Simek | 38b343d | 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 | 3765b3e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | 38b343d | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 6 | */ |
| 7 | #include <common.h> |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 8 | #include <asm/io.h> |
Soren Brinkmann | 6c3e61d | 2013-11-21 13:38:54 -0800 | [diff] [blame] | 9 | #include <asm/arch/clk.h> |
Michal Simek | 59c651f | 2013-02-04 12:38:59 +0100 | [diff] [blame] | 10 | #include <asm/arch/sys_proto.h> |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 11 | #include <asm/arch/hardware.h> |
Michal Simek | 38b343d | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 12 | |
Siva Durga Prasad Paladugu | 96a2859 | 2013-11-29 19:01:25 +0530 | [diff] [blame] | 13 | #define ZYNQ_SILICON_VER_MASK 0xF0000000 |
| 14 | #define ZYNQ_SILICON_VER_SHIFT 28 |
| 15 | |
Michal Simek | 262f08d | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 16 | int arch_cpu_init(void) |
| 17 | { |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 18 | zynq_slcr_unlock(); |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 19 | #ifndef CONFIG_SPL_BUILD |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 20 | /* Device config APB, unlock the PCAP */ |
| 21 | writel(0x757BDF0D, &devcfg_base->unlock); |
| 22 | writel(0xFFFFFFFF, &devcfg_base->rom_shadow); |
| 23 | |
Michal Simek | c1824ea | 2013-08-28 08:26:41 +0200 | [diff] [blame] | 24 | #if (CONFIG_SYS_SDRAM_BASE == 0) |
| 25 | /* remap DDR to zero, FILTERSTART */ |
| 26 | writel(0, &scu_base->filter_start); |
| 27 | |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 28 | /* OCM_CFG, Mask out the ROM, map ram into upper addresses */ |
| 29 | writel(0x1F, &slcr_base->ocm_cfg); |
| 30 | /* FPGA_RST_CTRL, clear resets on AXI fabric ports */ |
| 31 | writel(0x0, &slcr_base->fpga_rst_ctrl); |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 32 | /* Set urgent bits with register */ |
| 33 | writel(0x0, &slcr_base->ddr_urgent_sel); |
| 34 | /* Urgent write, ports S2/S3 */ |
| 35 | writel(0xC, &slcr_base->ddr_urgent); |
Michal Simek | c1824ea | 2013-08-28 08:26:41 +0200 | [diff] [blame] | 36 | #endif |
Michal Simek | d7e269c | 2014-01-14 14:21:52 +0100 | [diff] [blame] | 37 | #endif |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 38 | zynq_slcr_lock(); |
Michal Simek | 262f08d | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 39 | |
| 40 | return 0; |
Michal Simek | 00ed345 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 41 | } |
Michal Simek | 38b343d | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 42 | |
Siva Durga Prasad Paladugu | 96a2859 | 2013-11-29 19:01:25 +0530 | [diff] [blame] | 43 | unsigned int zynq_get_silicon_version(void) |
| 44 | { |
Masahiro Yamada | 63a7578 | 2016-09-06 22:17:38 +0900 | [diff] [blame] | 45 | return (readl(&devcfg_base->mctrl) & ZYNQ_SILICON_VER_MASK) |
| 46 | >> ZYNQ_SILICON_VER_SHIFT; |
Siva Durga Prasad Paladugu | 96a2859 | 2013-11-29 19:01:25 +0530 | [diff] [blame] | 47 | } |
| 48 | |
Michal Simek | 38b343d | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 49 | void reset_cpu(ulong addr) |
| 50 | { |
Michal Simek | 59c651f | 2013-02-04 12:38:59 +0100 | [diff] [blame] | 51 | zynq_slcr_cpu_reset(); |
Michal Simek | 38b343d | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 52 | while (1) |
| 53 | ; |
| 54 | } |
Michal Simek | 673ba27 | 2014-01-03 09:32:35 +0100 | [diff] [blame] | 55 | |
| 56 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 57 | void enable_caches(void) |
| 58 | { |
| 59 | /* Enable D-cache. I-cache is already enabled in start.S */ |
| 60 | dcache_enable(); |
| 61 | } |
| 62 | #endif |