From: joshc@ni.com (Josh Cartwright)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] ARM: zynq: use restart_handler mechanism for slcr reset
Date: Thu, 19 Mar 2015 08:33:52 -0500 [thread overview]
Message-ID: <1426772033-29277-1-git-send-email-joshc@ni.com> (raw)
In-Reply-To: <BN1BFFO11FD008F29B247339CE49EAEA6AE2010@BN1BFFO11FD008.protection.gbl>
By making use of the restart_handler chain mechanism, the SLCR-based
reset mechanism can be prioritized amongst other mechanisms available on
a particular board.
Choose a default high-ish priority of 192 for this restart mechanism.
Signed-off-by: Josh Cartwright <joshc@ni.com>
---
v2 -> v3: Don't drop the kerneldoc
v1 -> v2: Also drop zynq_slcr_system_reset prototype from common.h
arch/arm/mach-zynq/common.c | 6 ------
arch/arm/mach-zynq/common.h | 1 -
arch/arm/mach-zynq/slcr.c | 15 +++++++++++++--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 58ef2a7..616d584 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -190,11 +190,6 @@ static void __init zynq_irq_init(void)
irqchip_init();
}
-static void zynq_system_reset(enum reboot_mode mode, const char *cmd)
-{
- zynq_slcr_system_reset();
-}
-
static const char * const zynq_dt_match[] = {
"xlnx,zynq-7000",
NULL
@@ -212,5 +207,4 @@ DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
.init_time = zynq_timer_init,
.dt_compat = zynq_dt_match,
.reserve = zynq_memory_init,
- .restart = zynq_system_reset,
MACHINE_END
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index 382c60e..f2f0bf2 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -21,7 +21,6 @@ void zynq_secondary_startup(void);
extern int zynq_slcr_init(void);
extern int zynq_early_slcr_init(void);
-extern void zynq_slcr_system_reset(void);
extern void zynq_slcr_cpu_stop(int cpu);
extern void zynq_slcr_cpu_start(int cpu);
extern bool zynq_slcr_cpu_state_read(int cpu);
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c
index c3c24fd8..fa4c796 100644
--- a/arch/arm/mach-zynq/slcr.c
+++ b/arch/arm/mach-zynq/slcr.c
@@ -15,6 +15,7 @@
*/
#include <linux/io.h>
+#include <linux/reboot.h>
#include <linux/mfd/syscon.h>
#include <linux/of_address.h>
#include <linux/regmap.h>
@@ -92,9 +93,11 @@ u32 zynq_slcr_get_device_id(void)
}
/**
- * zynq_slcr_system_reset - Reset the entire system.
+ * zynq_slcr_system_restart - Restart the entire system.
*/
-void zynq_slcr_system_reset(void)
+static
+int zynq_slcr_system_restart(struct notifier_block *nb,
+ unsigned long action, void *data)
{
u32 reboot;
@@ -113,8 +116,14 @@ void zynq_slcr_system_reset(void)
zynq_slcr_read(&reboot, SLCR_REBOOT_STATUS_OFFSET);
zynq_slcr_write(reboot & 0xF0FFFFFF, SLCR_REBOOT_STATUS_OFFSET);
zynq_slcr_write(1, SLCR_PS_RST_CTRL_OFFSET);
+ return 0;
}
+static struct notifier_block zynq_slcr_restart_nb = {
+ .notifier_call = zynq_slcr_system_restart,
+ .priority = 192,
+};
+
/**
* zynq_slcr_cpu_start - Start cpu
* @cpu: cpu number
@@ -219,6 +228,8 @@ int __init zynq_early_slcr_init(void)
/* unlock the SLCR so that registers can be changed */
zynq_slcr_unlock();
+ register_restart_handler(&zynq_slcr_restart_nb);
+
pr_info("%s mapped to %p\n", np->name, zynq_slcr_base);
of_node_put(np);
--
2.3.3
next prev parent reply other threads:[~2015-03-19 13:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 15:09 [PATCH v2] ARM: zynq: use restart_handler mechanism for slcr reset Josh Cartwright
2015-03-11 15:41 ` Josh Cartwright
2015-03-19 10:44 ` Michal Simek
2015-03-19 12:44 ` Josh Cartwright
2015-03-19 13:19 ` Michal Simek
2015-03-19 13:33 ` Josh Cartwright [this message]
2015-03-19 13:33 ` [PATCH 2/2] ARM: zynq: drop use of slcr_unlock in zynq_slcr_system_restart Josh Cartwright
2015-03-19 13:49 ` Josh Cartwright
2015-03-19 14:01 ` [PATCH v3 1/2] ARM: zynq: use restart_handler mechanism for slcr reset Michal Simek
2015-03-19 14:22 ` Josh Cartwright
2015-03-19 14:24 ` [PATCH v4] " Josh Cartwright
2015-03-20 7:48 ` Michal Simek
2015-03-19 13:37 ` [PATCH v2] " Josh Cartwright
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=1426772033-29277-1-git-send-email-joshc@ni.com \
--to=joshc@ni.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).