All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-04 16:07 ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

Here's a new patchset adding support for watchdog on Armada 375 and
Armada 38x SoCs. Regarding the previous patchset, this time we're handling
the SoCs differences in the watchdog driver itself.

The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:

 1. It has a dedicated register (similar to the one in A370/XP)
 2. Also has a bit in a shared RSTOUT register.

Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
property in the watchdog devicetree and require a new pair of cells to specify
the shared RSTOUT.

On the driver side, we need to implement per-SoC stop() and enabled()
functions. Such somewhat complex infrastructure is needed to ensure the driver
performs proper reset of the watchdog timer, by masking and disabling the
RSTOUT before the interrupt is enabled.

Changes from v1:

  * Reworked entirely!

Ezequiel Garcia (7):
  watchdog: orion: Introduce a SoC-specific RSTOUT mapping
  watchdog: orion: Introduce per-SoC stop() function
  watchdog: orion: Introduce per-SoC enabled() function
  watchdog: orion: Add Armada 375/380 SoC support
  ARM: mvebu: Enable Armada 375 watchdog in the devicetree
  ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
  ARM: mvebu: Add A375/A380 watchdog binding documentation

 .../devicetree/bindings/watchdog/marvel.txt        |   7 +
 arch/arm/boot/dts/armada-375.dtsi                  |   6 +
 arch/arm/boot/dts/armada-38x.dtsi                  |   7 +
 drivers/watchdog/orion_wdt.c                       | 167 +++++++++++++++++++--
 4 files changed, 177 insertions(+), 10 deletions(-)

-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-04 16:07 ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

Here's a new patchset adding support for watchdog on Armada 375 and
Armada 38x SoCs. Regarding the previous patchset, this time we're handling
the SoCs differences in the watchdog driver itself.

The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:

 1. It has a dedicated register (similar to the one in A370/XP)
 2. Also has a bit in a shared RSTOUT register.

Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
property in the watchdog devicetree and require a new pair of cells to specify
the shared RSTOUT.

On the driver side, we need to implement per-SoC stop() and enabled()
functions. Such somewhat complex infrastructure is needed to ensure the driver
performs proper reset of the watchdog timer, by masking and disabling the
RSTOUT before the interrupt is enabled.

Changes from v1:

  * Reworked entirely!

Ezequiel Garcia (7):
  watchdog: orion: Introduce a SoC-specific RSTOUT mapping
  watchdog: orion: Introduce per-SoC stop() function
  watchdog: orion: Introduce per-SoC enabled() function
  watchdog: orion: Add Armada 375/380 SoC support
  ARM: mvebu: Enable Armada 375 watchdog in the devicetree
  ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
  ARM: mvebu: Add A375/A380 watchdog binding documentation

 .../devicetree/bindings/watchdog/marvel.txt        |   7 +
 arch/arm/boot/dts/armada-375.dtsi                  |   6 +
 arch/arm/boot/dts/armada-38x.dtsi                  |   7 +
 drivers/watchdog/orion_wdt.c                       | 167 +++++++++++++++++++--
 4 files changed, 177 insertions(+), 10 deletions(-)

-- 
1.8.1.5


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

