All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/6] watchdog: pnx4008: add restart handler
@ 2016-02-29 17:31 ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

The LPC32xx provide the capability to perform a soft or hard reset;
a soft reset will no reset the external peripheral
(i.e. RESOUT_N output not asserted).

This changeset migrate the restart code from the "mach-lpc32xx" to
the "pnx-4008" watchdog driver and add the soft reset capability.

The default behavior (i.e. hard reset) remain unchanged.

This patchset have a dependency on the following patch:
watchdog: Add 'action' and 'data' parameters to restart handler callback
http://permalink.gmane.org/gmane.linux.watchdog/3364/

Note:
Patch #5 was generated with the option "--unified=2" to ensure
it can be apply before or after the changes for the new 
LPC32xx irqchip driver:
- http://permalink.gmane.org/gmane.linux.drivers.devicetree/144683
---
Changes from v4 to v5:
* Rebased on the following patch:
  http://permalink.gmane.org/gmane.linux.watchdog/3364/

Changes from v3 to v4:
* Update the patch as per the feedback received from:
  Arnd: http://permalink.gmane.org/gmane.linux.watchdog/3329
  - Switch patch #5 and #6 order.

Changes from v2 to v3:
* Update the patch as per the feedback received from:
  Joachim: http://permalink.gmane.org/gmane.linux.watchdog/3303
  - remove explicit clock enable from restart handler.
  - verify "register_restart_handler" return value.
  - add call to unregister_restart_handler".
  - do the restart handling directly in "pnx4008_restart_handler".
* Move the change to "phy3250.c" into a separate patch and generate
  the new patch with the "--unified=2" option.

Changes from v1 to v2:
* Rename patch title;
  was "arm: lpc32xx: restart: add support for soft reset"
* Update the patch as per the feedback received from:
  Joachim: http://permalink.gmane.org/gmane.linux.ports.arm.kernel/479791
  - migrate restart code from "mach-lpc32xx" to "pnx-4008" driver.
* Add soft reset support to "pnx-4008" driver instead of "mach-lpc32xx".
* Use define available in "pnx-4008" when writting to watchdog register.
* Remove restart handler from "mach-lpc32xx".
* Remove restart hook from "phy3250.c".
* Update driver logging during power-on. 

Sylvain Lemieux (6):
  watchdog: pnx4008: update logging during power-on
  watchdog: pnx4008: add restart handler
  watchdog: pnx4008: add support for soft reset
  watchdog: pnx4008: restart: support "cmd" from userspace
  arm: lpc32xx: phy3250 remove restart hook
  arm: lpc32xx: remove restart handler

 arch/arm/mach-lpc32xx/common.c  | 15 ---------------
 arch/arm/mach-lpc32xx/common.h  |  1 -
 arch/arm/mach-lpc32xx/phy3250.c |  1 -
 drivers/watchdog/pnx4008_wdt.c  | 42 +++++++++++++++++++++++++++++++++++++++--
 4 files changed, 40 insertions(+), 19 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 0/6] watchdog: pnx4008: add restart handler
@ 2016-02-29 17:31 ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

The LPC32xx provide the capability to perform a soft or hard reset;
a soft reset will no reset the external peripheral
(i.e. RESOUT_N output not asserted).

This changeset migrate the restart code from the "mach-lpc32xx" to
the "pnx-4008" watchdog driver and add the soft reset capability.

The default behavior (i.e. hard reset) remain unchanged.

This patchset have a dependency on the following patch:
watchdog: Add 'action' and 'data' parameters to restart handler callback
http://permalink.gmane.org/gmane.linux.watchdog/3364/

Note:
Patch #5 was generated with the option "--unified=2" to ensure
it can be apply before or after the changes for the new 
LPC32xx irqchip driver:
- http://permalink.gmane.org/gmane.linux.drivers.devicetree/144683
---
Changes from v4 to v5:
* Rebased on the following patch:
  http://permalink.gmane.org/gmane.linux.watchdog/3364/

Changes from v3 to v4:
* Update the patch as per the feedback received from:
  Arnd: http://permalink.gmane.org/gmane.linux.watchdog/3329
  - Switch patch #5 and #6 order.

Changes from v2 to v3:
* Update the patch as per the feedback received from:
  Joachim: http://permalink.gmane.org/gmane.linux.watchdog/3303
  - remove explicit clock enable from restart handler.
  - verify "register_restart_handler" return value.
  - add call to unregister_restart_handler".
  - do the restart handling directly in "pnx4008_restart_handler".
* Move the change to "phy3250.c" into a separate patch and generate
  the new patch with the "--unified=2" option.

Changes from v1 to v2:
* Rename patch title;
  was "arm: lpc32xx: restart: add support for soft reset"
* Update the patch as per the feedback received from:
  Joachim: http://permalink.gmane.org/gmane.linux.ports.arm.kernel/479791
  - migrate restart code from "mach-lpc32xx" to "pnx-4008" driver.
* Add soft reset support to "pnx-4008" driver instead of "mach-lpc32xx".
* Use define available in "pnx-4008" when writting to watchdog register.
* Remove restart handler from "mach-lpc32xx".
* Remove restart hook from "phy3250.c".
* Update driver logging during power-on. 

