aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2013-03-20 06:42:15 -0400
committerMichal Simek <michal.simek@xilinx.com>2013-04-04 03:22:29 -0400
commit96790f0a283976bc59f68657237293fe97b02334 (patch)
tree9d15142ec7d3c6b7acecabcd2a686051cf733af0
parent64b889b39e9958fdcfe5e9b7aa1ac0ffca3fc9a2 (diff)
arm: zynq: Add support for system reset
Do system reset via slcr registers. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--arch/arm/mach-zynq/common.c6
-rw-r--r--arch/arm/mach-zynq/common.h1
-rw-r--r--arch/arm/mach-zynq/slcr.c27
3 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index cd3968c28904..f0a8533af1f9 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -92,6 +92,11 @@ static void __init xilinx_map_io(void)
92 zynq_scu_map_io(); 92 zynq_scu_map_io();
93} 93}
94 94
95static void zynq_system_reset(char mode, const char *cmd)
96{
97 zynq_slcr_system_reset();
98}
99
95static const char *xilinx_dt_match[] = { 100static const char *xilinx_dt_match[] = {
96 "xlnx,zynq-zc702", 101 "xlnx,zynq-zc702",
97 "xlnx,zynq-7000", 102 "xlnx,zynq-7000",
@@ -104,4 +109,5 @@ MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
104 .init_machine = xilinx_init_machine, 109 .init_machine = xilinx_init_machine,
105 .init_time = xilinx_zynq_timer_init, 110 .init_time = xilinx_zynq_timer_init,
106 .dt_compat = xilinx_dt_match, 111 .dt_compat = xilinx_dt_match,
112 .restart = zynq_system_reset,
107MACHINE_END 113MACHINE_END
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index dd594e672ed4..d7ec3caaa1d7 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -18,6 +18,7 @@
18#define __MACH_ZYNQ_COMMON_H__ 18#define __MACH_ZYNQ_COMMON_H__
19 19
20extern int zynq_slcr_init(void); 20extern int zynq_slcr_init(void);
21extern void zynq_slcr_system_reset(void);
21 22
22extern void __iomem *zynq_slcr_base; 23extern void __iomem *zynq_slcr_base;
23extern void __iomem *zynq_scu_base; 24extern void __iomem *zynq_scu_base;
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c
index f9f33496cee9..d58c9964e883 100644
--- a/arch/arm/mach-zynq/slcr.c
+++ b/arch/arm/mach-zynq/slcr.c
@@ -32,9 +32,36 @@
32#define SLCR_UNLOCK_MAGIC 0xDF0D 32#define SLCR_UNLOCK_MAGIC 0xDF0D
33#define SLCR_UNLOCK 0x8 /* SCLR unlock register */ 33#define SLCR_UNLOCK 0x8 /* SCLR unlock register */
34 34
35#define SLCR_PS_RST_CTRL_OFFSET 0x200 /* PS Software Reset Control */
36#define SLCR_REBOOT_STATUS 0x258 /* PS Reboot Status */
37
35void __iomem *zynq_slcr_base; 38void __iomem *zynq_slcr_base;
36 39
37/** 40/**
41 * zynq_slcr_system_reset - Reset the entire system.
42 */
43void zynq_slcr_system_reset(void)
44{
45 u32 reboot;
46
47 /*
48 * Unlock the SLCR then reset the system.
49 * Note that this seems to require raw i/o
50 * functions or there's a lockup?
51 */
52 writel(SLCR_UNLOCK_MAGIC, zynq_slcr_base + SLCR_UNLOCK);
53
54 /*
55 * Clear 0x0F000000 bits of reboot status register to workaround
56 * the FSBL not loading the bitstream after soft-reboot
57 * This is a temporary solution until we know more.
58 */
59 reboot = readl(zynq_slcr_base + SLCR_REBOOT_STATUS);
60 writel(reboot & 0xF0FFFFFF, zynq_slcr_base + SLCR_REBOOT_STATUS);
61 writel(1, zynq_slcr_base + SLCR_PS_RST_CTRL_OFFSET);
62}
63
64/**
38 * zynq_slcr_init 65 * zynq_slcr_init
39 * Returns 0 on success, negative errno otherwise. 66 * Returns 0 on success, negative errno otherwise.
40 * 67 *