* [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

This commit separates the RSTOUT register mapping for the different
compatible strings supported by the driver. This is needed as
preparation work to support other SoCs.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/watchdog/orion_wdt.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 6f9b4c6..383da34 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -263,10 +263,6 @@ static void __iomem *orion_wdt_ioremap_rstout(struct platform_device *pdev,
 		return devm_ioremap(&pdev->dev, res->start,
 				    resource_size(res));
 
-	/* This workaround works only for "orion-wdt", DT-enabled */
-	if (!of_device_is_compatible(pdev->dev.of_node, "marvell,orion-wdt"))
-		return NULL;
-
 	rstout = internal_regs + ORION_RSTOUT_MASK_OFFSET;
 
 	WARN(1, FW_BUG "falling back to harcoded RSTOUT reg %pa\n", &rstout);
@@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
 static int orion_wdt_probe(struct platform_device *pdev)
 {
 	struct orion_watchdog *dev;
+	struct device_node *node = pdev->dev.of_node;
 	const struct of_device_id *match;
 	unsigned int wdt_max_duration;	/* (seconds) */
 	struct resource *res;
@@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
 	if (!dev->reg)
 		return -ENOMEM;
 
-	dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
-						     INTERNAL_REGS_MASK);
-	if (!dev->rstout)
+	if (of_device_is_compatible(node, "marvell,orion-wdt")) {
+
+		dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
+						       INTERNAL_REGS_MASK);
+		if (!dev->rstout)
+			return -ENODEV;
+
+	} else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
+		   of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+		if (!res)
+			return -ENODEV;
+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
+					   resource_size(res));
+		if (!dev->rstout)
+			return -ENOMEM;
+
+	} else {
 		return -ENODEV;
+	}
 
 	ret = dev->data->clock_init(pdev, dev);
 	if (ret) {
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

This commit separates the RSTOUT register mapping for the different
compatible strings supported by the driver. This is needed as
preparation work to support other SoCs.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/watchdog/orion_wdt.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 6f9b4c6..383da34 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -263,10 +263,6 @@ static void __iomem *orion_wdt_ioremap_rstout(struct platform_device *pdev,
 		return devm_ioremap(&pdev->dev, res->start,
 				    resource_size(res));
 
-	/* This workaround works only for "orion-wdt", DT-enabled */
-	if (!of_device_is_compatible(pdev->dev.of_node, "marvell,orion-wdt"))
-		return NULL;
-
 	rstout = internal_regs + ORION_RSTOUT_MASK_OFFSET;
 
 	WARN(1, FW_BUG "falling back to harcoded RSTOUT reg %pa\n", &rstout);
@@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
 static int orion_wdt_probe(struct platform_device *pdev)
 {
 	struct orion_watchdog *dev;
+	struct device_node *node = pdev->dev.of_node;
 	const struct of_device_id *match;
 	unsigned int wdt_max_duration;	/* (seconds) */
 	struct resource *res;
@@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
 	if (!dev->reg)
 		return -ENOMEM;
 
-	dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
-						     INTERNAL_REGS_MASK);
-	if (!dev->rstout)
+	if (of_device_is_compatible(node, "marvell,orion-wdt")) {
+
+		dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
+						       INTERNAL_REGS_MASK);
+		if (!dev->rstout)
+			return -ENODEV;
+
+	} else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
+		   of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+		if (!res)
+			return -ENODEV;
+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
+					   resource_size(res));
+		if (!dev->rstout)
+			return -ENOMEM;
+
+	} else {
 		return -ENODEV;
+	}
 
 	ret = dev->data->clock_init(pdev, dev);
 	if (ret) {
-- 
1.8.1.5


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

* [PATCH v2 2/7] watchdog: orion: Introduce per-SoC stop() function
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

In order to support other SoCs, it's needed to have a different stop()
implementation for each SoC. This commit adds no functionality, and it
consists of preparation work.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/watchdog/orion_wdt.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 383da34..c3ee305 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -59,6 +59,7 @@ struct orion_watchdog_data {
 	int (*clock_init)(struct platform_device *,
 			  struct orion_watchdog *);
 	int (*start)(struct watchdog_device *);
+	int (*stop)(struct watchdog_device *);
 };
 
 struct orion_watchdog {
@@ -190,7 +191,7 @@ static int orion_wdt_start(struct watchdog_device *wdt_dev)
 	return dev->data->start(wdt_dev);
 }
 
-static int orion_wdt_stop(struct watchdog_device *wdt_dev)
+static int orion_stop(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
 
@@ -203,6 +204,26 @@ static int orion_wdt_stop(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int armada370_stop(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	/* Disable reset on watchdog */
+	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit, 0);
+
+	/* Disable watchdog timer */
+	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
+
+	return 0;
+}
+
+static int orion_wdt_stop(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	return dev->data->stop(wdt_dev);
+}
+
 static int orion_wdt_enabled(struct orion_watchdog *dev)
 {
 	bool enabled, running;
@@ -275,6 +296,7 @@ static const struct orion_watchdog_data orion_data = {
 	.wdt_counter_offset = 0x24,
 	.clock_init = orion_wdt_clock_init,
 	.start = orion_start,
+	.stop = orion_stop,
 };
 
 static const struct orion_watchdog_data armada370_data = {
@@ -283,6 +305,7 @@ static const struct orion_watchdog_data armada370_data = {
 	.wdt_counter_offset = 0x34,
 	.clock_init = armada370_wdt_clock_init,
 	.start = armada370_start,
+	.stop = armada370_stop,
 };
 
 static const struct orion_watchdog_data armadaxp_data = {
@@ -291,6 +314,7 @@ static const struct orion_watchdog_data armadaxp_data = {
 	.wdt_counter_offset = 0x34,
 	.clock_init = armadaxp_wdt_clock_init,
 	.start = armada370_start,
+	.stop = armada370_stop,
 };
 
 static const struct of_device_id orion_wdt_of_match_table[] = {
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 2/7] watchdog: orion: Introduce per-SoC stop() function
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

In order to support other SoCs, it's needed to have a different stop()
implementation for each SoC. This commit adds no functionality, and it
consists of preparation work.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/watchdog/orion_wdt.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 383da34..c3ee305 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -59,6 +59,7 @@ struct orion_watchdog_data {
 	int (*clock_init)(struct platform_device *,
 			  struct orion_watchdog *);
 	int (*start)(struct watchdog_device *);
+	int (*stop)(struct watchdog_device *);
 };
 
 struct orion_watchdog {
@@ -190,7 +191,7 @@ static int orion_wdt_start(struct watchdog_device *wdt_dev)
 	return dev->data->start(wdt_dev);
 }
 
-static int orion_wdt_stop(struct watchdog_device *wdt_dev)
+static int orion_stop(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
 
@@ -203,6 +204,26 @@ static int orion_wdt_stop(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int armada370_stop(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	/* Disable reset on watchdog */
+	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit, 0);
+
+	/* Disable watchdog timer */
+	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
+
+	return 0;
+}
+
+static int orion_wdt_stop(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	return dev->data->stop(wdt_dev);
+}
+
 static int orion_wdt_enabled(struct orion_watchdog *dev)
 {
 	bool enabled, running;
@@ -275,6 +296,7 @@ static const struct orion_watchdog_data orion_data = {
 	.wdt_counter_offset = 0x24,
 	.clock_init = orion_wdt_clock_init,
 	.start = orion_start,
+	.stop = orion_stop,
 };
 
 static const struct orion_watchdog_data armada370_data = {
@@ -283,6 +305,7 @@ static const struct orion_watchdog_data armada370_data = {
 	.wdt_counter_offset = 0x34,
 	.clock_init = armada370_wdt_clock_init,
 	.start = armada370_start,
+	.stop = armada370_stop,
 };
 
 static const struct orion_watchdog_data armadaxp_data = {
@@ -291,6 +314,7 @@ static const struct orion_watchdog_data armadaxp_data = {
 	.wdt_counter_offset = 0x34,
 	.clock_init = armadaxp_wdt_clock_init,
 	.start = armada370_start,
+	.stop = armada370_stop,
 };
 
 static const struct of_device_id orion_wdt_of_match_table[] = {
-- 
1.8.1.5


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

* [PATCH v2 3/7] watchdog: orion: Introduce per-SoC enabled() function
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

In order to support other SoCs, it's needed to have a different enabled()
implementation for each SoC. This commit adds no functionality, and it
consists of preparation work.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/watchdog/orion_wdt.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index c3ee305..8fb8e65 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -58,6 +58,7 @@ struct orion_watchdog_data {
 	int rstout_enable_bit;
 	int (*clock_init)(struct platform_device *,
 			  struct orion_watchdog *);
+	int (*enabled)(struct orion_watchdog *);
 	int (*start)(struct watchdog_device *);
 	int (*stop)(struct watchdog_device *);
 };
@@ -224,7 +225,7 @@ static int orion_wdt_stop(struct watchdog_device *wdt_dev)
 	return dev->data->stop(wdt_dev);
 }
 
-static int orion_wdt_enabled(struct orion_watchdog *dev)
+static int orion_enabled(struct orion_watchdog *dev)
 {
 	bool enabled, running;
 
@@ -234,6 +235,13 @@ static int orion_wdt_enabled(struct orion_watchdog *dev)
 	return enabled && running;
 }
 
+static int orion_wdt_enabled(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	return dev->data->enabled(dev);
+}
+
 static unsigned int orion_wdt_get_timeleft(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -295,6 +303,7 @@ static const struct orion_watchdog_data orion_data = {
 	.wdt_enable_bit = BIT(4),
 	.wdt_counter_offset = 0x24,
 	.clock_init = orion_wdt_clock_init,
+	.enabled = orion_enabled,
 	.start = orion_start,
 	.stop = orion_stop,
 };
@@ -304,6 +313,7 @@ static const struct orion_watchdog_data armada370_data = {
 	.wdt_enable_bit = BIT(8),
 	.wdt_counter_offset = 0x34,
 	.clock_init = armada370_wdt_clock_init,
+	.enabled = orion_enabled,
 	.start = armada370_start,
 	.stop = armada370_stop,
 };
@@ -313,6 +323,7 @@ static const struct orion_watchdog_data armadaxp_data = {
 	.wdt_enable_bit = BIT(8),
 	.wdt_counter_offset = 0x34,
 	.clock_init = armadaxp_wdt_clock_init,
+	.enabled = orion_enabled,
 	.start = armada370_start,
 	.stop = armada370_stop,
 };
@@ -410,7 +421,7 @@ static int orion_wdt_probe(struct platform_device *pdev)
 	 * removed and re-insterted, or if the bootloader explicitly
 	 * set a running watchdog before booting the kernel.
 	 */
-	if (!orion_wdt_enabled(dev))
+	if (!orion_wdt_enabled(&dev->wdt))
 		orion_wdt_stop(&dev->wdt);
 
 	/* Request the IRQ only after the watchdog is disabled */
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 3/7] watchdog: orion: Introduce per-SoC enabled() function
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

In order to support other SoCs, it's needed to have a different enabled()
implementation for each SoC. This commit adds no functionality, and it
consists of preparation work.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/watchdog/orion_wdt.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index c3ee305..8fb8e65 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -58,6 +58,7 @@ struct orion_watchdog_data {
 	int rstout_enable_bit;
 	int (*clock_init)(struct platform_device *,
 			  struct orion_watchdog *);
+	int (*enabled)(struct orion_watchdog *);
 	int (*start)(struct watchdog_device *);
 	int (*stop)(struct watchdog_device *);
 };
@@ -224,7 +225,7 @@ static int orion_wdt_stop(struct watchdog_device *wdt_dev)
 	return dev->data->stop(wdt_dev);
 }
 
-static int orion_wdt_enabled(struct orion_watchdog *dev)
+static int orion_enabled(struct orion_watchdog *dev)
 {
 	bool enabled, running;
 
@@ -234,6 +235,13 @@ static int orion_wdt_enabled(struct orion_watchdog *dev)
 	return enabled && running;
 }
 
+static int orion_wdt_enabled(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	return dev->data->enabled(dev);
+}
+
 static unsigned int orion_wdt_get_timeleft(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -295,6 +303,7 @@ static const struct orion_watchdog_data orion_data = {
 	.wdt_enable_bit = BIT(4),
 	.wdt_counter_offset = 0x24,
 	.clock_init = orion_wdt_clock_init,
+	.enabled = orion_enabled,
 	.start = orion_start,
 	.stop = orion_stop,
 };
@@ -304,6 +313,7 @@ static const struct orion_watchdog_data armada370_data = {
 	.wdt_enable_bit = BIT(8),
 	.wdt_counter_offset = 0x34,
 	.clock_init = armada370_wdt_clock_init,
+	.enabled = orion_enabled,
 	.start = armada370_start,
 	.stop = armada370_stop,
 };
@@ -313,6 +323,7 @@ static const struct orion_watchdog_data armadaxp_data = {
 	.wdt_enable_bit = BIT(8),
 	.wdt_counter_offset = 0x34,
 	.clock_init = armadaxp_wdt_clock_init,
+	.enabled = orion_enabled,
 	.start = armada370_start,
 	.stop = armada370_stop,
 };
@@ -410,7 +421,7 @@ static int orion_wdt_probe(struct platform_device *pdev)
 	 * removed and re-insterted, or if the bootloader explicitly
 	 * set a running watchdog before booting the kernel.
 	 */
-	if (!orion_wdt_enabled(dev))
+	if (!orion_wdt_enabled(&dev->wdt))
 		orion_wdt_stop(&dev->wdt);
 
 	/* Request the IRQ only after the watchdog is disabled */
-- 
1.8.1.5


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

* [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

This commit adds support for the Armada 375 and Armada 380 SoCs.

This SoC variant has a second RSTOUT register, in addition to the already
existent, which is shared with the system-controller. To handle this RSTOUT,
we introduce a new MMIO register 'rstout_mask' to be required on
'armada-{375,380}-watchdog' new compatible string.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 drivers/watchdog/orion_wdt.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 8fb8e65..e567655 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -56,6 +56,7 @@ struct orion_watchdog_data {
 	int wdt_counter_offset;
 	int wdt_enable_bit;
 	int rstout_enable_bit;
+	int rstout_mask_bit;
 	int (*clock_init)(struct platform_device *,
 			  struct orion_watchdog *);
 	int (*enabled)(struct orion_watchdog *);
@@ -67,6 +68,7 @@ struct orion_watchdog {
 	struct watchdog_device wdt;
 	void __iomem *reg;
 	void __iomem *rstout;
+	void __iomem *rstout_mask;
 	unsigned long clk_rate;
 	struct clk *clk;
 	const struct orion_watchdog_data *data;
@@ -145,6 +147,27 @@ static int orion_wdt_ping(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int armada375_start(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	/* Set watchdog duration */
+	writel(dev->clk_rate * wdt_dev->timeout,
+	       dev->reg + dev->data->wdt_counter_offset);
+
+	/* Clear the watchdog expiration bit */
+	atomic_io_modify(dev->reg + TIMER_A370_STATUS, WDT_A370_EXPIRED, 0);
+
+	/* Enable watchdog timer */
+	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit,
+						dev->data->wdt_enable_bit);
+
+	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit,
+				      dev->data->rstout_enable_bit);
+	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit, 0);
+	return 0;
+}
+
 static int armada370_start(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -205,6 +228,21 @@ static int orion_stop(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int armada375_stop(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	/* Disable reset on watchdog */
+	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit,
+					   dev->data->rstout_mask_bit);
+	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit, 0);
+
+	/* Disable watchdog timer */
+	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
+
+	return 0;
+}
+
 static int armada370_stop(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -235,6 +273,17 @@ static int orion_enabled(struct orion_watchdog *dev)
 	return enabled && running;
 }
 
+static int armada375_enabled(struct orion_watchdog *dev)
+{
+	bool masked, enabled, running;
+
+	masked = readl(dev->rstout_mask) & dev->data->rstout_mask_bit;
+	enabled = readl(dev->rstout) & dev->data->rstout_enable_bit;
+	running = readl(dev->reg + TIMER_CTRL) & dev->data->wdt_enable_bit;
+
+	return !masked && enabled && running;
+}
+
 static int orion_wdt_enabled(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -328,6 +377,28 @@ static const struct orion_watchdog_data armadaxp_data = {
 	.stop = armada370_stop,
 };
 
+static const struct orion_watchdog_data armada375_data = {
+	.rstout_enable_bit = BIT(8),
+	.rstout_mask_bit = BIT(10),
+	.wdt_enable_bit = BIT(8),
+	.wdt_counter_offset = 0x34,
+	.clock_init = armada370_wdt_clock_init,
+	.enabled = armada375_enabled,
+	.start = armada375_start,
+	.stop = armada375_stop,
+};
+
+static const struct orion_watchdog_data armada380_data = {
+	.rstout_enable_bit = BIT(8),
+	.rstout_mask_bit = BIT(10),
+	.wdt_enable_bit = BIT(8),
+	.wdt_counter_offset = 0x34,
+	.clock_init = armadaxp_wdt_clock_init,
+	.enabled = armada375_enabled,
+	.start = armada375_start,
+	.stop = armada375_stop,
+};
+
 static const struct of_device_id orion_wdt_of_match_table[] = {
 	{
 		.compatible = "marvell,orion-wdt",
@@ -341,6 +412,14 @@ static const struct of_device_id orion_wdt_of_match_table[] = {
 		.compatible = "marvell,armada-xp-wdt",
 		.data = &armadaxp_data,
 	},
+	{
+		.compatible = "marvell,armada-375-wdt",
+		.data = &armada375_data,
+	},
+	{
+		.compatible = "marvell,armada-380-wdt",
+		.data = &armada380_data,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
@@ -396,6 +475,25 @@ static int orion_wdt_probe(struct platform_device *pdev)
 		if (!dev->rstout)
 			return -ENOMEM;
 
+	} else if (of_device_is_compatible(node, "marvell,armada-375-wdt") ||
+		   of_device_is_compatible(node, "marvell,armada-380-wdt")) {
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+		if (!res)
+			return -ENODEV;
+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
+					   resource_size(res));
+		if (!dev->rstout)
+			return -ENOMEM;
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+		if (!res)
+			return -ENODEV;
+		dev->rstout_mask = devm_ioremap(&pdev->dev, res->start,
+						resource_size(res));
+		if (!dev->rstout_mask)
+			return -ENOMEM;
+
 	} else {
 		return -ENODEV;
 	}
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

This commit adds support for the Armada 375 and Armada 380 SoCs.

This SoC variant has a second RSTOUT register, in addition to the already
existent, which is shared with the system-controller. To handle this RSTOUT,
we introduce a new MMIO register 'rstout_mask' to be required on
'armada-{375,380}-watchdog' new compatible string.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/watchdog/orion_wdt.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 8fb8e65..e567655 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -56,6 +56,7 @@ struct orion_watchdog_data {
 	int wdt_counter_offset;
 	int wdt_enable_bit;
 	int rstout_enable_bit;
+	int rstout_mask_bit;
 	int (*clock_init)(struct platform_device *,
 			  struct orion_watchdog *);
 	int (*enabled)(struct orion_watchdog *);
@@ -67,6 +68,7 @@ struct orion_watchdog {
 	struct watchdog_device wdt;
 	void __iomem *reg;
 	void __iomem *rstout;
+	void __iomem *rstout_mask;
 	unsigned long clk_rate;
 	struct clk *clk;
 	const struct orion_watchdog_data *data;
@@ -145,6 +147,27 @@ static int orion_wdt_ping(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int armada375_start(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	/* Set watchdog duration */
+	writel(dev->clk_rate * wdt_dev->timeout,
+	       dev->reg + dev->data->wdt_counter_offset);
+
+	/* Clear the watchdog expiration bit */
+	atomic_io_modify(dev->reg + TIMER_A370_STATUS, WDT_A370_EXPIRED, 0);
+
+	/* Enable watchdog timer */
+	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit,
+						dev->data->wdt_enable_bit);
+
+	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit,
+				      dev->data->rstout_enable_bit);
+	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit, 0);
+	return 0;
+}
+
 static int armada370_start(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -205,6 +228,21 @@ static int orion_stop(struct watchdog_device *wdt_dev)
 	return 0;
 }
 
+static int armada375_stop(struct watchdog_device *wdt_dev)
+{
+	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
+
+	/* Disable reset on watchdog */
+	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit,
+					   dev->data->rstout_mask_bit);
+	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit, 0);
+
+	/* Disable watchdog timer */
+	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
+
+	return 0;
+}
+
 static int armada370_stop(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -235,6 +273,17 @@ static int orion_enabled(struct orion_watchdog *dev)
 	return enabled && running;
 }
 
+static int armada375_enabled(struct orion_watchdog *dev)
+{
+	bool masked, enabled, running;
+
+	masked = readl(dev->rstout_mask) & dev->data->rstout_mask_bit;
+	enabled = readl(dev->rstout) & dev->data->rstout_enable_bit;
+	running = readl(dev->reg + TIMER_CTRL) & dev->data->wdt_enable_bit;
+
+	return !masked && enabled && running;
+}
+
 static int orion_wdt_enabled(struct watchdog_device *wdt_dev)
 {
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -328,6 +377,28 @@ static const struct orion_watchdog_data armadaxp_data = {
 	.stop = armada370_stop,
 };
 
+static const struct orion_watchdog_data armada375_data = {
+	.rstout_enable_bit = BIT(8),
+	.rstout_mask_bit = BIT(10),
+	.wdt_enable_bit = BIT(8),
+	.wdt_counter_offset = 0x34,
+	.clock_init = armada370_wdt_clock_init,
+	.enabled = armada375_enabled,
+	.start = armada375_start,
+	.stop = armada375_stop,
+};
+
+static const struct orion_watchdog_data armada380_data = {
+	.rstout_enable_bit = BIT(8),
+	.rstout_mask_bit = BIT(10),
+	.wdt_enable_bit = BIT(8),
+	.wdt_counter_offset = 0x34,
+	.clock_init = armadaxp_wdt_clock_init,
+	.enabled = armada375_enabled,
+	.start = armada375_start,
+	.stop = armada375_stop,
+};
+
 static const struct of_device_id orion_wdt_of_match_table[] = {
 	{
 		.compatible = "marvell,orion-wdt",
@@ -341,6 +412,14 @@ static const struct of_device_id orion_wdt_of_match_table[] = {
 		.compatible = "marvell,armada-xp-wdt",
 		.data = &armadaxp_data,
 	},
+	{
+		.compatible = "marvell,armada-375-wdt",
+		.data = &armada375_data,
+	},
+	{
+		.compatible = "marvell,armada-380-wdt",
+		.data = &armada380_data,
+	},
 	{},
 };
 MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
@@ -396,6 +475,25 @@ static int orion_wdt_probe(struct platform_device *pdev)
 		if (!dev->rstout)
 			return -ENOMEM;
 
+	} else if (of_device_is_compatible(node, "marvell,armada-375-wdt") ||
+		   of_device_is_compatible(node, "marvell,armada-380-wdt")) {
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+		if (!res)
+			return -ENODEV;
+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
+					   resource_size(res));
+		if (!dev->rstout)
+			return -ENOMEM;
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+		if (!res)
+			return -ENODEV;
+		dev->rstout_mask = devm_ioremap(&pdev->dev, res->start,
+						resource_size(res));
+		if (!dev->rstout_mask)
+			return -ENOMEM;
+
 	} else {
 		return -ENODEV;
 	}
-- 
1.8.1.5


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

* [PATCH v2 5/7] ARM: mvebu: Enable Armada 375 watchdog in the devicetree
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

Add the DT nodes to enable the watchdog support available on
Armada 375 SoC.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 arch/arm/boot/dts/armada-375.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index 3877693f..0bfa57b 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -320,6 +320,12 @@
 				clocks = <&coreclk 0>;
 			};
 
+			watchdog@20300 {
+				compatible = "marvell,armada-375-wdt";
+				reg = <0x20300 0x34>, <0x20704 0x4>, <0x18254 0x4>;
+				clocks = <&coreclk 0>;
+			};
+
 			xor@60800 {
 				compatible = "marvell,orion-xor";
 				reg = <0x60800 0x100
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 5/7] ARM: mvebu: Enable Armada 375 watchdog in the devicetree
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

Add the DT nodes to enable the watchdog support available on
Armada 375 SoC.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 arch/arm/boot/dts/armada-375.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index 3877693f..0bfa57b 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -320,6 +320,12 @@
 				clocks = <&coreclk 0>;
 			};
 
+			watchdog@20300 {
+				compatible = "marvell,armada-375-wdt";
+				reg = <0x20300 0x34>, <0x20704 0x4>, <0x18254 0x4>;
+				clocks = <&coreclk 0>;
+			};
+
 			xor@60800 {
 				compatible = "marvell,orion-xor";
 				reg = <0x60800 0x100
-- 
1.8.1.5


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

* [PATCH v2 6/7] ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

Add the DT nodes to enable the watchdog support available on
Armada 380/385 SoC.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 arch/arm/boot/dts/armada-38x.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 812ce28..2f0ebc6 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -267,6 +267,13 @@
 				clock-names = "nbclk", "fixed";
 			};
 
+			watchdog@20300 {
+				compatible = "marvell,armada-380-wdt";
+				reg = <0x20300 0x34>, <0x20704 0x4>, <0x18260 0x4>;
+				clocks = <&coreclk 2>, <&refclk>;
+				clock-names = "nbclk", "fixed";
+			};
+
 			eth1: ethernet@30000 {
 				compatible = "marvell,armada-370-neta";
 				reg = <0x30000 0x4000>;
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 6/7] ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

Add the DT nodes to enable the watchdog support available on
Armada 380/385 SoC.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 arch/arm/boot/dts/armada-38x.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 812ce28..2f0ebc6 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -267,6 +267,13 @@
 				clock-names = "nbclk", "fixed";
 			};
 
+			watchdog@20300 {
+				compatible = "marvell,armada-380-wdt";
+				reg = <0x20300 0x34>, <0x20704 0x4>, <0x18260 0x4>;
+				clocks = <&coreclk 2>, <&refclk>;
+				clock-names = "nbclk", "fixed";
+			};
+
 			eth1: ethernet@30000 {
 				compatible = "marvell,armada-370-neta";
 				reg = <0x30000 0x4000>;
-- 
1.8.1.5


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

* [PATCH v2 7/7] ARM: mvebu: Add A375/A380 watchdog binding documentation
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 16:07     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

This commit documents the new support for "marvell,armada-{375,380}-wdt"
compatible strings and the extra 'reg' entry requirement.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 Documentation/devicetree/bindings/watchdog/marvel.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/marvel.txt b/Documentation/devicetree/bindings/watchdog/marvel.txt
index de11eb4..97223fd 100644
--- a/Documentation/devicetree/bindings/watchdog/marvel.txt
+++ b/Documentation/devicetree/bindings/watchdog/marvel.txt
@@ -5,11 +5,18 @@ Required Properties:
 - Compatibility : "marvell,orion-wdt"
 		  "marvell,armada-370-wdt"
 		  "marvell,armada-xp-wdt"
+		  "marvell,armada-375-wdt"
+		  "marvell,armada-380-wdt"
 
 - reg		: Should contain two entries: first one with the
 		  timer control address, second one with the
 		  rstout enable address.
 
+For "marvell,armada-375-wdt" and "marvell,armada-380-wdt":
+
+- reg		: A third entry is mandatory and should contain the
+                  shared mask/unmask RSTOUT address.
+
 Optional properties:
 
 - interrupts	: Contains the IRQ for watchdog expiration
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v2 7/7] ARM: mvebu: Add A375/A380 watchdog binding documentation
@ 2014-03-04 16:07     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 16:07 UTC (permalink / raw)
  To: linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk, Ezequiel Garcia

This commit documents the new support for "marvell,armada-{375,380}-wdt"
compatible strings and the extra 'reg' entry requirement.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 Documentation/devicetree/bindings/watchdog/marvel.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/marvel.txt b/Documentation/devicetree/bindings/watchdog/marvel.txt
index de11eb4..97223fd 100644
--- a/Documentation/devicetree/bindings/watchdog/marvel.txt
+++ b/Documentation/devicetree/bindings/watchdog/marvel.txt
@@ -5,11 +5,18 @@ Required Properties:
 - Compatibility : "marvell,orion-wdt"
 		  "marvell,armada-370-wdt"
 		  "marvell,armada-xp-wdt"
+		  "marvell,armada-375-wdt"
+		  "marvell,armada-380-wdt"
 
 - reg		: Should contain two entries: first one with the
 		  timer control address, second one with the
 		  rstout enable address.
 
+For "marvell,armada-375-wdt" and "marvell,armada-380-wdt":
+
+- reg		: A third entry is mandatory and should contain the
+                  shared mask/unmask RSTOUT address.
+
 Optional properties:
 
 - interrupts	: Contains the IRQ for watchdog expiration
-- 
1.8.1.5


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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-04 17:53     ` Jason Cooper
  -1 siblings, 0 replies; 38+ messages in thread
From: Jason Cooper @ 2014-03-04 17:53 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Wim Van Sebroeck,
	Jason Gunthorpe, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

Ezequiel,

On Tue, Mar 04, 2014 at 01:07:17PM -0300, Ezequiel Garcia wrote:
> Here's a new patchset adding support for watchdog on Armada 375 and
> Armada 38x SoCs. Regarding the previous patchset, this time we're handling
> the SoCs differences in the watchdog driver itself.
> 
> The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:
> 
>  1. It has a dedicated register (similar to the one in A370/XP)
>  2. Also has a bit in a shared RSTOUT register.
> 
> Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
> property in the watchdog devicetree and require a new pair of cells to specify
> the shared RSTOUT.
> 
> On the driver side, we need to implement per-SoC stop() and enabled()
> functions. Such somewhat complex infrastructure is needed to ensure the driver
> performs proper reset of the watchdog timer, by masking and disabling the
> RSTOUT before the interrupt is enabled.
> 
> Changes from v1:
> 
>   * Reworked entirely!
> 
> Ezequiel Garcia (7):
>   watchdog: orion: Introduce a SoC-specific RSTOUT mapping
>   watchdog: orion: Introduce per-SoC stop() function
>   watchdog: orion: Introduce per-SoC enabled() function
>   watchdog: orion: Add Armada 375/380 SoC support
>   ARM: mvebu: Enable Armada 375 watchdog in the devicetree
>   ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
>   ARM: mvebu: Add A375/A380 watchdog binding documentation
> 
>  .../devicetree/bindings/watchdog/marvel.txt        |   7 +
>  arch/arm/boot/dts/armada-375.dtsi                  |   6 +
>  arch/arm/boot/dts/armada-38x.dtsi                  |   7 +
>  drivers/watchdog/orion_wdt.c                       | 167 +++++++++++++++++++--
>  4 files changed, 177 insertions(+), 10 deletions(-)

>From a cursory look, this is a big improvement.  Just one small note:  I
almost didn't see this, since I wasn't in the Cc.  No need to resend, I
bounced it around to the right folders so I can track it.

thx,

Jason.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-04 17:53     ` Jason Cooper
  0 siblings, 0 replies; 38+ messages in thread
From: Jason Cooper @ 2014-03-04 17:53 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: linux-watchdog, devicetree, Wim Van Sebroeck, Jason Gunthorpe,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
	Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

Ezequiel,

On Tue, Mar 04, 2014 at 01:07:17PM -0300, Ezequiel Garcia wrote:
> Here's a new patchset adding support for watchdog on Armada 375 and
> Armada 38x SoCs. Regarding the previous patchset, this time we're handling
> the SoCs differences in the watchdog driver itself.
> 
> The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:
> 
>  1. It has a dedicated register (similar to the one in A370/XP)
>  2. Also has a bit in a shared RSTOUT register.
> 
> Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
> property in the watchdog devicetree and require a new pair of cells to specify
> the shared RSTOUT.
> 
> On the driver side, we need to implement per-SoC stop() and enabled()
> functions. Such somewhat complex infrastructure is needed to ensure the driver
> performs proper reset of the watchdog timer, by masking and disabling the
> RSTOUT before the interrupt is enabled.
> 
> Changes from v1:
> 
>   * Reworked entirely!
> 
> Ezequiel Garcia (7):
>   watchdog: orion: Introduce a SoC-specific RSTOUT mapping
>   watchdog: orion: Introduce per-SoC stop() function
>   watchdog: orion: Introduce per-SoC enabled() function
>   watchdog: orion: Add Armada 375/380 SoC support
>   ARM: mvebu: Enable Armada 375 watchdog in the devicetree
>   ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
>   ARM: mvebu: Add A375/A380 watchdog binding documentation
> 
>  .../devicetree/bindings/watchdog/marvel.txt        |   7 +
>  arch/arm/boot/dts/armada-375.dtsi                  |   6 +
>  arch/arm/boot/dts/armada-38x.dtsi                  |   7 +
>  drivers/watchdog/orion_wdt.c                       | 167 +++++++++++++++++++--
>  4 files changed, 177 insertions(+), 10 deletions(-)

>From a cursory look, this is a big improvement.  Just one small note:  I
almost didn't see this, since I wasn't in the Cc.  No need to resend, I
bounced it around to the right folders so I can track it.

thx,

Jason.

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
  2014-03-04 17:53     ` Jason Cooper
@ 2014-03-04 20:03         ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 20:03 UTC (permalink / raw)
  To: Jason Cooper
  Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Wim Van Sebroeck,
	Jason Gunthorpe, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

On Mar 04, Jason Cooper wrote:
> On Tue, Mar 04, 2014 at 01:07:17PM -0300, Ezequiel Garcia wrote:
> > Here's a new patchset adding support for watchdog on Armada 375 and
> > Armada 38x SoCs. Regarding the previous patchset, this time we're handling
> > the SoCs differences in the watchdog driver itself.
> > 
> > The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:
> > 
> >  1. It has a dedicated register (similar to the one in A370/XP)
> >  2. Also has a bit in a shared RSTOUT register.
> > 
> > Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
> > property in the watchdog devicetree and require a new pair of cells to specify
> > the shared RSTOUT.
> > 
> > On the driver side, we need to implement per-SoC stop() and enabled()
> > functions. Such somewhat complex infrastructure is needed to ensure the driver
> > performs proper reset of the watchdog timer, by masking and disabling the
> > RSTOUT before the interrupt is enabled.
> > 
> > Changes from v1:
> > 
> >   * Reworked entirely!
> > 
> > Ezequiel Garcia (7):
> >   watchdog: orion: Introduce a SoC-specific RSTOUT mapping
> >   watchdog: orion: Introduce per-SoC stop() function
> >   watchdog: orion: Introduce per-SoC enabled() function
> >   watchdog: orion: Add Armada 375/380 SoC support
> >   ARM: mvebu: Enable Armada 375 watchdog in the devicetree
> >   ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
> >   ARM: mvebu: Add A375/A380 watchdog binding documentation
> > 
> >  .../devicetree/bindings/watchdog/marvel.txt        |   7 +
> >  arch/arm/boot/dts/armada-375.dtsi                  |   6 +
> >  arch/arm/boot/dts/armada-38x.dtsi                  |   7 +
> >  drivers/watchdog/orion_wdt.c                       | 167 +++++++++++++++++++--
> >  4 files changed, 177 insertions(+), 10 deletions(-)
> 
> From a cursory look, this is a big improvement.  Just one small note:  I
> almost didn't see this, since I wasn't in the Cc.  No need to resend, I
> bounced it around to the right folders so I can track it.
> 

Ouch.. sorry about that. Of course, wasn't on purpose!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-04 20:03         ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-04 20:03 UTC (permalink / raw)
  To: Jason Cooper
  Cc: linux-watchdog, devicetree, Wim Van Sebroeck, Jason Gunthorpe,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
	Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

On Mar 04, Jason Cooper wrote:
> On Tue, Mar 04, 2014 at 01:07:17PM -0300, Ezequiel Garcia wrote:
> > Here's a new patchset adding support for watchdog on Armada 375 and
> > Armada 38x SoCs. Regarding the previous patchset, this time we're handling
> > the SoCs differences in the watchdog driver itself.
> > 
> > The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:
> > 
> >  1. It has a dedicated register (similar to the one in A370/XP)
> >  2. Also has a bit in a shared RSTOUT register.
> > 
> > Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
> > property in the watchdog devicetree and require a new pair of cells to specify
> > the shared RSTOUT.
> > 
> > On the driver side, we need to implement per-SoC stop() and enabled()
> > functions. Such somewhat complex infrastructure is needed to ensure the driver
> > performs proper reset of the watchdog timer, by masking and disabling the
> > RSTOUT before the interrupt is enabled.
> > 
> > Changes from v1:
> > 
> >   * Reworked entirely!
> > 
> > Ezequiel Garcia (7):
> >   watchdog: orion: Introduce a SoC-specific RSTOUT mapping
> >   watchdog: orion: Introduce per-SoC stop() function
> >   watchdog: orion: Introduce per-SoC enabled() function
> >   watchdog: orion: Add Armada 375/380 SoC support
> >   ARM: mvebu: Enable Armada 375 watchdog in the devicetree
> >   ARM: mvebu: Enable Armada 380/385 watchdog in the devicetree
> >   ARM: mvebu: Add A375/A380 watchdog binding documentation
> > 
> >  .../devicetree/bindings/watchdog/marvel.txt        |   7 +
> >  arch/arm/boot/dts/armada-375.dtsi                  |   6 +
> >  arch/arm/boot/dts/armada-38x.dtsi                  |   7 +
> >  drivers/watchdog/orion_wdt.c                       | 167 +++++++++++++++++++--
> >  4 files changed, 177 insertions(+), 10 deletions(-)
> 
> From a cursory look, this is a big improvement.  Just one small note:  I
> almost didn't see this, since I wasn't in the Cc.  No need to resend, I
> bounced it around to the right folders so I can track it.
> 

Ouch.. sorry about that. Of course, wasn't on purpose!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
  2014-03-04 16:07 ` Ezequiel Garcia
@ 2014-03-07  0:13     ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-07  0:13 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Wim Van Sebroeck, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Mar 04, Ezequiel Garcia wrote:
> Here's a new patchset adding support for watchdog on Armada 375 and
> Armada 38x SoCs. Regarding the previous patchset, this time we're handling
> the SoCs differences in the watchdog driver itself.
> 
> The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:
> 
>  1. It has a dedicated register (similar to the one in A370/XP)
>  2. Also has a bit in a shared RSTOUT register.
> 
> Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
> property in the watchdog devicetree and require a new pair of cells to specify
> the shared RSTOUT.
> 
> On the driver side, we need to implement per-SoC stop() and enabled()
> functions. Such somewhat complex infrastructure is needed to ensure the driver
> performs proper reset of the watchdog timer, by masking and disabling the
> RSTOUT before the interrupt is enabled.
> 

JasonG: How does this look now?

Any chance someone gives a Tested-by on Dove/Kirkwood?
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-07  0:13     ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-07  0:13 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Wim Van Sebroeck, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk,
	linux-watchdog, devicetree

On Mar 04, Ezequiel Garcia wrote:
> Here's a new patchset adding support for watchdog on Armada 375 and
> Armada 38x SoCs. Regarding the previous patchset, this time we're handling
> the SoCs differences in the watchdog driver itself.
> 
> The new Armada 375/385 SoCs have two registers for the watchdog RSTOUT:
> 
>  1. It has a dedicated register (similar to the one in A370/XP)
>  2. Also has a bit in a shared RSTOUT register.
> 
> Therefore, in order to support this two-folded RSTOUT, we extend the 'reg'
> property in the watchdog devicetree and require a new pair of cells to specify
> the shared RSTOUT.
> 
> On the driver side, we need to implement per-SoC stop() and enabled()
> functions. Such somewhat complex infrastructure is needed to ensure the driver
> performs proper reset of the watchdog timer, by masking and disabling the
> RSTOUT before the interrupt is enabled.
> 

JasonG: How does this look now?

Any chance someone gives a Tested-by on Dove/Kirkwood?
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
  2014-03-04 16:07     ` Ezequiel Garcia
@ 2014-03-10  2:09         ` Guenter Roeck
  -1 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:09 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> This commit separates the RSTOUT register mapping for the different
> compatible strings supported by the driver. This is needed as
> preparation work to support other SoCs.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>   drivers/watchdog/orion_wdt.c | 28 +++++++++++++++++++++-------
>   1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 6f9b4c6..383da34 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -263,10 +263,6 @@ static void __iomem *orion_wdt_ioremap_rstout(struct platform_device *pdev,
>   		return devm_ioremap(&pdev->dev, res->start,
>   				    resource_size(res));
>
> -	/* This workaround works only for "orion-wdt", DT-enabled */
> -	if (!of_device_is_compatible(pdev->dev.of_node, "marvell,orion-wdt"))
> -		return NULL;
> -
>   	rstout = internal_regs + ORION_RSTOUT_MASK_OFFSET;
>
>   	WARN(1, FW_BUG "falling back to harcoded RSTOUT reg %pa\n", &rstout);
> @@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
>   static int orion_wdt_probe(struct platform_device *pdev)
>   {
>   	struct orion_watchdog *dev;
> +	struct device_node *node = pdev->dev.of_node;
>   	const struct of_device_id *match;
>   	unsigned int wdt_max_duration;	/* (seconds) */
>   	struct resource *res;
> @@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
>   	if (!dev->reg)
>   		return -ENOMEM;
>
> -	dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> -						     INTERNAL_REGS_MASK);
> -	if (!dev->rstout)
> +	if (of_device_is_compatible(node, "marvell,orion-wdt")) {
> +
> +		dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> +						       INTERNAL_REGS_MASK);
> +		if (!dev->rstout)
> +			return -ENODEV;
> +
> +	} else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
> +		   of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +		if (!res)
> +			return -ENODEV;
> +		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> +					   resource_size(res));

Better use devm_ioremap_resource, and then you don't have to check for
the error from platform_get_resource() since devm_ioremap_resource()
takes care of it.

The same change should be made for the other calls call to devm_ioremap;
different patch though.

On a side note, the resource is always assigned, only a workaround exists
for "marvell,orion-wdt" if it isn't. Wonder if it would make sense
to move the calls to platform_get_resource and devm_ioremap[_resource]
further up and have it just in this function.


> +		if (!dev->rstout)
> +			return -ENOMEM;
> +
> +	} else {
>   		return -ENODEV;

Is this stricter than the original code on purpose ?

Previously the driver would instantiate successfully in this case
as long as IORESOURCE_MEM, 1 was defined.


> +	}
>
>   	ret = dev->data->clock_init(pdev, dev);
>   	if (ret) {
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
@ 2014-03-10  2:09         ` Guenter Roeck
  0 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:09 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> This commit separates the RSTOUT register mapping for the different
> compatible strings supported by the driver. This is needed as
> preparation work to support other SoCs.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
>   drivers/watchdog/orion_wdt.c | 28 +++++++++++++++++++++-------
>   1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 6f9b4c6..383da34 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -263,10 +263,6 @@ static void __iomem *orion_wdt_ioremap_rstout(struct platform_device *pdev,
>   		return devm_ioremap(&pdev->dev, res->start,
>   				    resource_size(res));
>
> -	/* This workaround works only for "orion-wdt", DT-enabled */
> -	if (!of_device_is_compatible(pdev->dev.of_node, "marvell,orion-wdt"))
> -		return NULL;
> -
>   	rstout = internal_regs + ORION_RSTOUT_MASK_OFFSET;
>
>   	WARN(1, FW_BUG "falling back to harcoded RSTOUT reg %pa\n", &rstout);
> @@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
>   static int orion_wdt_probe(struct platform_device *pdev)
>   {
>   	struct orion_watchdog *dev;
> +	struct device_node *node = pdev->dev.of_node;
>   	const struct of_device_id *match;
>   	unsigned int wdt_max_duration;	/* (seconds) */
>   	struct resource *res;
> @@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
>   	if (!dev->reg)
>   		return -ENOMEM;
>
> -	dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> -						     INTERNAL_REGS_MASK);
> -	if (!dev->rstout)
> +	if (of_device_is_compatible(node, "marvell,orion-wdt")) {
> +
> +		dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> +						       INTERNAL_REGS_MASK);
> +		if (!dev->rstout)
> +			return -ENODEV;
> +
> +	} else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
> +		   of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> +		if (!res)
> +			return -ENODEV;
> +		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> +					   resource_size(res));

Better use devm_ioremap_resource, and then you don't have to check for
the error from platform_get_resource() since devm_ioremap_resource()
takes care of it.

The same change should be made for the other calls call to devm_ioremap;
different patch though.

On a side note, the resource is always assigned, only a workaround exists
for "marvell,orion-wdt" if it isn't. Wonder if it would make sense
to move the calls to platform_get_resource and devm_ioremap[_resource]
further up and have it just in this function.


> +		if (!dev->rstout)
> +			return -ENOMEM;
> +
> +	} else {
>   		return -ENODEV;

Is this stricter than the original code on purpose ?

Previously the driver would instantiate successfully in this case
as long as IORESOURCE_MEM, 1 was defined.


> +	}
>
>   	ret = dev->data->clock_init(pdev, dev);
>   	if (ret) {
>


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

* Re: [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support
  2014-03-04 16:07     ` Ezequiel Garcia
@ 2014-03-10  2:12         ` Guenter Roeck
  -1 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:12 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> This commit adds support for the Armada 375 and Armada 380 SoCs.
>
> This SoC variant has a second RSTOUT register, in addition to the already
> existent, which is shared with the system-controller. To handle this RSTOUT,
> we introduce a new MMIO register 'rstout_mask' to be required on
> 'armada-{375,380}-watchdog' new compatible string.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>   drivers/watchdog/orion_wdt.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 98 insertions(+)
>
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 8fb8e65..e567655 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -56,6 +56,7 @@ struct orion_watchdog_data {
>   	int wdt_counter_offset;
>   	int wdt_enable_bit;
>   	int rstout_enable_bit;
> +	int rstout_mask_bit;
>   	int (*clock_init)(struct platform_device *,
>   			  struct orion_watchdog *);
>   	int (*enabled)(struct orion_watchdog *);
> @@ -67,6 +68,7 @@ struct orion_watchdog {
>   	struct watchdog_device wdt;
>   	void __iomem *reg;
>   	void __iomem *rstout;
> +	void __iomem *rstout_mask;
>   	unsigned long clk_rate;
>   	struct clk *clk;
>   	const struct orion_watchdog_data *data;
> @@ -145,6 +147,27 @@ static int orion_wdt_ping(struct watchdog_device *wdt_dev)
>   	return 0;
>   }
>
> +static int armada375_start(struct watchdog_device *wdt_dev)
> +{
> +	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> +
> +	/* Set watchdog duration */
> +	writel(dev->clk_rate * wdt_dev->timeout,
> +	       dev->reg + dev->data->wdt_counter_offset);
> +
> +	/* Clear the watchdog expiration bit */
> +	atomic_io_modify(dev->reg + TIMER_A370_STATUS, WDT_A370_EXPIRED, 0);
> +
> +	/* Enable watchdog timer */
> +	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit,
> +						dev->data->wdt_enable_bit);
> +
> +	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit,
> +				      dev->data->rstout_enable_bit);
> +	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit, 0);
> +	return 0;
> +}
> +
>   static int armada370_start(struct watchdog_device *wdt_dev)
>   {
>   	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -205,6 +228,21 @@ static int orion_stop(struct watchdog_device *wdt_dev)
>   	return 0;
>   }
>
> +static int armada375_stop(struct watchdog_device *wdt_dev)
> +{
> +	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> +
> +	/* Disable reset on watchdog */
> +	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit,
> +					   dev->data->rstout_mask_bit);
> +	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit, 0);
> +
> +	/* Disable watchdog timer */
> +	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
> +
> +	return 0;
> +}
> +
>   static int armada370_stop(struct watchdog_device *wdt_dev)
>   {
>   	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -235,6 +273,17 @@ static int orion_enabled(struct orion_watchdog *dev)
>   	return enabled && running;
>   }
>
> +static int armada375_enabled(struct orion_watchdog *dev)
> +{
> +	bool masked, enabled, running;
> +
> +	masked = readl(dev->rstout_mask) & dev->data->rstout_mask_bit;
> +	enabled = readl(dev->rstout) & dev->data->rstout_enable_bit;
> +	running = readl(dev->reg + TIMER_CTRL) & dev->data->wdt_enable_bit;
> +
> +	return !masked && enabled && running;
> +}
> +
>   static int orion_wdt_enabled(struct watchdog_device *wdt_dev)
>   {
>   	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -328,6 +377,28 @@ static const struct orion_watchdog_data armadaxp_data = {
>   	.stop = armada370_stop,
>   };
>
> +static const struct orion_watchdog_data armada375_data = {
> +	.rstout_enable_bit = BIT(8),
> +	.rstout_mask_bit = BIT(10),
> +	.wdt_enable_bit = BIT(8),
> +	.wdt_counter_offset = 0x34,
> +	.clock_init = armada370_wdt_clock_init,
> +	.enabled = armada375_enabled,
> +	.start = armada375_start,
> +	.stop = armada375_stop,
> +};
> +
> +static const struct orion_watchdog_data armada380_data = {
> +	.rstout_enable_bit = BIT(8),
> +	.rstout_mask_bit = BIT(10),
> +	.wdt_enable_bit = BIT(8),
> +	.wdt_counter_offset = 0x34,
> +	.clock_init = armadaxp_wdt_clock_init,
> +	.enabled = armada375_enabled,
> +	.start = armada375_start,
> +	.stop = armada375_stop,
> +};
> +
>   static const struct of_device_id orion_wdt_of_match_table[] = {
>   	{
>   		.compatible = "marvell,orion-wdt",
> @@ -341,6 +412,14 @@ static const struct of_device_id orion_wdt_of_match_table[] = {
>   		.compatible = "marvell,armada-xp-wdt",
>   		.data = &armadaxp_data,
>   	},
> +	{
> +		.compatible = "marvell,armada-375-wdt",
> +		.data = &armada375_data,
> +	},
> +	{
> +		.compatible = "marvell,armada-380-wdt",
> +		.data = &armada380_data,
> +	},
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> @@ -396,6 +475,25 @@ static int orion_wdt_probe(struct platform_device *pdev)
>   		if (!dev->rstout)
>   			return -ENOMEM;
>
> +	} else if (of_device_is_compatible(node, "marvell,armada-375-wdt") ||
> +		   of_device_is_compatible(node, "marvell,armada-380-wdt")) {
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);

Looks like each supported watchdog needs this call. Might as well do it earlier
and just once, unless you have a good reason for doing it this way.
To me this just looks like a lot of code replication.

It might also possibly make sense to move all the memory initializations
into a separate function; the probe function gets a bit large.

> +		if (!res)
> +			return -ENODEV;
> +		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> +					   resource_size(res));
> +		if (!dev->rstout)
> +			return -ENOMEM;
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> +		if (!res)
> +			return -ENODEV;
> +		dev->rstout_mask = devm_ioremap(&pdev->dev, res->start,
> +						resource_size(res));

devm_ioremap_resource() is better here.

Guenter

> +		if (!dev->rstout_mask)
> +			return -ENOMEM;
> +
>   	} else {
>   		return -ENODEV;
>   	}
>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support
@ 2014-03-10  2:12         ` Guenter Roeck
  0 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:12 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> This commit adds support for the Armada 375 and Armada 380 SoCs.
>
> This SoC variant has a second RSTOUT register, in addition to the already
> existent, which is shared with the system-controller. To handle this RSTOUT,
> we introduce a new MMIO register 'rstout_mask' to be required on
> 'armada-{375,380}-watchdog' new compatible string.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
>   drivers/watchdog/orion_wdt.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 98 insertions(+)
>
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index 8fb8e65..e567655 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -56,6 +56,7 @@ struct orion_watchdog_data {
>   	int wdt_counter_offset;
>   	int wdt_enable_bit;
>   	int rstout_enable_bit;
> +	int rstout_mask_bit;
>   	int (*clock_init)(struct platform_device *,
>   			  struct orion_watchdog *);
>   	int (*enabled)(struct orion_watchdog *);
> @@ -67,6 +68,7 @@ struct orion_watchdog {
>   	struct watchdog_device wdt;
>   	void __iomem *reg;
>   	void __iomem *rstout;
> +	void __iomem *rstout_mask;
>   	unsigned long clk_rate;
>   	struct clk *clk;
>   	const struct orion_watchdog_data *data;
> @@ -145,6 +147,27 @@ static int orion_wdt_ping(struct watchdog_device *wdt_dev)
>   	return 0;
>   }
>
> +static int armada375_start(struct watchdog_device *wdt_dev)
> +{
> +	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> +
> +	/* Set watchdog duration */
> +	writel(dev->clk_rate * wdt_dev->timeout,
> +	       dev->reg + dev->data->wdt_counter_offset);
> +
> +	/* Clear the watchdog expiration bit */
> +	atomic_io_modify(dev->reg + TIMER_A370_STATUS, WDT_A370_EXPIRED, 0);
> +
> +	/* Enable watchdog timer */
> +	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit,
> +						dev->data->wdt_enable_bit);
> +
> +	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit,
> +				      dev->data->rstout_enable_bit);
> +	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit, 0);
> +	return 0;
> +}
> +
>   static int armada370_start(struct watchdog_device *wdt_dev)
>   {
>   	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -205,6 +228,21 @@ static int orion_stop(struct watchdog_device *wdt_dev)
>   	return 0;
>   }
>
> +static int armada375_stop(struct watchdog_device *wdt_dev)
> +{
> +	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> +
> +	/* Disable reset on watchdog */
> +	atomic_io_modify(dev->rstout_mask, dev->data->rstout_mask_bit,
> +					   dev->data->rstout_mask_bit);
> +	atomic_io_modify(dev->rstout, dev->data->rstout_enable_bit, 0);
> +
> +	/* Disable watchdog timer */
> +	atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0);
> +
> +	return 0;
> +}
> +
>   static int armada370_stop(struct watchdog_device *wdt_dev)
>   {
>   	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -235,6 +273,17 @@ static int orion_enabled(struct orion_watchdog *dev)
>   	return enabled && running;
>   }
>
> +static int armada375_enabled(struct orion_watchdog *dev)
> +{
> +	bool masked, enabled, running;
> +
> +	masked = readl(dev->rstout_mask) & dev->data->rstout_mask_bit;
> +	enabled = readl(dev->rstout) & dev->data->rstout_enable_bit;
> +	running = readl(dev->reg + TIMER_CTRL) & dev->data->wdt_enable_bit;
> +
> +	return !masked && enabled && running;
> +}
> +
>   static int orion_wdt_enabled(struct watchdog_device *wdt_dev)
>   {
>   	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -328,6 +377,28 @@ static const struct orion_watchdog_data armadaxp_data = {
>   	.stop = armada370_stop,
>   };
>
> +static const struct orion_watchdog_data armada375_data = {
> +	.rstout_enable_bit = BIT(8),
> +	.rstout_mask_bit = BIT(10),
> +	.wdt_enable_bit = BIT(8),
> +	.wdt_counter_offset = 0x34,
> +	.clock_init = armada370_wdt_clock_init,
> +	.enabled = armada375_enabled,
> +	.start = armada375_start,
> +	.stop = armada375_stop,
> +};
> +
> +static const struct orion_watchdog_data armada380_data = {
> +	.rstout_enable_bit = BIT(8),
> +	.rstout_mask_bit = BIT(10),
> +	.wdt_enable_bit = BIT(8),
> +	.wdt_counter_offset = 0x34,
> +	.clock_init = armadaxp_wdt_clock_init,
> +	.enabled = armada375_enabled,
> +	.start = armada375_start,
> +	.stop = armada375_stop,
> +};
> +
>   static const struct of_device_id orion_wdt_of_match_table[] = {
>   	{
>   		.compatible = "marvell,orion-wdt",
> @@ -341,6 +412,14 @@ static const struct of_device_id orion_wdt_of_match_table[] = {
>   		.compatible = "marvell,armada-xp-wdt",
>   		.data = &armadaxp_data,
>   	},
> +	{
> +		.compatible = "marvell,armada-375-wdt",
> +		.data = &armada375_data,
> +	},
> +	{
> +		.compatible = "marvell,armada-380-wdt",
> +		.data = &armada380_data,
> +	},
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> @@ -396,6 +475,25 @@ static int orion_wdt_probe(struct platform_device *pdev)
>   		if (!dev->rstout)
>   			return -ENOMEM;
>
> +	} else if (of_device_is_compatible(node, "marvell,armada-375-wdt") ||
> +		   of_device_is_compatible(node, "marvell,armada-380-wdt")) {
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);

Looks like each supported watchdog needs this call. Might as well do it earlier
and just once, unless you have a good reason for doing it this way.
To me this just looks like a lot of code replication.

It might also possibly make sense to move all the memory initializations
into a separate function; the probe function gets a bit large.

> +		if (!res)
> +			return -ENODEV;
> +		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> +					   resource_size(res));
> +		if (!dev->rstout)
> +			return -ENOMEM;
> +
> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> +		if (!res)
> +			return -ENODEV;
> +		dev->rstout_mask = devm_ioremap(&pdev->dev, res->start,
> +						resource_size(res));

devm_ioremap_resource() is better here.

Guenter

> +		if (!dev->rstout_mask)
> +			return -ENOMEM;
> +
>   	} else {
>   		return -ENODEV;
>   	}
>


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

* Re: [PATCH v2 2/7] watchdog: orion: Introduce per-SoC stop() function
  2014-03-04 16:07     ` Ezequiel Garcia
@ 2014-03-10  2:30         ` Guenter Roeck
  -1 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:30 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> In order to support other SoCs, it's needed to have a different stop()
> implementation for each SoC. This commit adds no functionality, and it
> consists of preparation work.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 2/7] watchdog: orion: Introduce per-SoC stop() function
@ 2014-03-10  2:30         ` Guenter Roeck
  0 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:30 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> In order to support other SoCs, it's needed to have a different stop()
> implementation for each SoC. This commit adds no functionality, and it
> consists of preparation work.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>



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

* Re: [PATCH v2 3/7] watchdog: orion: Introduce per-SoC enabled() function
  2014-03-04 16:07     ` Ezequiel Garcia
@ 2014-03-10  2:30         ` Guenter Roeck
  -1 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:30 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> In order to support other SoCs, it's needed to have a different enabled()
> implementation for each SoC. This commit adds no functionality, and it
> consists of preparation work.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 3/7] watchdog: orion: Introduce per-SoC enabled() function
@ 2014-03-10  2:30         ` Guenter Roeck
  0 siblings, 0 replies; 38+ messages in thread
From: Guenter Roeck @ 2014-03-10  2:30 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-watchdog, devicetree
  Cc: Wim Van Sebroeck, Jason Gunthorpe, Andrew Lunn,
	Sebastian Hesselbarth, Gregory Clement, Thomas Petazzoni,
	Lior Amsalem, Tawfik Bayouk

On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
> In order to support other SoCs, it's needed to have a different enabled()
> implementation for each SoC. This commit adds no functionality, and it
> consists of preparation work.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>


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

* Re: [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
  2014-03-10  2:09         ` Guenter Roeck
@ 2014-03-11 20:06             ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-11 20:06 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Wim Van Sebroeck,
	Jason Gunthorpe, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

Hi Guenter,

Thanks for reviewing this patchset.

On Mar 09, Guenter Roeck wrote:
[..]
> >@@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> >  static int orion_wdt_probe(struct platform_device *pdev)
> >  {
> >  	struct orion_watchdog *dev;
> >+	struct device_node *node = pdev->dev.of_node;
> >  	const struct of_device_id *match;
> >  	unsigned int wdt_max_duration;	/* (seconds) */
> >  	struct resource *res;
> >@@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
> >  	if (!dev->reg)
> >  		return -ENOMEM;
> >
> >-	dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> >-						     INTERNAL_REGS_MASK);
> >-	if (!dev->rstout)
> >+	if (of_device_is_compatible(node, "marvell,orion-wdt")) {
> >+
> >+		dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> >+						       INTERNAL_REGS_MASK);
> >+		if (!dev->rstout)
> >+			return -ENODEV;
> >+
> >+	} else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
> >+		   of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
> >+
> >+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> >+		if (!res)
> >+			return -ENODEV;
> >+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> >+					   resource_size(res));
> 
> Better use devm_ioremap_resource, and then you don't have to check for
> the error from platform_get_resource() since devm_ioremap_resource()
> takes care of it.
> 
> The same change should be made for the other calls call to devm_ioremap;
> different patch though.
> 

Hm... well, could be. However it's not that simple! devm_ioremap_resource()
calls request_region() and since the RSTOUT register is shared, we can't
request it for this driver. This applies on orion-wdt only, though,
and not on armada-{370,xp}-wdt, so we can do it as long as we keep two
different paths.

> On a side note, the resource is always assigned, only a workaround exists
> for "marvell,orion-wdt" if it isn't. Wonder if it would make sense
> to move the calls to platform_get_resource and devm_ioremap[_resource]
> further up and have it just in this function.
> 

Aside from the above discussion about requesting the resource, I think it's
more readable this way, hiding the complexity of the firmware bug fallback
on a function, and use different paths.

> >+		if (!dev->rstout)
> >+			return -ENOMEM;
> >+
> >+	} else {
> >  		return -ENODEV;
> 
> Is this stricter than the original code on purpose ?
> 
> Previously the driver would instantiate successfully in this case
> as long as IORESOURCE_MEM, 1 was defined.
> 

Uh? This patch is not changing that. We're just splitting the way we
ioremap the RSTOUT register, as preparation work to add another compatible
string. Unless I've done something wrong, this is not *stricter* in any
way.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping
@ 2014-03-11 20:06             ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-11 20:06 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-watchdog, devicetree, Wim Van Sebroeck, Jason Gunthorpe,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
	Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

Hi Guenter,

Thanks for reviewing this patchset.

On Mar 09, Guenter Roeck wrote:
[..]
> >@@ -317,6 +313,7 @@ MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> >  static int orion_wdt_probe(struct platform_device *pdev)
> >  {
> >  	struct orion_watchdog *dev;
> >+	struct device_node *node = pdev->dev.of_node;
> >  	const struct of_device_id *match;
> >  	unsigned int wdt_max_duration;	/* (seconds) */
> >  	struct resource *res;
> >@@ -346,10 +343,27 @@ static int orion_wdt_probe(struct platform_device *pdev)
> >  	if (!dev->reg)
> >  		return -ENOMEM;
> >
> >-	dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> >-						     INTERNAL_REGS_MASK);
> >-	if (!dev->rstout)
> >+	if (of_device_is_compatible(node, "marvell,orion-wdt")) {
> >+
> >+		dev->rstout = orion_wdt_ioremap_rstout(pdev, res->start &
> >+						       INTERNAL_REGS_MASK);
> >+		if (!dev->rstout)
> >+			return -ENODEV;
> >+
> >+	} else if (of_device_is_compatible(node, "marvell,armada-370-wdt") ||
> >+		   of_device_is_compatible(node, "marvell,armada-xp-wdt")) {
> >+
> >+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> >+		if (!res)
> >+			return -ENODEV;
> >+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> >+					   resource_size(res));
> 
> Better use devm_ioremap_resource, and then you don't have to check for
> the error from platform_get_resource() since devm_ioremap_resource()
> takes care of it.
> 
> The same change should be made for the other calls call to devm_ioremap;
> different patch though.
> 

Hm... well, could be. However it's not that simple! devm_ioremap_resource()
calls request_region() and since the RSTOUT register is shared, we can't
request it for this driver. This applies on orion-wdt only, though,
and not on armada-{370,xp}-wdt, so we can do it as long as we keep two
different paths.

> On a side note, the resource is always assigned, only a workaround exists
> for "marvell,orion-wdt" if it isn't. Wonder if it would make sense
> to move the calls to platform_get_resource and devm_ioremap[_resource]
> further up and have it just in this function.
> 

Aside from the above discussion about requesting the resource, I think it's
more readable this way, hiding the complexity of the firmware bug fallback
on a function, and use different paths.

> >+		if (!dev->rstout)
> >+			return -ENOMEM;
> >+
> >+	} else {
> >  		return -ENODEV;
> 
> Is this stricter than the original code on purpose ?
> 
> Previously the driver would instantiate successfully in this case
> as long as IORESOURCE_MEM, 1 was defined.
> 

Uh? This patch is not changing that. We're just splitting the way we
ioremap the RSTOUT register, as preparation work to add another compatible
string. Unless I've done something wrong, this is not *stricter* in any
way.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support
  2014-03-10  2:12         ` Guenter Roeck
@ 2014-03-11 20:16             ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-11 20:16 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Wim Van Sebroeck,
	Jason Gunthorpe, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

On Mar 09, Guenter Roeck wrote:
> On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
[..]
> >  MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> >@@ -396,6 +475,25 @@ static int orion_wdt_probe(struct platform_device *pdev)
> >  		if (!dev->rstout)
> >  			return -ENOMEM;
> >
> >+	} else if (of_device_is_compatible(node, "marvell,armada-375-wdt") ||
> >+		   of_device_is_compatible(node, "marvell,armada-380-wdt")) {
> >+
> >+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> 
> Looks like each supported watchdog needs this call. Might as well do it earlier
> and just once, unless you have a good reason for doing it this way.
> To me this just looks like a lot of code replication.
> 

Well... it seemed to me as cleaner to have one 'if' block per compatible
group and do all the ioremap'ing in it.

Otherwise, it would be like this (seudo-code):

rstout = foo_request_ioremap();
if (!rsout)
	if (compatible(1)) {
		/* Missing RSTOUT! Do backwards compatibility hack */
		rstout = fw_bug_fallback();
		if (!rstout)
			return -ENODEV;
	} else
		return -ENODEV;

if (compatible(3))
	rstout_mask = foo_request_ioremap();
	if (!rstout_mask)
		return -ENODEV;

Maybe it's a matter of taste, but I think this looks better:

if (compatible(1))
	request_ioremap all registers ...
else if (compatible(2))
	request_ioremap all registers ...
else if (compatible(3))
	request_ioremap all registers ...
else
	return -ENODEV;

At the price of a little code duplication.

> It might also possibly make sense to move all the memory initializations
> into a separate function; the probe function gets a bit large.
> 
> >+		if (!res)
> >+			return -ENODEV;
> >+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> >+					   resource_size(res));
> >+		if (!dev->rstout)
> >+			return -ENOMEM;
> >+
> >+		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> >+		if (!res)
> >+			return -ENODEV;
> >+		dev->rstout_mask = devm_ioremap(&pdev->dev, res->start,
> >+						resource_size(res));
> 
> devm_ioremap_resource() is better here.
> 

True. We are currently confusing the shared and non-shared registers,
and treating them all as shared. I'll fix that.

Thanks for the review,
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support
@ 2014-03-11 20:16             ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-11 20:16 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: linux-watchdog, devicetree, Wim Van Sebroeck, Jason Gunthorpe,
	Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
	Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk

On Mar 09, Guenter Roeck wrote:
> On 03/04/2014 08:07 AM, Ezequiel Garcia wrote:
[..]
> >  MODULE_DEVICE_TABLE(of, orion_wdt_of_match_table);
> >@@ -396,6 +475,25 @@ static int orion_wdt_probe(struct platform_device *pdev)
> >  		if (!dev->rstout)
> >  			return -ENOMEM;
> >
> >+	} else if (of_device_is_compatible(node, "marvell,armada-375-wdt") ||
> >+		   of_device_is_compatible(node, "marvell,armada-380-wdt")) {
> >+
> >+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> 
> Looks like each supported watchdog needs this call. Might as well do it earlier
> and just once, unless you have a good reason for doing it this way.
> To me this just looks like a lot of code replication.
> 

Well... it seemed to me as cleaner to have one 'if' block per compatible
group and do all the ioremap'ing in it.

Otherwise, it would be like this (seudo-code):

rstout = foo_request_ioremap();
if (!rsout)
	if (compatible(1)) {
		/* Missing RSTOUT! Do backwards compatibility hack */
		rstout = fw_bug_fallback();
		if (!rstout)
			return -ENODEV;
	} else
		return -ENODEV;

if (compatible(3))
	rstout_mask = foo_request_ioremap();
	if (!rstout_mask)
		return -ENODEV;

Maybe it's a matter of taste, but I think this looks better:

if (compatible(1))
	request_ioremap all registers ...
else if (compatible(2))
	request_ioremap all registers ...
else if (compatible(3))
	request_ioremap all registers ...
else
	return -ENODEV;

At the price of a little code duplication.

> It might also possibly make sense to move all the memory initializations
> into a separate function; the probe function gets a bit large.
> 
> >+		if (!res)
> >+			return -ENODEV;
> >+		dev->rstout = devm_ioremap(&pdev->dev, res->start,
> >+					   resource_size(res));
> >+		if (!dev->rstout)
> >+			return -ENOMEM;
> >+
> >+		res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> >+		if (!res)
> >+			return -ENODEV;
> >+		dev->rstout_mask = devm_ioremap(&pdev->dev, res->start,
> >+						resource_size(res));
> 
> devm_ioremap_resource() is better here.
> 

True. We are currently confusing the shared and non-shared registers,
and treating them all as shared. I'll fix that.

Thanks for the review,
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
  2014-03-07  0:13     ` Ezequiel Garcia
@ 2014-03-11 21:45         ` Jason Gunthorpe
  -1 siblings, 0 replies; 38+ messages in thread
From: Jason Gunthorpe @ 2014-03-11 21:45 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Wim Van Sebroeck, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Thu, Mar 06, 2014 at 09:13:46PM -0300, Ezequiel Garcia wrote:

> > On the driver side, we need to implement per-SoC stop() and enabled()
> > functions. Such somewhat complex infrastructure is needed to ensure the driver
> > performs proper reset of the watchdog timer, by masking and disabling the
> > RSTOUT before the interrupt is enabled.

> JasonG: How does this look now?

A cursory look seems reasonable..

> Any chance someone gives a Tested-by on Dove/Kirkwood?

If you have a git I can pull I can try it here.

Jason
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-11 21:45         ` Jason Gunthorpe
  0 siblings, 0 replies; 38+ messages in thread
From: Jason Gunthorpe @ 2014-03-11 21:45 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: Wim Van Sebroeck, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk,
	linux-watchdog, devicetree

On Thu, Mar 06, 2014 at 09:13:46PM -0300, Ezequiel Garcia wrote:

> > On the driver side, we need to implement per-SoC stop() and enabled()
> > functions. Such somewhat complex infrastructure is needed to ensure the driver
> > performs proper reset of the watchdog timer, by masking and disabling the
> > RSTOUT before the interrupt is enabled.

> JasonG: How does this look now?

A cursory look seems reasonable..

> Any chance someone gives a Tested-by on Dove/Kirkwood?

If you have a git I can pull I can try it here.

Jason

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
  2014-03-11 21:45         ` Jason Gunthorpe
@ 2014-03-12 21:12             ` Ezequiel Garcia
  -1 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-12 21:12 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Wim Van Sebroeck, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Mar 11, Jason Gunthorpe wrote:
> On Thu, Mar 06, 2014 at 09:13:46PM -0300, Ezequiel Garcia wrote:
> 
> > > On the driver side, we need to implement per-SoC stop() and enabled()
> > > functions. Such somewhat complex infrastructure is needed to ensure the driver
> > > performs proper reset of the watchdog timer, by masking and disabling the
> > > RSTOUT before the interrupt is enabled.
> 
> > JasonG: How does this look now?
> 
> A cursory look seems reasonable..
> 

Good.

> > Any chance someone gives a Tested-by on Dove/Kirkwood?
> 
> If you have a git I can pull I can try it here.
> 

I've just posted a v3 for this series together with a branch:

https://github.com/MISL-EBU-System-SW/mainline-public/tree/wdt_a385_a375_v3

Thanks!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC
@ 2014-03-12 21:12             ` Ezequiel Garcia
  0 siblings, 0 replies; 38+ messages in thread
From: Ezequiel Garcia @ 2014-03-12 21:12 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Wim Van Sebroeck, Andrew Lunn, Sebastian Hesselbarth,
	Gregory Clement, Thomas Petazzoni, Lior Amsalem, Tawfik Bayouk,
	linux-watchdog, devicetree

On Mar 11, Jason Gunthorpe wrote:
> On Thu, Mar 06, 2014 at 09:13:46PM -0300, Ezequiel Garcia wrote:
> 
> > > On the driver side, we need to implement per-SoC stop() and enabled()
> > > functions. Such somewhat complex infrastructure is needed to ensure the driver
> > > performs proper reset of the watchdog timer, by masking and disabling the
> > > RSTOUT before the interrupt is enabled.
> 
> > JasonG: How does this look now?
> 
> A cursory look seems reasonable..
> 

Good.

> > Any chance someone gives a Tested-by on Dove/Kirkwood?
> 
> If you have a git I can pull I can try it here.
> 

I've just posted a v3 for this series together with a branch:

https://github.com/MISL-EBU-System-SW/mainline-public/tree/wdt_a385_a375_v3

Thanks!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2014-03-12 21:13 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-04 16:07 [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC Ezequiel Garcia
2014-03-04 16:07 ` Ezequiel Garcia
     [not found] ` <1393949244-5011-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-04 16:07   ` [PATCH v2 1/7] watchdog: orion: Introduce a SoC-specific RSTOUT mapping Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
     [not found]     ` <1393949244-5011-2-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10  2:09       ` Guenter Roeck
2014-03-10  2:09         ` Guenter Roeck
     [not found]         ` <531D1EC7.4090701-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-03-11 20:06           ` Ezequiel Garcia
2014-03-11 20:06             ` Ezequiel Garcia
2014-03-04 16:07   ` [PATCH v2 2/7] watchdog: orion: Introduce per-SoC stop() function Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
     [not found]     ` <1393949244-5011-3-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10  2:30       ` Guenter Roeck
2014-03-10  2:30         ` Guenter Roeck
2014-03-04 16:07   ` [PATCH v2 3/7] watchdog: orion: Introduce per-SoC enabled() function Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
     [not found]     ` <1393949244-5011-4-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10  2:30       ` Guenter Roeck
2014-03-10  2:30         ` Guenter Roeck
2014-03-04 16:07   ` [PATCH v2 4/7] watchdog: orion: Add Armada 375/380 SoC support Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
     [not found]     ` <1393949244-5011-5-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-03-10  2:12       ` Guenter Roeck
2014-03-10  2:12         ` Guenter Roeck
     [not found]         ` <531D1F9B.8090804-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-03-11 20:16           ` Ezequiel Garcia
2014-03-11 20:16             ` Ezequiel Garcia
2014-03-04 16:07   ` [PATCH v2 5/7] ARM: mvebu: Enable Armada 375 watchdog in the devicetree Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
2014-03-04 16:07   ` [PATCH v2 6/7] ARM: mvebu: Enable Armada 380/385 " Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
2014-03-04 16:07   ` [PATCH v2 7/7] ARM: mvebu: Add A375/A380 watchdog binding documentation Ezequiel Garcia
2014-03-04 16:07     ` Ezequiel Garcia
2014-03-04 17:53   ` [PATCH v2 0/7] Watchdog support for Armada 375/38x SoC Jason Cooper
2014-03-04 17:53     ` Jason Cooper
     [not found]     ` <20140304175341.GO1872-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2014-03-04 20:03       ` Ezequiel Garcia
2014-03-04 20:03         ` Ezequiel Garcia
2014-03-07  0:13   ` Ezequiel Garcia
2014-03-07  0:13     ` Ezequiel Garcia
     [not found]     ` <20140307001346.GB13690-nAQHv47ARr+vIlHkl8J1cg@public.gmane.org>
2014-03-11 21:45       ` Jason Gunthorpe
2014-03-11 21:45         ` Jason Gunthorpe
     [not found]         ` <20140311214525.GA3564-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-03-12 21:12           ` Ezequiel Garcia
2014-03-12 21:12             ` Ezequiel Garcia

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.