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> |
Michal Simek | eb1dfa7 | 2013-02-04 12:38:59 +0100 | [diff] [blame] | 9 | #include <asm/arch/sys_proto.h> |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 10 | #include <asm/arch/hardware.h> |
| 11 | |
| 12 | void lowlevel_init(void) |
| 13 | { |
Michal Simek | d1a428f | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | int arch_cpu_init(void) |
| 17 | { |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 18 | zynq_slcr_unlock(); |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 19 | |
| 20 | /* Device config APB, unlock the PCAP */ |
| 21 | writel(0x757BDF0D, &devcfg_base->unlock); |
| 22 | writel(0xFFFFFFFF, &devcfg_base->rom_shadow); |
| 23 | |
Michal Simek | 9dc81ec | 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 | 6d46480 | 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); |
| 32 | /* TZ_DDR_RAM, Set DDR trust zone non-secure */ |
| 33 | writel(0xFFFFFFFF, &slcr_base->trust_zone); |
| 34 | /* Set urgent bits with register */ |
| 35 | writel(0x0, &slcr_base->ddr_urgent_sel); |
| 36 | /* Urgent write, ports S2/S3 */ |
| 37 | writel(0xC, &slcr_base->ddr_urgent); |
Michal Simek | 9dc81ec | 2013-08-28 08:26:41 +0200 | [diff] [blame^] | 38 | #endif |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 39 | |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 40 | zynq_slcr_lock(); |
Michal Simek | d1a428f | 2013-08-22 14:52:02 +0200 | [diff] [blame] | 41 | |
| 42 | return 0; |
Michal Simek | 6d46480 | 2013-02-04 12:42:25 +0100 | [diff] [blame] | 43 | } |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 44 | |
| 45 | void reset_cpu(ulong addr) |
| 46 | { |
Michal Simek | eb1dfa7 | 2013-02-04 12:38:59 +0100 | [diff] [blame] | 47 | zynq_slcr_cpu_reset(); |
Michal Simek | dea68a7 | 2012-09-13 20:23:35 +0000 | [diff] [blame] | 48 | while (1) |
| 49 | ; |
| 50 | } |