All of lore.kernel.org
 help / color / mirror / Atom feed
From: michal.simek@xilinx.com (Michal Simek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/10] arm: zynq: Add support for system reset
Date: Mon, 25 Mar 2013 14:53:12 +0100	[thread overview]
Message-ID: <1364219596-4954-6-git-send-email-michal.simek@xilinx.com> (raw)
In-Reply-To: <1364219596-4954-1-git-send-email-michal.simek@xilinx.com>

Do system reset via slcr registers.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 arch/arm/mach-zynq/common.c |    6 ++++++
 arch/arm/mach-zynq/common.h |    1 +
 arch/arm/mach-zynq/slcr.c   |   26 ++++++++++++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 2734bd6..292f775 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -91,6 +91,11 @@ static void __init xilinx_map_io(void)
 	scu_init();
 }
 
+static void xilinx_system_reset(char mode, const char *cmd)
+{
+	slcr_system_reset();
+}
+
 static const char *xilinx_dt_match[] = {
 	"xlnx,zynq-zc702",
 	"xlnx,zynq-7000",
@@ -103,4 +108,5 @@ MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
 	.init_machine	= xilinx_init_machine,
 	.init_time	= xilinx_zynq_timer_init,
 	.dt_compat	= xilinx_dt_match,
+	.restart	= xilinx_system_reset,
 MACHINE_END
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index e30898a..e5628f7 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -18,6 +18,7 @@
 #define __MACH_ZYNQ_COMMON_H__
 
 extern int slcr_init(void);
+extern void slcr_system_reset(void);
 
 extern void __iomem *zynq_slcr_base;
 extern void __iomem *scu_base;
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c
index 1883b70..36b79d8 100644
--- a/arch/arm/mach-zynq/slcr.c
+++ b/arch/arm/mach-zynq/slcr.c
@@ -32,9 +32,35 @@
 #define SLCR_UNLOCK_MAGIC		0xDF0D
 #define SLCR_UNLOCK			0x8   /* SCLR unlock register */
 
+#define SLCR_PSS_RST_CTRL_OFFSET	0x200 /* PS Software Reset Control */
+#define SLCR_REBOOT_STATUS		0x258 /* PS Reboot Status */
+
 void __iomem *zynq_slcr_base;
 
 /**
+ * xslcr_system_reset - Reset the entire system.
+ *
+ */
+void slcr_system_reset(void)
+{
+	u32 reboot;
+
+	/* Unlock the SLCR then reset the system.
+	 * Note that this seems to require raw i/o
+	 * functions or there's a lockup?
+	 */
+	__raw_writel(SLCR_UNLOCK_MAGIC, zynq_slcr_base + SLCR_UNLOCK);
+
+	/* Clear 0x0F000000 bits of reboot status register to workaround
+	 * the FSBL not loading the bitstream after soft-reboot
+	 * This is a temporary solution until we know more.
+	 */
+	reboot = readl(zynq_slcr_base + SLCR_REBOOT_STATUS);
+	writel(reboot & 0xF0FFFFFF, zynq_slcr_base + SLCR_REBOOT_STATUS);
+	writel(1, zynq_slcr_base + SLCR_PSS_RST_CTRL_OFFSET);
+}
+
+/**
  * xslcr_init()
  * Returns 0 on success, negative errno otherwise.
  *
-- 
1.7.9.7

  parent reply	other threads:[~2013-03-25 13:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 13:53 [PATCH 01/10] arm: zynq: Use standard timer binding Michal Simek
2013-03-25 13:53 ` [PATCH 02/10] arm: zynq: Move timer to clocksource interface Michal Simek
2013-03-25 13:53 ` [PATCH 03/10] arm: zynq: Move timer to generic location Michal Simek
2013-03-25 16:01   ` Steffen Trumtrar
2013-03-25 16:24     ` Michal Simek
2013-03-25 13:53 ` [PATCH 04/10] arm: zynq: Load scu baseaddress at run time Michal Simek
2013-03-25 14:06   ` Rob Herring
2013-03-25 14:51     ` Michal Simek
2013-03-25 15:37       ` Rob Herring
2013-03-25 16:07         ` Michal Simek
2013-03-25 22:34           ` Rob Herring
2013-03-26 10:45             ` Michal Simek
2013-03-26 12:28               ` Rob Herring
2013-03-26 12:33                 ` Michal Simek
2013-04-02 16:40           ` Pawel Moll
     [not found]             ` <CAHTX3dKD4G0E8qoxTR2HnJVdagoeOerM+TiZzkJUPjcGwYdX_Q@mail.gmail.com>
2013-04-03  7:25               ` Steffen Trumtrar
2013-04-03 16:06               ` Pawel Moll
     [not found]                 ` <CAHTX3dJMpp+E2u-cAeYbqtxC1WAYWpCeRx6W7G=dWDcgzUz5DA@mail.gmail.com>
2013-04-03 17:11                   ` Pawel Moll
2013-03-25 13:53 ` [PATCH 05/10] arm: zynq: Move slcr initialization to separate file Michal Simek
2013-03-25 16:19   ` Steffen Trumtrar
2013-03-25 16:37     ` Michal Simek
2013-03-25 13:53 ` Michal Simek [this message]
2013-03-25 13:53 ` [PATCH 07/10] arm: zynq: Add support for pmu Michal Simek
2013-03-25 13:53 ` [PATCH 08/10] arm: zynq: Add smp support Michal Simek
2013-03-25 14:16   ` Rob Herring
2013-03-25 16:31     ` Michal Simek
2013-03-25 22:10       ` Rob Herring
2013-03-26  7:42         ` Michal Simek
2013-04-01 22:40           ` Rob Herring
2013-04-03  6:44             ` Michal Simek
2013-03-25 13:53 ` [PATCH 09/10] arm: zynq: Add hotplug support Michal Simek
2013-03-25 13:53 ` [PATCH 10/10] arm: zynq: Add cpuidle support Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364219596-4954-6-git-send-email-michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.