Sylvain Lemieux (6):
  watchdog: pnx4008: update logging during power-on
  watchdog: pnx4008: add restart handler
  watchdog: pnx4008: add support for soft reset
  watchdog: pnx4008: restart: support "cmd" from userspace
  arm: lpc32xx: phy3250 remove restart hook
  arm: lpc32xx: remove restart handler

 arch/arm/mach-lpc32xx/common.c  | 15 ---------------
 arch/arm/mach-lpc32xx/common.h  |  1 -
 arch/arm/mach-lpc32xx/phy3250.c |  1 -
 drivers/watchdog/pnx4008_wdt.c  | 42 +++++++++++++++++++++++++++++++++++++++--
 4 files changed, 40 insertions(+), 19 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 1/6] watchdog: pnx4008: update logging during power-on
  2016-02-29 17:31 ` Sylvain Lemieux
@ 2016-02-29 17:31   ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

There is no need add the driver name in the text to display
on the console during the power-on:
pnx4008-watchdog 4003c000.watchdog: PNX4008 Watchdog Timer: heartbeat 19 sec

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Changes from v4 to v5:
- Added Reviewed-by from v4.

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- none.

Changes from v1 to v2:
- new patch in v2.

 drivers/watchdog/pnx4008_wdt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 313cd1c..88264a2 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -178,8 +178,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
-	dev_info(&pdev->dev, "PNX4008 Watchdog Timer: heartbeat %d sec\n",
-		 pnx4008_wdd.timeout);
+	dev_info(&pdev->dev, "heartbeat %d sec\n", pnx4008_wdd.timeout);
 
 	return 0;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 1/6] watchdog: pnx4008: update logging during power-on
@ 2016-02-29 17:31   ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

There is no need add the driver name in the text to display
on the console during the power-on:
pnx4008-watchdog 4003c000.watchdog: PNX4008 Watchdog Timer: heartbeat 19 sec

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Changes from v4 to v5:
- Added Reviewed-by from v4.

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- none.

Changes from v1 to v2:
- new patch in v2.

 drivers/watchdog/pnx4008_wdt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 313cd1c..88264a2 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -178,8 +178,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
 		goto disable_clk;
 	}
 
-	dev_info(&pdev->dev, "PNX4008 Watchdog Timer: heartbeat %d sec\n",
-		 pnx4008_wdd.timeout);
+	dev_info(&pdev->dev, "heartbeat %d sec\n", pnx4008_wdd.timeout);
 
 	return 0;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 2/6] watchdog: pnx4008: add restart handler
  2016-02-29 17:31 ` Sylvain Lemieux
@ 2016-02-29 17:31   ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

Add restart handler capability to the driver;
the restart handler implementation was taken from
"mach-lpc32xx" ("lpc23xx_restart" function).

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- Rebased on the following patch:
  http://permalink.gmane.org/gmane.linux.watchdog/3364/

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- remove explicit clock enable from restart handler.
- verify "register_restart_handler" return value.
- add call to unregister_restart_handler".
- do the restart handling directly in "pnx4008_restart_handler".

Changes from v1 to v2:
- new patch in v2.

 drivers/watchdog/pnx4008_wdt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 88264a2..f3be522 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -31,6 +31,8 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#include <linux/delay.h>
+#include <linux/reboot.h>
 #include <mach/hardware.h>
 
 /* WatchDog Timer - Chapter 23 Page 207 */
@@ -124,6 +126,19 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
 	return 0;
 }
 
+static int pnx4008_restart_handler(struct watchdog_device *wdd,
+				   unsigned long mode, void *cmd)
+{
+	/* Instant assert of RESETOUT_N with pulse length 1mS */
+	writel(13000, WDTIM_PULSE(wdt_base));
+	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
+
+	/* Wait for watchdog to reset system */
+	mdelay(1000);
+
+	return NOTIFY_DONE;
+}
+
 static const struct watchdog_info pnx4008_wdt_ident = {
 	.options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
 	    WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
@@ -135,6 +150,7 @@ static const struct watchdog_ops pnx4008_wdt_ops = {
 	.start = pnx4008_wdt_start,
 	.stop = pnx4008_wdt_stop,
 	.set_timeout = pnx4008_wdt_set_timeout,
+	.restart = pnx4008_restart_handler,
 };
 
 static struct watchdog_device pnx4008_wdd = {
@@ -169,6 +185,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
 			WDIOF_CARDRESET : 0;
 	pnx4008_wdd.parent = &pdev->dev;
 	watchdog_set_nowayout(&pnx4008_wdd, nowayout);
+	watchdog_set_restart_priority(&pnx4008_wdd, 128);
 
 	pnx4008_wdt_stop(&pnx4008_wdd);	/* disable for now */
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 2/6] watchdog: pnx4008: add restart handler
@ 2016-02-29 17:31   ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

Add restart handler capability to the driver;
the restart handler implementation was taken from
"mach-lpc32xx" ("lpc23xx_restart" function).

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- Rebased on the following patch:
  http://permalink.gmane.org/gmane.linux.watchdog/3364/

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- remove explicit clock enable from restart handler.
- verify "register_restart_handler" return value.
- add call to unregister_restart_handler".
- do the restart handling directly in "pnx4008_restart_handler".

Changes from v1 to v2:
- new patch in v2.

 drivers/watchdog/pnx4008_wdt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 88264a2..f3be522 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -31,6 +31,8 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#include <linux/delay.h>
+#include <linux/reboot.h>
 #include <mach/hardware.h>
 
 /* WatchDog Timer - Chapter 23 Page 207 */
@@ -124,6 +126,19 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
 	return 0;
 }
 
