All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: kgene.kim@samsung.com
Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org
Subject: [PATCH 3/5] ARM: S3C24XX: add common reset function
Date: Mon, 06 Jan 2014 19:39:16 +0100	[thread overview]
Message-ID: <3212735.MOokUY2h0f@phil> (raw)
In-Reply-To: <3105326.uFdOVLyXH8@phil>

The function first tries to use a swrst-block if available, then
a watchdog-reset and at the end a soft_restart as last measure.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-s3c24xx/common.c |   26 ++++++++++++++++++++++++++
 arch/arm/mach-s3c24xx/common.h |    2 ++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index a7b1269..a3b1d98 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -587,3 +587,29 @@ struct platform_device s3c2410_device_dclk = {
 	.resource	= s3c2410_dclk_resource,
 };
 #endif
+
+/*
+ * Some S3C24XX-SoCs have a special software-reset register and
+ * all of them seem to support the watchdog reset.
+ */
+void s3c24xx_restart(enum reboot_mode mode, const char *cmd)
+{
+	if (mode == REBOOT_SOFT)
+		soft_restart(0);
+
+	if (s3c24xx_swrst_reset_available()) {
+		pr_debug("s3c24xx: trying swrst-reset\n");
+		s3c24xx_swrst_reset();
+		/* delay to allow the serial port to show the message */
+		mdelay(50);
+	}
+
+#ifdef CONFIG_SAMSUNG_WDT_RESET
+	pr_debug("s3c24xx: trying watchdog-reset\n");
+	samsung_wdt_reset();
+	mdelay(50);
+#endif
+
+	/* we'll take a jump through zero as a poor second */
+	soft_restart(0);
+}
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index caf1534..20829a8 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -147,4 +147,6 @@ static inline void s3c24xx_swrst_reset_init(void __iomem *base,
 					     bool is_s3c2412) {}
 #endif
 
+void s3c24xx_restart(enum reboot_mode mode, const char *cmd);
+
 #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
-- 
1.7.10.4

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] ARM: S3C24XX: add common reset function
Date: Mon, 06 Jan 2014 19:39:16 +0100	[thread overview]
Message-ID: <3212735.MOokUY2h0f@phil> (raw)
In-Reply-To: <3105326.uFdOVLyXH8@phil>

The function first tries to use a swrst-block if available, then
a watchdog-reset and at the end a soft_restart as last measure.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/mach-s3c24xx/common.c |   26 ++++++++++++++++++++++++++
 arch/arm/mach-s3c24xx/common.h |    2 ++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index a7b1269..a3b1d98 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -587,3 +587,29 @@ struct platform_device s3c2410_device_dclk = {
 	.resource	= s3c2410_dclk_resource,
 };
 #endif
+
+/*
+ * Some S3C24XX-SoCs have a special software-reset register and
+ * all of them seem to support the watchdog reset.
+ */
+void s3c24xx_restart(enum reboot_mode mode, const char *cmd)
+{
+	if (mode == REBOOT_SOFT)
+		soft_restart(0);
+
+	if (s3c24xx_swrst_reset_available()) {
+		pr_debug("s3c24xx: trying swrst-reset\n");
+		s3c24xx_swrst_reset();
+		/* delay to allow the serial port to show the message */
+		mdelay(50);
+	}
+
+#ifdef CONFIG_SAMSUNG_WDT_RESET
+	pr_debug("s3c24xx: trying watchdog-reset\n");
+	samsung_wdt_reset();
+	mdelay(50);
+#endif
+
+	/* we'll take a jump through zero as a poor second */
+	soft_restart(0);
+}
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index caf1534..20829a8 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -147,4 +147,6 @@ static inline void s3c24xx_swrst_reset_init(void __iomem *base,
 					     bool is_s3c2412) {}
 #endif
 
+void s3c24xx_restart(enum reboot_mode mode, const char *cmd);
+
 #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
-- 
1.7.10.4

  parent reply	other threads:[~2014-01-06 18:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 18:35 [PATCH 0/5] ARM: S3C24XX: unify restart functions Heiko Stübner
2014-01-06 18:35 ` Heiko Stübner
2014-01-06 18:37 ` [PATCH 1/5] dt-bindings: document the s3c24xx software-reset register Heiko Stübner
2014-01-06 18:37   ` Heiko Stübner
2014-01-23 18:09   ` Tomasz Figa
2014-01-23 18:09     ` Tomasz Figa
2014-01-06 18:38 ` [PATCH 2/5] ARM: S3C24XX: add generic handler for swrst resets Heiko Stübner
2014-01-06 18:38   ` Heiko Stübner
2014-01-06 18:39 ` Heiko Stübner [this message]
2014-01-06 18:39   ` [PATCH 3/5] ARM: S3C24XX: add common reset function Heiko Stübner
2014-01-06 18:40 ` [PATCH 4/5] ARM: S3C24XX: convert boards to use common restart function Heiko Stübner
2014-01-06 18:40   ` Heiko Stübner
2014-01-23 18:12   ` Tomasz Figa
2014-01-23 18:12     ` Tomasz Figa
2014-01-23 18:36     ` Heiko Stübner
2014-01-23 18:36       ` Heiko Stübner
2014-01-23 18:51       ` Tomasz Figa
2014-01-23 18:51         ` Tomasz Figa
2014-01-23 19:02         ` Heiko Stübner
2014-01-23 19:02           ` Heiko Stübner
2014-01-23 22:35           ` Tomasz Figa
2014-01-23 22:35             ` Tomasz Figa
2014-01-24  8:03             ` Heiko Stübner
2014-01-24  8:03               ` Heiko Stübner
2014-01-24 10:08               ` Tomasz Figa
2014-01-24 10:08                 ` Tomasz Figa
2014-01-06 18:40 ` [PATCH 5/5] ARM: S3C24XX: remove obsolete SoC-specific restart functions Heiko Stübner
2014-01-06 18:40   ` 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=3212735.MOokUY2h0f@phil \
    --to=heiko@sntech.de \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.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.