From: Guenter Roeck <linux@roeck-us.net>
To: Russell King <linux@arm.linux.org.uk>,
Wim Van Sebroeck <wim@iguana.be>,
Catalin Marinas <catalin.marinas@arm.com>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-watchdog@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org,
linux-samsung-soc@vger.kernel.org,
Will Deacon <will.deacon@arm.com>, Arnd Bergmann <arnd@arndb.de>,
Heiko Stuebner <heiko@sntech.de>,
Jonas Jensen <jonas.jensen@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Tomasz Figa <t.figa@samsung.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH v7 10/11] clk: samsung: register restart handlers for s3c2412 and s3c2443
Date: Tue, 19 Aug 2014 17:45:37 -0700 [thread overview]
Message-ID: <1408495538-27480-11-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1408495538-27480-1-git-send-email-linux@roeck-us.net>
From: Heiko Stübner <heiko@sntech.de>
S3C2412, S3C2443 and their derivatives contain a special software-reset
register in their system-controller.
Therefore register a restart handler for those.
Tested on a s3c2416-based board, s3c2412 compile-tested.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v7: Added patch to series.
drivers/clk/samsung/clk-s3c2412.c | 29 +++++++++++++++++++++++++++++
drivers/clk/samsung/clk-s3c2443.c | 19 +++++++++++++++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/clk/samsung/clk-s3c2412.c b/drivers/clk/samsung/clk-s3c2412.c
index 34af09f..2ceedaf 100644
--- a/drivers/clk/samsung/clk-s3c2412.c
+++ b/drivers/clk/samsung/clk-s3c2412.c
@@ -14,6 +14,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/syscore_ops.h>
+#include <linux/reboot.h>
#include <dt-bindings/clock/s3c2412.h>
@@ -26,6 +27,7 @@
#define CLKCON 0x0c
#define CLKDIVN 0x14
#define CLKSRC 0x1c
+#define SWRST 0x30
/* list of PLLs to be registered */
enum s3c2412_plls {
@@ -204,6 +206,28 @@ struct samsung_clock_alias s3c2412_aliases[] __initdata = {
ALIAS(MSYSCLK, NULL, "fclk"),
};
+static int s3c2412_restart(struct notifier_block *this,
+ unsigned long mode, void *cmd)
+{
+ /* errata "Watch-dog/Software Reset Problem" specifies that
+ * this reset must be done with the SYSCLK sourced from
+ * EXTCLK instead of FOUT to avoid a glitch in the reset
+ * mechanism.
+ *
+ * See the watchdog section of the S3C2412 manual for more
+ * information on this fix.
+ */
+
+ __raw_writel(0x00, reg_base + CLKSRC);
+ __raw_writel(0x533C2412, reg_base + SWRST);
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block s3c2412_restart_handler = {
+ .notifier_call = s3c2412_restart,
+ .priority = 129,
+};
+
/*
* fixed rate clocks generated outside the soc
* Only necessary until the devicetree-move is complete
@@ -233,6 +257,7 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
unsigned long ext_f, void __iomem *base)
{
struct samsung_clk_provider *ctx;
+ int ret;
reg_base = base;
if (np) {
@@ -267,6 +292,10 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
s3c2412_clk_sleep_init();
samsung_clk_of_add_provider(np, ctx);
+
+ ret = register_restart_handler(&s3c2412_restart_handler);
+ if (ret)
+ pr_warn("cannot register restart handler, %d\n", ret);
}
static void __init s3c2412_clk_init(struct device_node *np)
diff --git a/drivers/clk/samsung/clk-s3c2443.c b/drivers/clk/samsung/clk-s3c2443.c
index c92f853..0c3c182 100644
--- a/drivers/clk/samsung/clk-s3c2443.c
+++ b/drivers/clk/samsung/clk-s3c2443.c
@@ -14,6 +14,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/syscore_ops.h>
+#include <linux/reboot.h>
#include <dt-bindings/clock/s3c2443.h>
@@ -33,6 +34,7 @@
#define HCLKCON 0x30
#define PCLKCON 0x34
#define SCLKCON 0x38
+#define SWRST 0x44
/* the soc types */
enum supported_socs {
@@ -354,6 +356,18 @@ struct samsung_clock_alias s3c2450_aliases[] __initdata = {
ALIAS(PCLK_I2C1, "s3c2410-i2c.1", "i2c"),
};
+static int s3c2443_restart(struct notifier_block *this,
+ unsigned long mode, void *cmd)
+{
+ __raw_writel(0x533c2443, reg_base + SWRST);
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block s3c2443_restart_handler = {
+ .notifier_call = s3c2443_restart,
+ .priority = 129,
+};
+
/*
* fixed rate clocks generated outside the soc
* Only necessary until the devicetree-move is complete
@@ -378,6 +392,7 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
void __iomem *base)
{
struct samsung_clk_provider *ctx;
+ int ret;
reg_base = base;
if (np) {
@@ -447,6 +462,10 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f,
s3c2443_clk_sleep_init();
samsung_clk_of_add_provider(np, ctx);
+
+ ret = register_restart_handler(&s3c2443_restart_handler);
+ if (ret)
+ pr_warn("cannot register restart handler, %d\n", ret);
}
static void __init s3c2416_clk_init(struct device_node *np)
--
1.9.1
next prev parent reply other threads:[~2014-08-20 0:45 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-20 0:45 [PATCH v7 00/11] kernel: Add support for restart handler call chain Guenter Roeck
2014-08-20 0:45 ` [PATCH v7 01/11] kernel: Add support for kernel " Guenter Roeck
2014-08-21 4:08 ` Doug Anderson
2014-08-20 0:45 ` [PATCH v7 02/11] power/restart: Call machine_restart instead of arm_pm_restart Guenter Roeck
2014-08-21 4:10 ` Doug Anderson
2014-08-21 4:42 ` Guenter Roeck
2014-08-21 19:30 ` Doug Anderson
2014-08-21 20:11 ` Guenter Roeck
2014-08-21 20:39 ` Sebastian Reichel
2014-08-23 17:20 ` Guenter Roeck
2014-08-20 0:45 ` [PATCH v7 03/11] arm64: Support restart through restart handler call chain Guenter Roeck
2014-08-21 4:13 ` Doug Anderson
2014-08-20 0:45 ` [PATCH v7 04/11] arm: " Guenter Roeck
2014-08-21 4:11 ` Doug Anderson
2014-08-22 1:32 ` Andreas Färber
2014-08-22 2:19 ` Guenter Roeck
2014-08-23 17:11 ` Andreas Färber
2014-08-20 0:45 ` [PATCH v7 05/11] watchdog: moxart: Register restart handler with kernel restart handler Guenter Roeck
2014-08-20 0:45 ` [PATCH v7 06/11] watchdog: alim7101: " Guenter Roeck
2014-08-20 0:45 ` [PATCH v7 07/11] watchdog: sunxi: " Guenter Roeck
2014-08-20 0:45 ` [PATCH v7 08/11] arm/arm64: Unexport restart handlers Guenter Roeck
2014-08-21 4:12 ` Doug Anderson
2014-12-04 13:36 ` Geert Uytterhoeven
2014-12-04 14:26 ` Guenter Roeck
2014-12-04 14:44 ` Geert Uytterhoeven
2014-12-04 14:51 ` Guenter Roeck
[not found] ` <54807505.2000406-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-12-04 15:06 ` Arnd Bergmann
2014-12-04 16:11 ` Guenter Roeck
2014-08-20 0:45 ` [PATCH v7 09/11] watchdog: s3c2410: add restart handler Guenter Roeck
2014-08-20 0:45 ` Guenter Roeck [this message]
2014-09-03 19:05 ` [PATCH v7 10/11] clk: samsung: register restart handlers for s3c2412 and s3c2443 Mike Turquette
2014-08-20 0:45 ` [PATCH v7 11/11] clk: rockchip: add restart handler Guenter Roeck
2014-08-21 4:15 ` Doug Anderson
2014-08-21 8:18 ` Heiko Stübner
2014-09-03 19:05 ` Mike Turquette
2014-08-23 16:35 ` [PATCH v7 00/11] kernel: Add support for restart handler call chain Guenter Roeck
2014-08-23 23:00 ` Heiko Stübner
2014-08-24 0:17 ` Guenter Roeck
2014-09-19 12:54 ` Pramod Gurav
2014-09-30 21:20 ` Andrew Morton
2014-09-30 22:30 ` Guenter Roeck
2014-09-30 23:40 ` Stephen Rothwell
2014-10-01 3:28 ` Guenter Roeck
2014-10-01 13:32 ` Heiko Stübner
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=1408495538-27480-11-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=heiko@sntech.de \
--cc=jonas.jensen@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=maxime.ripard@free-electrons.com \
--cc=mingo@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=t.figa@samsung.com \
--cc=will.deacon@arm.com \
--cc=wim@iguana.be \
/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).