+static int pnx4008_restart_handler(struct watchdog_device *wdd,
+				   unsigned long mode, void *cmd)
+{
+	/* Instant assert of RESETOUT_N with pulse length 1mS */
+	writel(13000, WDTIM_PULSE(wdt_base));
+	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
+
+	/* Wait for watchdog to reset system */
+	mdelay(1000);
+
+	return NOTIFY_DONE;
+}
+
 static const struct watchdog_info pnx4008_wdt_ident = {
 	.options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE |
 	    WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
@@ -135,6 +150,7 @@ static const struct watchdog_ops pnx4008_wdt_ops = {
 	.start = pnx4008_wdt_start,
 	.stop = pnx4008_wdt_stop,
 	.set_timeout = pnx4008_wdt_set_timeout,
+	.restart = pnx4008_restart_handler,
 };
 
 static struct watchdog_device pnx4008_wdd = {
@@ -169,6 +185,7 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
 			WDIOF_CARDRESET : 0;
 	pnx4008_wdd.parent = &pdev->dev;
 	watchdog_set_nowayout(&pnx4008_wdd, nowayout);
+	watchdog_set_restart_priority(&pnx4008_wdd, 128);
 
 	pnx4008_wdt_stop(&pnx4008_wdd);	/* disable for now */
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
  2016-02-29 17:31 ` Sylvain Lemieux
@ 2016-02-29 17:31   ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

Add support for explicit soft reset using the reboot mode.

The default reboot mode behavior is unchanged;
you can overwrite the default reboot type in the board specific file
"DT_MACHINE_START" definition using the "reboot_mode" parameter.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- no logical change; updated to work with new revision of patch #2.

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- no logical change; updated to work with new revision of patch #2.

Changes from v1 to v2:
- Rename patch title;
  was "arm: lpc32xx: restart: add support for soft reset"
- Add change to "pnx-4008" driver instead of "mach-lpc32xx".
- Use define available in "pnx-4008" when writting to watchdog register.

 drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index f3be522..e05bfecf 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
 static int pnx4008_restart_handler(struct watchdog_device *wdd,
 				   unsigned long mode, void *cmd)
 {
-	/* Instant assert of RESETOUT_N with pulse length 1mS */
-	writel(13000, WDTIM_PULSE(wdt_base));
-	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
+	if (mode == (unsigned long)REBOOT_SOFT) {
+		/* Force match output active */
+		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
+		/* Internal reset on match output (RESOUT_N not asserted) */
+		writel(M_RES1, WDTIM_MCTRL(wdt_base));
+	} else {
+		/* Instant assert of RESETOUT_N with pulse length 1mS */
+		writel(13000, WDTIM_PULSE(wdt_base));
+		writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
+	}
 
 	/* Wait for watchdog to reset system */
 	mdelay(1000);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
@ 2016-02-29 17:31   ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

Add support for explicit soft reset using the reboot mode.

The default reboot mode behavior is unchanged;
you can overwrite the default reboot type in the board specific file
"DT_MACHINE_START" definition using the "reboot_mode" parameter.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- no logical change; updated to work with new revision of patch #2.

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- no logical change; updated to work with new revision of patch #2.

Changes from v1 to v2:
- Rename patch title;
  was "arm: lpc32xx: restart: add support for soft reset"
- Add change to "pnx-4008" driver instead of "mach-lpc32xx".
- Use define available in "pnx-4008" when writting to watchdog register.

 drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index f3be522..e05bfecf 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
 static int pnx4008_restart_handler(struct watchdog_device *wdd,
 				   unsigned long mode, void *cmd)
 {
-	/* Instant assert of RESETOUT_N with pulse length 1mS */
-	writel(13000, WDTIM_PULSE(wdt_base));
-	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
+	if (mode == (unsigned long)REBOOT_SOFT) {
+		/* Force match output active */
+		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
+		/* Internal reset on match output (RESOUT_N not asserted) */
+		writel(M_RES1, WDTIM_MCTRL(wdt_base));
+	} else {
+		/* Instant assert of RESETOUT_N with pulse length 1mS */
+		writel(13000, WDTIM_PULSE(wdt_base));
+		writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
+	}
 
 	/* Wait for watchdog to reset system */
 	mdelay(1000);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 4/6] watchdog: pnx4008: restart: support "cmd" from userspace
  2016-02-29 17:31 ` Sylvain Lemieux
@ 2016-02-29 17:31   ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

Added support to verify if a "cmd" is passed from the userspace program rebooting the system;
- if a valid "cmd" is available, handle it;
- If the received "cmd" is not supported, use the default reboot mode.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- no logical change; updated to work with new revision of patch #2.

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- no logical change; updated to work with new revision of patch #2.

Changes from v1 to v2:
- Rename patch title;
  was "arm: lpc32xx: restart: support "cmd" from userspace"
- Add change to "pnx-4008" driver instead of "mach-lpc32xx".

 drivers/watchdog/pnx4008_wdt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index e05bfecf..df76231 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -129,6 +129,21 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
 static int pnx4008_restart_handler(struct watchdog_device *wdd,
 				   unsigned long mode, void *cmd)
 {
+	const char *boot_cmd = (const char *)cmd;
+
+	/*
+	 * Verify if a "cmd" passed from the userspace program rebooting
+	 * the system; if available, handle it.
+	 * - For details, see the 'reboot' syscall in kernel/reboot.c
+	 * - If the received "cmd" is not supported, use the default mode.
+	 */
+	if (boot_cmd) {
+		if (boot_cmd[0] == 'h')
+			mode = (unsigned long)REBOOT_HARD;
+		else if (boot_cmd[0] == 's')
+			mode = (unsigned long)REBOOT_SOFT;
+	}
+
 	if (mode == (unsigned long)REBOOT_SOFT) {
 		/* Force match output active */
 		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 4/6] watchdog: pnx4008: restart: support "cmd" from userspace
@ 2016-02-29 17:31   ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

Added support to verify if a "cmd" is passed from the userspace program rebooting the system;
- if a valid "cmd" is available, handle it;
- If the received "cmd" is not supported, use the default reboot mode.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- no logical change; updated to work with new revision of patch #2.

Changes from v3 to v4:
- none.

Changes from v2 to v3:
- no logical change; updated to work with new revision of patch #2.

Changes from v1 to v2:
- Rename patch title;
  was "arm: lpc32xx: restart: support "cmd" from userspace"
- Add change to "pnx-4008" driver instead of "mach-lpc32xx".

 drivers/watchdog/pnx4008_wdt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index e05bfecf..df76231 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -129,6 +129,21 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
 static int pnx4008_restart_handler(struct watchdog_device *wdd,
 				   unsigned long mode, void *cmd)
 {
+	const char *boot_cmd = (const char *)cmd;
+
+	/*
+	 * Verify if a "cmd" passed from the userspace program rebooting
+	 * the system; if available, handle it.
+	 * - For details, see the 'reboot' syscall in kernel/reboot.c
+	 * - If the received "cmd" is not supported, use the default mode.
+	 */
+	if (boot_cmd) {
+		if (boot_cmd[0] == 'h')
+			mode = (unsigned long)REBOOT_HARD;
+		else if (boot_cmd[0] == 's')
+			mode = (unsigned long)REBOOT_SOFT;
+	}
+
 	if (mode == (unsigned long)REBOOT_SOFT) {
 		/* Force match output active */
 		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 5/6] arm: lpc32xx: phy3250 remove restart hook
  2016-02-29 17:31 ` Sylvain Lemieux
@ 2016-02-29 17:31   ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

Remove the restart hook assignment from phy3250;
this functionality is now managed by
the pnx4008 watchdog driver.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Note:
This patch was generated with the option "--unified=2" to ensure
it can be apply before or after the changes for the new 
LPC32xx irqchip driver:
- http://permalink.gmane.org/gmane.linux.drivers.devicetree/144683

Changes from v4 to v5:
- none.

Changes from v3 to v4:
- Switch patch #5 and #6 order.

Changes from v2 to v3:
- new patch in v3.

 arch/arm/mach-lpc32xx/phy3250.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index a19071a..9e5c3db 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -211,4 +211,3 @@ DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
 	.init_machine	= lpc3250_machine_init,
 	.dt_compat	= lpc32xx_dt_compat,
-	.restart	= lpc23xx_restart,
 MACHINE_END
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 5/6] arm: lpc32xx: phy3250 remove restart hook
@ 2016-02-29 17:31   ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

Remove the restart hook assignment from phy3250;
this functionality is now managed by
the pnx4008 watchdog driver.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Note:
This patch was generated with the option "--unified=2" to ensure
it can be apply before or after the changes for the new 
LPC32xx irqchip driver:
- http://permalink.gmane.org/gmane.linux.drivers.devicetree/144683

Changes from v4 to v5:
- none.

Changes from v3 to v4:
- Switch patch #5 and #6 order.

Changes from v2 to v3:
- new patch in v3.

 arch/arm/mach-lpc32xx/phy3250.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index a19071a..9e5c3db 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -211,4 +211,3 @@ DT_MACHINE_START(LPC32XX_DT, "LPC32XX SoC (Flattened Device Tree)")
 	.init_machine	= lpc3250_machine_init,
 	.dt_compat	= lpc32xx_dt_compat,
-	.restart	= lpc23xx_restart,
 MACHINE_END
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 6/6] arm: lpc32xx: remove restart handler
  2016-02-29 17:31 ` Sylvain Lemieux
@ 2016-02-29 17:31   ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel, arnd, linux, manabian; +Cc: linux-watchdog, wim, stigge, vz

From: Sylvain Lemieux <slemieux@tycoint.com>

Remove the restart handler from "mach-lpc32xx";
this functionality is now available in the
pnx4008 watchdog driver.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- none.

Changes from v3 to v4:
- Switch patch #5 and #6 order.

Changes from v2 to v3:
- move the change to "phy3250.c" into a separate patch.

Changes from v1 to v2:
- new patch in v2.

 arch/arm/mach-lpc32xx/common.c | 15 ---------------
 arch/arm/mach-lpc32xx/common.h |  1 -
 2 files changed, 16 deletions(-)

diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 716e83e..5b7a1e7 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -194,21 +194,6 @@ void __init lpc32xx_map_io(void)
 	iotable_init(lpc32xx_io_desc, ARRAY_SIZE(lpc32xx_io_desc));
 }
 
-void lpc23xx_restart(enum reboot_mode mode, const char *cmd)
-{
-	/* Make sure WDT clocks are enabled */
-	__raw_writel(LPC32XX_CLKPWR_PWMCLK_WDOG_EN,
-		LPC32XX_CLKPWR_TIMER_CLK_CTRL);
-
-	/* Instant assert of RESETOUT_N with pulse length 1mS */
-	__raw_writel(13000, io_p2v(LPC32XX_WDTIM_BASE + 0x18));
-	__raw_writel(0x70, io_p2v(LPC32XX_WDTIM_BASE + 0xC));
-
-	/* Wait for watchdog to reset system */
-	while (1)
-		;
-}
-
 static int __init lpc32xx_check_uid(void)
 {
 	u32 uid[4];
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 1cd8853..2d90801 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -30,7 +30,6 @@ extern void lpc32xx_timer_init(void);
 extern void __init lpc32xx_init_irq(void);
 extern void __init lpc32xx_map_io(void);
 extern void __init lpc32xx_serial_init(void);
-extern void lpc23xx_restart(enum reboot_mode, const char *);
 
 
 /*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 6/6] arm: lpc32xx: remove restart handler
@ 2016-02-29 17:31   ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-02-29 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sylvain Lemieux <slemieux@tycoint.com>

Remove the restart handler from "mach-lpc32xx";
this functionality is now available in the
pnx4008 watchdog driver.

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v4 to v5:
- none.

Changes from v3 to v4:
- Switch patch #5 and #6 order.

Changes from v2 to v3:
- move the change to "phy3250.c" into a separate patch.

Changes from v1 to v2:
- new patch in v2.

 arch/arm/mach-lpc32xx/common.c | 15 ---------------
 arch/arm/mach-lpc32xx/common.h |  1 -
 2 files changed, 16 deletions(-)

diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 716e83e..5b7a1e7 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -194,21 +194,6 @@ void __init lpc32xx_map_io(void)
 	iotable_init(lpc32xx_io_desc, ARRAY_SIZE(lpc32xx_io_desc));
 }
 
-void lpc23xx_restart(enum reboot_mode mode, const char *cmd)
-{
-	/* Make sure WDT clocks are enabled */
-	__raw_writel(LPC32XX_CLKPWR_PWMCLK_WDOG_EN,
-		LPC32XX_CLKPWR_TIMER_CLK_CTRL);
-
-	/* Instant assert of RESETOUT_N with pulse length 1mS */
-	__raw_writel(13000, io_p2v(LPC32XX_WDTIM_BASE + 0x18));
-	__raw_writel(0x70, io_p2v(LPC32XX_WDTIM_BASE + 0xC));
-
-	/* Wait for watchdog to reset system */
-	while (1)
-		;
-}
-
 static int __init lpc32xx_check_uid(void)
 {
 	u32 uid[4];
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 1cd8853..2d90801 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -30,7 +30,6 @@ extern void lpc32xx_timer_init(void);
 extern void __init lpc32xx_init_irq(void);
 extern void __init lpc32xx_map_io(void);
 extern void __init lpc32xx_serial_init(void);
-extern void lpc23xx_restart(enum reboot_mode, const char *);
 
 
 /*
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
  2016-02-29 17:31   ` Sylvain Lemieux
@ 2016-03-01  4:03     ` Guenter Roeck
  -1 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2016-03-01  4:03 UTC (permalink / raw)
  To: Sylvain Lemieux, linux-arm-kernel, arnd, manabian
  Cc: linux-watchdog, wim, stigge, vz

On 02/29/2016 09:31 AM, Sylvain Lemieux wrote:
> From: Sylvain Lemieux <slemieux@tycoint.com>
>
> Add support for explicit soft reset using the reboot mode.
>
> The default reboot mode behavior is unchanged;
> you can overwrite the default reboot type in the board specific file
> "DT_MACHINE_START" definition using the "reboot_mode" parameter.
>
> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
> ---
> Changes from v4 to v5:
> - no logical change; updated to work with new revision of patch #2.
>
> Changes from v3 to v4:
> - none.
>
> Changes from v2 to v3:
> - no logical change; updated to work with new revision of patch #2.
>
> Changes from v1 to v2:
> - Rename patch title;
>    was "arm: lpc32xx: restart: add support for soft reset"
> - Add change to "pnx-4008" driver instead of "mach-lpc32xx".
> - Use define available in "pnx-4008" when writting to watchdog register.
>
>   drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
> index f3be522..e05bfecf 100644
> --- a/drivers/watchdog/pnx4008_wdt.c
> +++ b/drivers/watchdog/pnx4008_wdt.c
> @@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
>   static int pnx4008_restart_handler(struct watchdog_device *wdd,
>   				   unsigned long mode, void *cmd)
>   {
> -	/* Instant assert of RESETOUT_N with pulse length 1mS */
> -	writel(13000, WDTIM_PULSE(wdt_base));
> -	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> +	if (mode == (unsigned long)REBOOT_SOFT) {

Are those typecasts really necessary ?

Guenter

> +		/* Force match output active */
> +		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
> +		/* Internal reset on match output (RESOUT_N not asserted) */
> +		writel(M_RES1, WDTIM_MCTRL(wdt_base));
> +	} else {
> +		/* Instant assert of RESETOUT_N with pulse length 1mS */
> +		writel(13000, WDTIM_PULSE(wdt_base));
> +		writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> +	}
>
>   	/* Wait for watchdog to reset system */
>   	mdelay(1000);
>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
@ 2016-03-01  4:03     ` Guenter Roeck
  0 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2016-03-01  4:03 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/29/2016 09:31 AM, Sylvain Lemieux wrote:
> From: Sylvain Lemieux <slemieux@tycoint.com>
>
> Add support for explicit soft reset using the reboot mode.
>
> The default reboot mode behavior is unchanged;
> you can overwrite the default reboot type in the board specific file
> "DT_MACHINE_START" definition using the "reboot_mode" parameter.
>
> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
> ---
> Changes from v4 to v5:
> - no logical change; updated to work with new revision of patch #2.
>
> Changes from v3 to v4:
> - none.
>
> Changes from v2 to v3:
> - no logical change; updated to work with new revision of patch #2.
>
> Changes from v1 to v2:
> - Rename patch title;
>    was "arm: lpc32xx: restart: add support for soft reset"
> - Add change to "pnx-4008" driver instead of "mach-lpc32xx".
> - Use define available in "pnx-4008" when writting to watchdog register.
>
>   drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
> index f3be522..e05bfecf 100644
> --- a/drivers/watchdog/pnx4008_wdt.c
> +++ b/drivers/watchdog/pnx4008_wdt.c
> @@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
>   static int pnx4008_restart_handler(struct watchdog_device *wdd,
>   				   unsigned long mode, void *cmd)
>   {
> -	/* Instant assert of RESETOUT_N with pulse length 1mS */
> -	writel(13000, WDTIM_PULSE(wdt_base));
> -	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> +	if (mode == (unsigned long)REBOOT_SOFT) {

Are those typecasts really necessary ?

Guenter

> +		/* Force match output active */
> +		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
> +		/* Internal reset on match output (RESOUT_N not asserted) */
> +		writel(M_RES1, WDTIM_MCTRL(wdt_base));
> +	} else {
> +		/* Instant assert of RESETOUT_N with pulse length 1mS */
> +		writel(13000, WDTIM_PULSE(wdt_base));
> +		writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> +	}
>
>   	/* Wait for watchdog to reset system */
>   	mdelay(1000);
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
  2016-03-01  4:03     ` Guenter Roeck
@ 2016-03-01 16:04       ` Sylvain Lemieux
  -1 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-03-01 16:04 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-arm-kernel, arnd, manabian, linux-watchdog, wim, stigge, vz

On Mon, 2016-02-29 at 20:03 -0800, Guenter Roeck wrote:
> On 02/29/2016 09:31 AM, Sylvain Lemieux wrote:
> > From: Sylvain Lemieux <slemieux@tycoint.com>
> >
> > Add support for explicit soft reset using the reboot mode.
> >
> > The default reboot mode behavior is unchanged;
> > you can overwrite the default reboot type in the board specific file
> > "DT_MACHINE_START" definition using the "reboot_mode" parameter.
> >
> > Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
> > ---
> > Changes from v4 to v5:
> > - no logical change; updated to work with new revision of patch #2.
> >
> > Changes from v3 to v4:
> > - none.
> >
> > Changes from v2 to v3:
> > - no logical change; updated to work with new revision of patch #2.
> >
> > Changes from v1 to v2:
> > - Rename patch title;
> >    was "arm: lpc32xx: restart: add support for soft reset"
> > - Add change to "pnx-4008" driver instead of "mach-lpc32xx".
> > - Use define available in "pnx-4008" when writting to watchdog register.
> >
> >   drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
> >   1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
> > index f3be522..e05bfecf 100644
> > --- a/drivers/watchdog/pnx4008_wdt.c
> > +++ b/drivers/watchdog/pnx4008_wdt.c
> > @@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
> >   static int pnx4008_restart_handler(struct watchdog_device *wdd,
> >   				   unsigned long mode, void *cmd)
> >   {
> > -	/* Instant assert of RESETOUT_N with pulse length 1mS */
> > -	writel(13000, WDTIM_PULSE(wdt_base));
> > -	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> > +	if (mode == (unsigned long)REBOOT_SOFT) {
> 
> Are those typecasts really necessary ?
> 
> Guenter
> 
typecasts are optional; the compare occurred 
between "unsigned long" & "enum reboot_mode" types.

Do you want me to remove them?

Sylvain

> > +		/* Force match output active */
> > +		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
> > +		/* Internal reset on match output (RESOUT_N not asserted) */
> > +		writel(M_RES1, WDTIM_MCTRL(wdt_base));
> > +	} else {
> > +		/* Instant assert of RESETOUT_N with pulse length 1mS */
> > +		writel(13000, WDTIM_PULSE(wdt_base));
> > +		writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> > +	}
> >
> >   	/* Wait for watchdog to reset system */
> >   	mdelay(1000);
> >
> 



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
@ 2016-03-01 16:04       ` Sylvain Lemieux
  0 siblings, 0 replies; 20+ messages in thread
From: Sylvain Lemieux @ 2016-03-01 16:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2016-02-29 at 20:03 -0800, Guenter Roeck wrote:
> On 02/29/2016 09:31 AM, Sylvain Lemieux wrote:
> > From: Sylvain Lemieux <slemieux@tycoint.com>
> >
> > Add support for explicit soft reset using the reboot mode.
> >
> > The default reboot mode behavior is unchanged;
> > you can overwrite the default reboot type in the board specific file
> > "DT_MACHINE_START" definition using the "reboot_mode" parameter.
> >
> > Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
> > ---
> > Changes from v4 to v5:
> > - no logical change; updated to work with new revision of patch #2.
> >
> > Changes from v3 to v4:
> > - none.
> >
> > Changes from v2 to v3:
> > - no logical change; updated to work with new revision of patch #2.
> >
> > Changes from v1 to v2:
> > - Rename patch title;
> >    was "arm: lpc32xx: restart: add support for soft reset"
> > - Add change to "pnx-4008" driver instead of "mach-lpc32xx".
> > - Use define available in "pnx-4008" when writting to watchdog register.
> >
> >   drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
> >   1 file changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
> > index f3be522..e05bfecf 100644
> > --- a/drivers/watchdog/pnx4008_wdt.c
> > +++ b/drivers/watchdog/pnx4008_wdt.c
> > @@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
> >   static int pnx4008_restart_handler(struct watchdog_device *wdd,
> >   				   unsigned long mode, void *cmd)
> >   {
> > -	/* Instant assert of RESETOUT_N with pulse length 1mS */
> > -	writel(13000, WDTIM_PULSE(wdt_base));
> > -	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> > +	if (mode == (unsigned long)REBOOT_SOFT) {
> 
> Are those typecasts really necessary ?
> 
> Guenter
> 
typecasts are optional; the compare occurred 
between "unsigned long" & "enum reboot_mode" types.

Do you want me to remove them?

Sylvain

> > +		/* Force match output active */
> > +		writel(EXT_MATCH0, WDTIM_EMR(wdt_base));
> > +		/* Internal reset on match output (RESOUT_N not asserted) */
> > +		writel(M_RES1, WDTIM_MCTRL(wdt_base));
> > +	} else {
> > +		/* Instant assert of RESETOUT_N with pulse length 1mS */
> > +		writel(13000, WDTIM_PULSE(wdt_base));
> > +		writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
> > +	}
> >
> >   	/* Wait for watchdog to reset system */
> >   	mdelay(1000);
> >
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
  2016-03-01 16:04       ` Sylvain Lemieux
@ 2016-03-03  4:52         ` Guenter Roeck
  -1 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2016-03-03  4:52 UTC (permalink / raw)
  To: Sylvain Lemieux
  Cc: linux-arm-kernel, arnd, manabian, linux-watchdog, wim, stigge, vz

On 03/01/2016 08:04 AM, Sylvain Lemieux wrote:
> On Mon, 2016-02-29 at 20:03 -0800, Guenter Roeck wrote:
>> On 02/29/2016 09:31 AM, Sylvain Lemieux wrote:
>>> From: Sylvain Lemieux <slemieux@tycoint.com>
>>>
>>> Add support for explicit soft reset using the reboot mode.
>>>
>>> The default reboot mode behavior is unchanged;
>>> you can overwrite the default reboot type in the board specific file
>>> "DT_MACHINE_START" definition using the "reboot_mode" parameter.
>>>
>>> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
>>> ---
>>> Changes from v4 to v5:
>>> - no logical change; updated to work with new revision of patch #2.
>>>
>>> Changes from v3 to v4:
>>> - none.
>>>
>>> Changes from v2 to v3:
>>> - no logical change; updated to work with new revision of patch #2.
>>>
>>> Changes from v1 to v2:
>>> - Rename patch title;
>>>     was "arm: lpc32xx: restart: add support for soft reset"
>>> - Add change to "pnx-4008" driver instead of "mach-lpc32xx".
>>> - Use define available in "pnx-4008" when writting to watchdog register.
>>>
>>>    drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
>>>    1 file changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
>>> index f3be522..e05bfecf 100644
>>> --- a/drivers/watchdog/pnx4008_wdt.c
>>> +++ b/drivers/watchdog/pnx4008_wdt.c
>>> @@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
>>>    static int pnx4008_restart_handler(struct watchdog_device *wdd,
>>>    				   unsigned long mode, void *cmd)
>>>    {
>>> -	/* Instant assert of RESETOUT_N with pulse length 1mS */
>>> -	writel(13000, WDTIM_PULSE(wdt_base));
>>> -	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
>>> +	if (mode == (unsigned long)REBOOT_SOFT) {
>>
>> Are those typecasts really necessary ?
>>
>> Guenter
>>
> typecasts are optional; the compare occurred
> between "unsigned long" & "enum reboot_mode" types.
>
> Do you want me to remove them?
>

If they are not needed, they should not be there. Cluttering the core
with unnecessary typecasts only makes it harder to read.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset
@ 2016-03-03  4:52         ` Guenter Roeck
  0 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2016-03-03  4:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/01/2016 08:04 AM, Sylvain Lemieux wrote:
> On Mon, 2016-02-29 at 20:03 -0800, Guenter Roeck wrote:
>> On 02/29/2016 09:31 AM, Sylvain Lemieux wrote:
>>> From: Sylvain Lemieux <slemieux@tycoint.com>
>>>
>>> Add support for explicit soft reset using the reboot mode.
>>>
>>> The default reboot mode behavior is unchanged;
>>> you can overwrite the default reboot type in the board specific file
>>> "DT_MACHINE_START" definition using the "reboot_mode" parameter.
>>>
>>> Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
>>> ---
>>> Changes from v4 to v5:
>>> - no logical change; updated to work with new revision of patch #2.
>>>
>>> Changes from v3 to v4:
>>> - none.
>>>
>>> Changes from v2 to v3:
>>> - no logical change; updated to work with new revision of patch #2.
>>>
>>> Changes from v1 to v2:
>>> - Rename patch title;
>>>     was "arm: lpc32xx: restart: add support for soft reset"
>>> - Add change to "pnx-4008" driver instead of "mach-lpc32xx".
>>> - Use define available in "pnx-4008" when writting to watchdog register.
>>>
>>>    drivers/watchdog/pnx4008_wdt.c | 13 ++++++++++---
>>>    1 file changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
>>> index f3be522..e05bfecf 100644
>>> --- a/drivers/watchdog/pnx4008_wdt.c
>>> +++ b/drivers/watchdog/pnx4008_wdt.c
>>> @@ -129,9 +129,16 @@ static int pnx4008_wdt_set_timeout(struct watchdog_device *wdd,
>>>    static int pnx4008_restart_handler(struct watchdog_device *wdd,
>>>    				   unsigned long mode, void *cmd)
>>>    {
>>> -	/* Instant assert of RESETOUT_N with pulse length 1mS */
>>> -	writel(13000, WDTIM_PULSE(wdt_base));
>>> -	writel(M_RES2 | RESFRC1 | RESFRC2, WDTIM_MCTRL(wdt_base));
>>> +	if (mode == (unsigned long)REBOOT_SOFT) {
>>
>> Are those typecasts really necessary ?
>>
>> Guenter
>>
> typecasts are optional; the compare occurred
> between "unsigned long" & "enum reboot_mode" types.
>
> Do you want me to remove them?
>

If they are not needed, they should not be there. Cluttering the core
with unnecessary typecasts only makes it harder to read.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-03-03  4:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-29 17:31 [PATCH v5 0/6] watchdog: pnx4008: add restart handler Sylvain Lemieux
2016-02-29 17:31 ` Sylvain Lemieux
2016-02-29 17:31 ` [PATCH v5 1/6] watchdog: pnx4008: update logging during power-on Sylvain Lemieux
2016-02-29 17:31   ` Sylvain Lemieux
2016-02-29 17:31 ` [PATCH v5 2/6] watchdog: pnx4008: add restart handler Sylvain Lemieux
2016-02-29 17:31   ` Sylvain Lemieux
2016-02-29 17:31 ` [PATCH v5 3/6] watchdog: pnx4008: add support for soft reset Sylvain Lemieux
2016-02-29 17:31   ` Sylvain Lemieux
2016-03-01  4:03   ` Guenter Roeck
2016-03-01  4:03     ` Guenter Roeck
2016-03-01 16:04     ` Sylvain Lemieux
2016-03-01 16:04       ` Sylvain Lemieux
2016-03-03  4:52       ` Guenter Roeck
2016-03-03  4:52         ` Guenter Roeck
2016-02-29 17:31 ` [PATCH v5 4/6] watchdog: pnx4008: restart: support "cmd" from userspace Sylvain Lemieux
2016-02-29 17:31   ` Sylvain Lemieux
2016-02-29 17:31 ` [PATCH v5 5/6] arm: lpc32xx: phy3250 remove restart hook Sylvain Lemieux
2016-02-29 17:31   ` Sylvain Lemieux
2016-02-29 17:31 ` [PATCH v5 6/6] arm: lpc32xx: remove restart handler Sylvain Lemieux
2016-02-29 17:31   ` Sylvain Lemieux

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.