mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Borleis <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/6] Watchdog/i.MX: make the watchdog driver a regular driver
Date: Tue, 16 Jun 2015 13:56:05 +0200	[thread overview]
Message-ID: <1434455769-17216-2-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1434455769-17216-1-git-send-email-jbe@pengutronix.de>

Even if the driver for the internal watchdog unit is disabled, it gets
enabled again silently if we select an i.MX platform.

This change compiles the driver on user demand only. Barebox can handle one
watchdog and one reset source. This change enables a user to select a
different one if the built-in unit cannot be used due to hardware issues like
power management and voltage changes the internal watchdog cannot reset
correctly.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 arch/arm/Kconfig          |  1 -
 drivers/watchdog/Kconfig  | 15 ++++++++++++---
 drivers/watchdog/Makefile |  2 +-
 drivers/watchdog/imxwd.c  |  5 ++++-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 50f3095..b115d10 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -101,7 +101,6 @@ config ARCH_IMX
 	select GPIOLIB
 	select COMMON_CLK
 	select CLKDEV_LOOKUP
-	select WATCHDOG_IMX_RESET_SOURCE
 	select HAS_DEBUG_LL
 
 config ARCH_MVEBU
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 7f7b02e..04fad45 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1,7 +1,4 @@
 
-config WATCHDOG_IMX_RESET_SOURCE
-	bool
-
 menuconfig WATCHDOG
 	bool "Watchdog support"
 	help
@@ -22,6 +19,18 @@ config WATCHDOG_IMX
 	help
 	  Add support for watchdog found on Freescale i.MX SoCs.
 
+config WATCHDOG_IMX_RESET_SOURCE
+	depends on WATCHDOG_IMX
+	bool "Reset source provider"
+	help
+	  This watchdog unit can provide the reset reason.
+
+config WATCHDOG_IMX_RESET_FEATURE
+	depends on WATCHDOG_IMX
+	bool "Use for SoC reset"
+	help
+	  This watchdog unit can be used to reset/restart the SoC.
+
 config WATCHDOG_JZ4740
 	bool "Ingenic jz4740 SoC hardware watchdog"
 	depends on MACH_MIPS_XBURST
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 865fc47..446056d 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -1,4 +1,4 @@
 obj-$(CONFIG_WATCHDOG) += wd_core.o
 obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o
 obj-$(CONFIG_WATCHDOG_JZ4740) += jz4740.o
-obj-$(CONFIG_WATCHDOG_IMX_RESET_SOURCE) += imxwd.o
+obj-$(CONFIG_WATCHDOG_IMX) += imxwd.o
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 5ffbac7..60e4c59 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -123,6 +123,7 @@ static int imx_watchdog_set_timeout(struct watchdog *wd, unsigned timeout)
 
 static struct imx_wd *reset_wd;
 
+#ifdef CONFIG_WATCHDOG_IMX_RESET_FEATURE
 void __noreturn reset_cpu(unsigned long addr)
 {
 	if (reset_wd)
@@ -132,6 +133,7 @@ void __noreturn reset_cpu(unsigned long addr)
 
 	hang();
 }
+#endif
 
 static void imx_watchdog_detect_reset_source(struct imx_wd *priv)
 {
@@ -157,7 +159,8 @@ static void imx_watchdog_detect_reset_source(struct imx_wd *priv)
 
 static int imx21_wd_init(struct imx_wd *priv)
 {
-	imx_watchdog_detect_reset_source(priv);
+	if (IS_ENABLED(CONFIG_WATCHDOG_IMX_RESET_SOURCE))
+		imx_watchdog_detect_reset_source(priv);
 
 	/*
 	 * Disable watchdog powerdown counter
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2015-06-16 11:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16 11:56 [PATCH 1/6] Documentation: add some info about the reset variants Juergen Borleis
2015-06-16 11:56 ` Juergen Borleis [this message]
2015-06-16 11:56 ` [PATCH 3/6] MFD/DA9053: adapt driver to the current reset source framework Juergen Borleis
2015-06-16 11:56 ` [PATCH 4/6] MFD/DA9053: provide system reset Juergen Borleis
2015-06-16 11:56 ` [PATCH 5/6] MFD/DA9053: remove not required header file Juergen Borleis
2015-06-16 11:56 ` [PATCH 6/6] mfd: da9063: add da9063 watchdog and system restart driver Juergen Borleis
2015-06-16 12:05 ` [PATCH 1/6] Documentation: add some info about the reset variants Jürgen Borleis

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=1434455769-17216-2-git-send-email-jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@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