linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] [POWERPC] MPC5200: update gpt binding, add restart support
@ 2007-10-17 12:56 Marian Balakowicz
  2007-10-17 12:58 ` [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions Marian Balakowicz
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Marian Balakowicz @ 2007-10-17 12:56 UTC (permalink / raw)
  To: linuxppc-dev


This is a reworked version of patches to MPC5200 common code that were send
together with the TQM5200/CM5200/Motion-PRO board support chnages.

As there are some open issues in a board support code and to avoid
additional respin I would like to have those reviewed first.

[PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions
[PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt
[PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms
[PATCH 4/4] [POWERPC] Enable restart support for lite5200 board

Cheers,
Marian Balakowicz

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

* [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions
  2007-10-17 12:56 [PATCH 0/4] [POWERPC] MPC5200: update gpt binding, add restart support Marian Balakowicz
@ 2007-10-17 12:58 ` Marian Balakowicz
  2007-10-17 15:02   ` Grant Likely
  2007-10-17 12:59 ` [PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt Marian Balakowicz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Marian Balakowicz @ 2007-10-17 12:58 UTC (permalink / raw)
  To: linuxppc-dev


Add helper routine mpc52xx_find_and_map_path(). Extract common code to
mpc52xx_map_node() and refactor mpc52xx_find_and_map().

Signed-off-by: Jan Wrobel <wrr@semihalf.com>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/52xx/mpc52xx_common.c |   21 +++++++++++++++++----
 include/asm-powerpc/mpc52xx.h                |    1 +
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 3bc201e..74b4b41 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -19,14 +19,12 @@ #include <asm/prom.h>
 #include <asm/mpc52xx.h>
 
 
-void __iomem *
-mpc52xx_find_and_map(const char *compatible)
+static void __iomem *
+mpc52xx_map_node(struct device_node *ofn)
 {
-	struct device_node *ofn;
 	const u32 *regaddr_p;
 	u64 regaddr64, size64;
 
-	ofn = of_find_compatible_node(NULL, NULL, compatible);
 	if (!ofn)
 		return NULL;
 
@@ -42,8 +40,23 @@ mpc52xx_find_and_map(const char *compati
 
 	return ioremap((u32)regaddr64, (u32)size64);
 }
+
+void __iomem *
+mpc52xx_find_and_map(const char *compatible)
+{
+	return mpc52xx_map_node(
+		of_find_compatible_node(NULL, NULL, compatible));
+}
+
 EXPORT_SYMBOL(mpc52xx_find_and_map);
 
+void __iomem *
+mpc52xx_find_and_map_path(const char *path)
+{
+	return mpc52xx_map_node(of_find_node_by_path(path));
+}
+
+EXPORT_SYMBOL(mpc52xx_find_and_map_path);
 
 /**
  * 	mpc52xx_find_ipb_freq - Find the IPB bus frequency for a device
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index 24751df..9cf05f9 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -242,6 +242,7 @@ #endif /* __ASSEMBLY__ */
 #ifndef __ASSEMBLY__
 
 extern void __iomem * mpc52xx_find_and_map(const char *);
+extern void __iomem * mpc52xx_find_and_map_path(const char *path);
 extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
 extern void mpc5200_setup_xlb_arbiter(void);
 extern void mpc52xx_declare_of_platform_devices(void);

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

* [PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt
  2007-10-17 12:56 [PATCH 0/4] [POWERPC] MPC5200: update gpt binding, add restart support Marian Balakowicz
  2007-10-17 12:58 ` [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions Marian Balakowicz
@ 2007-10-17 12:59 ` Marian Balakowicz
  2007-10-17 15:12   ` Grant Likely
  2007-10-17 13:01 ` [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms Marian Balakowicz
  2007-10-17 13:02 ` [PATCH 4/4] [POWERPC] Enable restart support for lite5200 board Marian Balakowicz
  3 siblings, 1 reply; 10+ messages in thread
From: Marian Balakowicz @ 2007-10-17 12:59 UTC (permalink / raw)
  To: linuxppc-dev


Add 'fsl,' prefix to 'compatible' property for gpt nodes.
Add 'fsl,' prefix to empty, GPT0 specific 'has-wdt' property.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 Documentation/powerpc/mpc52xx-device-tree-bindings.txt |    4 +-
 arch/powerpc/boot/dts/lite5200.dts                     |   26 +++++------------
 arch/powerpc/boot/dts/lite5200b.dts                    |   26 +++++------------
 drivers/char/watchdog/mpc5200_wdt.c                    |    4 +-
 4 files changed, 22 insertions(+), 38 deletions(-)

diff --git a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
index e59fcbb..fedf7ef 100644
--- a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
+++ b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
@@ -185,7 +185,7 @@ bestcomm@<addr>	dma-controller		mpc5200-
 Recommended soc5200 child nodes; populate as needed for your board
 name		device_type	compatible	  Description
 ----		-----------	----------	  -----------
-gpt@<addr>	gpt		mpc5200-gpt	  General purpose timers
+gpt@<addr>	gpt		fsl,mpc5200-gpt	  General purpose timers
 rtc@<addr>	rtc		mpc5200-rtc	  Real time clock
 mscan@<addr>	mscan		mpc5200-mscan	  CAN bus controller
 pci@<addr>	pci		mpc5200-pci	  PCI bridge
@@ -213,7 +213,7 @@ cell-index	int		When multiple devices ar
 5) General Purpose Timer nodes (child of soc5200 node)
 On the mpc5200 and 5200b, GPT0 has a watchdog timer function.  If the board
 design supports the internal wdt, then the device node for GPT0 should
-include the empty property 'has-wdt'.
+include the empty property 'fsl,has-wdt'.
 
 6) PSC nodes (child of soc5200 node)
 PSC nodes can define the optional 'port-number' property to force assignment
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
index bc45f5f..6731763 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -70,18 +70,16 @@
 		};
 
 		gpt@600 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <0>;
 			reg = <600 10>;
 			interrupts = <1 9 0>;
 			interrupt-parent = <&mpc5200_pic>;
-			has-wdt;
+			fsl,has-wdt;
 		};
 
 		gpt@610 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <1>;
 			reg = <610 10>;
 			interrupts = <1 a 0>;
@@ -89,8 +87,7 @@
 		};
 
 		gpt@620 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <2>;
 			reg = <620 10>;
 			interrupts = <1 b 0>;
@@ -98,8 +95,7 @@
 		};
 
 		gpt@630 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <3>;
 			reg = <630 10>;
 			interrupts = <1 c 0>;
@@ -107,8 +103,7 @@
 		};
 
 		gpt@640 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <4>;
 			reg = <640 10>;
 			interrupts = <1 d 0>;
@@ -116,8 +111,7 @@
 		};
 
 		gpt@650 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <5>;
 			reg = <650 10>;
 			interrupts = <1 e 0>;
@@ -125,8 +119,7 @@
 		};
 
 		gpt@660 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <6>;
 			reg = <660 10>;
 			interrupts = <1 f 0>;
@@ -134,8 +127,7 @@
 		};
 
 		gpt@670 {	// General Purpose Timer
-			compatible = "mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200-gpt";
 			cell-index = <7>;
 			reg = <670 10>;
 			interrupts = <1 10 0>;
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
index a6bb1d0..9d12f28 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -70,18 +70,16 @@
 		};
 
 		gpt@600 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <0>;
 			reg = <600 10>;
 			interrupts = <1 9 0>;
 			interrupt-parent = <&mpc5200_pic>;
-			has-wdt;
+			fsl,has-wdt;
 		};
 
 		gpt@610 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <1>;
 			reg = <610 10>;
 			interrupts = <1 a 0>;
@@ -89,8 +87,7 @@
 		};
 
 		gpt@620 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <2>;
 			reg = <620 10>;
 			interrupts = <1 b 0>;
@@ -98,8 +95,7 @@
 		};
 
 		gpt@630 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <3>;
 			reg = <630 10>;
 			interrupts = <1 c 0>;
@@ -107,8 +103,7 @@
 		};
 
 		gpt@640 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <4>;
 			reg = <640 10>;
 			interrupts = <1 d 0>;
@@ -116,8 +111,7 @@
 		};
 
 		gpt@650 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <5>;
 			reg = <650 10>;
 			interrupts = <1 e 0>;
@@ -125,8 +119,7 @@
 		};
 
 		gpt@660 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <6>;
 			reg = <660 10>;
 			interrupts = <1 f 0>;
@@ -134,8 +127,7 @@
 		};
 
 		gpt@670 {	// General Purpose Timer
-			compatible = "mpc5200b-gpt","mpc5200-gpt";
-			device_type = "gpt";
+			compatible = "fsl,mpc5200b-gpt","fsl,mpc5200-gpt";
 			cell-index = <7>;
 			reg = <670 10>;
 			interrupts = <1 10 0>;
diff --git a/drivers/char/watchdog/mpc5200_wdt.c b/drivers/char/watchdog/mpc5200_wdt.c
index 564143d..9aaba7a 100644
--- a/drivers/char/watchdog/mpc5200_wdt.c
+++ b/drivers/char/watchdog/mpc5200_wdt.c
@@ -174,7 +174,7 @@ static int mpc5200_wdt_probe(struct of_d
 	const void *has_wdt;
 	int size;
 
-	has_wdt = of_get_property(op->node, "has-wdt", NULL);
+	has_wdt = of_get_property(op->node, "fsl,has-wdt", NULL);
 	if (!has_wdt)
 		return -ENODEV;
 
@@ -253,7 +253,7 @@ static int mpc5200_wdt_shutdown(struct o
 }
 
 static struct of_device_id mpc5200_wdt_match[] = {
-	{ .compatible = "mpc5200-gpt", },
+	{ .compatible = "fsl,mpc5200-gpt", },
 	{},
 };
 static struct of_platform_driver mpc5200_wdt_driver = {

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

* [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms
  2007-10-17 12:56 [PATCH 0/4] [POWERPC] MPC5200: update gpt binding, add restart support Marian Balakowicz
  2007-10-17 12:58 ` [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions Marian Balakowicz
  2007-10-17 12:59 ` [PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt Marian Balakowicz
@ 2007-10-17 13:01 ` Marian Balakowicz
  2007-10-17 14:02   ` Stephen Rothwell
  2007-10-17 15:30   ` Grant Likely
  2007-10-17 13:02 ` [PATCH 4/4] [POWERPC] Enable restart support for lite5200 board Marian Balakowicz
  3 siblings, 2 replies; 10+ messages in thread
From: Marian Balakowicz @ 2007-10-17 13:01 UTC (permalink / raw)
  To: linuxppc-dev


Add common helper routines: mpc52xx_map_wdt() and mpc52xx_restart().

This patch relies on Sascha Hauer's patch published in:
http://patchwork.ozlabs.org/linuxppc/patch?id=8910.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

 arch/powerpc/platforms/52xx/mpc52xx_common.c |   45 +++++++++++++++++++++++++++
 include/asm-powerpc/mpc52xx.h                |    3 +
 2 files changed, 48 insertions(+)

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 74b4b41..553937b 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -18,6 +18,13 @@ #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/mpc52xx.h>
 
+/*
+ * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
+ * Permanent mapping is required because mpc52xx_restart() can be called
+ * from interrupt context while node mapping (which calls iorenmap())
+ * cannot be used at such point.
+ */
+static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
 
 static void __iomem *
 mpc52xx_map_node(struct device_node *ofn)
@@ -126,3 +133,41 @@ mpc52xx_declare_of_platform_devices(void
 			"Error while probing of_platform bus\n");
 }
 
+void __init
+mpc52xx_map_wdt(void)
+{
+        const void *has_wdt;
+	struct device_node *np;
+
+	/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
+	 * possibly from a interrupt context. */
+
+	for (np = NULL;
+	    (np = of_find_compatible_node(np, NULL, "fsl,mpc5200-gpt")) != NULL;
+	    ) {
+		/* wdt is only implement on gpt0, check has-wdt property. */
+		has_wdt = of_get_property(np, "fsl,has-wdt", NULL);
+		if (has_wdt) {
+			mpc52xx_wdt = mpc52xx_map_node(np);
+			break;
+		}
+	}
+}
+
+void
+mpc52xx_restart(char *cmd)
+{
+	local_irq_disable();
+
+	/* Turn on the watchdog and wait for it to expire.
+	 * It effectively does a reset. */
+	if (mpc52xx_wdt) {
+		out_be32(&mpc52xx_wdt->mode, 0x00000000);
+		out_be32(&mpc52xx_wdt->count, 0x000000ff);
+		out_be32(&mpc52xx_wdt->mode, 0x00009004);
+	} else
+		printk("mpc52xx_restart: Can't access wdt. "
+			"Restart impossible, system halted.\n");
+
+	while (1);
+}
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index 9cf05f9..39f619f 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -252,6 +252,9 @@ extern unsigned int mpc52xx_get_irq(void
 
 extern int __init mpc52xx_add_bridge(struct device_node *node);
 
+extern void __init mpc52xx_map_wdt(void);
+extern void mpc52xx_restart(char *cmd);
+
 #endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_PM

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

* [PATCH 4/4] [POWERPC] Enable restart support for lite5200 board
  2007-10-17 12:56 [PATCH 0/4] [POWERPC] MPC5200: update gpt binding, add restart support Marian Balakowicz
                   ` (2 preceding siblings ...)
  2007-10-17 13:01 ` [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms Marian Balakowicz
@ 2007-10-17 13:02 ` Marian Balakowicz
  2007-10-17 15:31   ` Grant Likely
  3 siblings, 1 reply; 10+ messages in thread
From: Marian Balakowicz @ 2007-10-17 13:02 UTC (permalink / raw)
  To: linuxppc-dev


Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 lite5200.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 0caa3d9..ce9e3ee 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -143,6 +143,9 @@ #endif
 	/* Some mpc5200 & mpc5200b related configuration */
 	mpc5200_setup_xlb_arbiter();
 
+	/* Map wdt for mpc52xx_restart() */
+	mpc52xx_map_wdt();
+
 #ifdef CONFIG_PM
 	mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
 	mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;
@@ -193,5 +196,6 @@ define_machine(lite5200) {
 	.init		= mpc52xx_declare_of_platform_devices,
 	.init_IRQ 	= mpc52xx_init_irq,
 	.get_irq 	= mpc52xx_get_irq,
+	.restart	= mpc52xx_restart,
 	.calibrate_decr	= generic_calibrate_decr,
 };

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

* Re: [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms
  2007-10-17 13:01 ` [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms Marian Balakowicz
@ 2007-10-17 14:02   ` Stephen Rothwell
  2007-10-17 15:30   ` Grant Likely
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2007-10-17 14:02 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

On Wed, 17 Oct 2007 15:01:28 +0200 Marian Balakowicz <m8@semihalf.com> wrote:
>
> +void __init
> +mpc52xx_map_wdt(void)
> +{
> +        const void *has_wdt;
   ^^^^^^^^
white space damage

> +	struct device_node *np;
> +
> +	/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
> +	 * possibly from a interrupt context. */
> +
> +	for (np = NULL;
> +	    (np = of_find_compatible_node(np, NULL, "fsl,mpc5200-gpt")) != NULL;
> +	    ) {

	for_each_compatible_node(np, NULL, "fsl,mpc5200-gpt") {

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions
  2007-10-17 12:58 ` [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions Marian Balakowicz
@ 2007-10-17 15:02   ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2007-10-17 15:02 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev

On 10/17/07, Marian Balakowicz <m8@semihalf.com> wrote:
>
> Add helper routine mpc52xx_find_and_map_path(). Extract common code to
> mpc52xx_map_node() and refactor mpc52xx_find_and_map().
>
> Signed-off-by: Jan Wrobel <wrr@semihalf.com>
> Reviewed-by: Grant Likely <grant.likely@secretlab.ca>

Yeah, this is probably okay.  Eventually these util functions should
be refactored to be usable by any platform.

Cheers,
g.



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt
  2007-10-17 12:59 ` [PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt Marian Balakowicz
@ 2007-10-17 15:12   ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2007-10-17 15:12 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev

On 10/17/07, Marian Balakowicz <m8@semihalf.com> wrote:
>
> Add 'fsl,' prefix to 'compatible' property for gpt nodes.
> Add 'fsl,' prefix to empty, GPT0 specific 'has-wdt' property.
>
> diff --git a/drivers/char/watchdog/mpc5200_wdt.c b/drivers/char/watchdog/mpc5200_wdt.c
> index 564143d..9aaba7a 100644
> --- a/drivers/char/watchdog/mpc5200_wdt.c
> +++ b/drivers/char/watchdog/mpc5200_wdt.c
> @@ -174,7 +174,7 @@ static int mpc5200_wdt_probe(struct of_d
>         const void *has_wdt;
>         int size;
>
> -       has_wdt = of_get_property(op->node, "has-wdt", NULL);
> +       has_wdt = of_get_property(op->node, "fsl,has-wdt", NULL);
>         if (!has_wdt)
>                 return -ENODEV;

Do this instead:

        has_wdt = of_get_property(op->node, "has-wdt", NULL);
+       if (!has_wdt)
+               has_wdt = of_get_property(op->node, "fsl,has-wdt", NULL);
        if (!has_wdt)
                return -ENODEV;

This will allow it to still work with older device trees.

>
> @@ -253,7 +253,7 @@ static int mpc5200_wdt_shutdown(struct o
>  }
>
>  static struct of_device_id mpc5200_wdt_match[] = {
> -       { .compatible = "mpc5200-gpt", },
> +       { .compatible = "fsl,mpc5200-gpt", },

Keep both the old and new in the match table for now for the same reason.

Otherwise, looks good.  Thanks.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms
  2007-10-17 13:01 ` [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms Marian Balakowicz
  2007-10-17 14:02   ` Stephen Rothwell
@ 2007-10-17 15:30   ` Grant Likely
  1 sibling, 0 replies; 10+ messages in thread
From: Grant Likely @ 2007-10-17 15:30 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev

On 10/17/07, Marian Balakowicz <m8@semihalf.com> wrote:
>
> Add common helper routines: mpc52xx_map_wdt() and mpc52xx_restart().
>
> This patch relies on Sascha Hauer's patch published in:
> http://patchwork.ozlabs.org/linuxppc/patch?id=8910.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>
>  arch/powerpc/platforms/52xx/mpc52xx_common.c |   45 +++++++++++++++++++++++++++
>  include/asm-powerpc/mpc52xx.h                |    3 +
>  2 files changed, 48 insertions(+)
>
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> index 74b4b41..553937b 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
> @@ -18,6 +18,13 @@ #include <asm/io.h>
>  #include <asm/prom.h>
>  #include <asm/mpc52xx.h>
>
> +/*
> + * This variable is mapped in mpc52xx_map_wdt() and used in mpc52xx_restart().
> + * Permanent mapping is required because mpc52xx_restart() can be called
> + * from interrupt context while node mapping (which calls iorenmap())
> + * cannot be used at such point.
> + */
> +static volatile struct mpc52xx_gpt *mpc52xx_wdt = NULL;
>
>  static void __iomem *
>  mpc52xx_map_node(struct device_node *ofn)
> @@ -126,3 +133,41 @@ mpc52xx_declare_of_platform_devices(void
>                         "Error while probing of_platform bus\n");
>  }
>
> +void __init
> +mpc52xx_map_wdt(void)
> +{
> +        const void *has_wdt;
> +       struct device_node *np;
> +
> +       /* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
> +        * possibly from a interrupt context. */
> +
> +       for (np = NULL;
> +           (np = of_find_compatible_node(np, NULL, "fsl,mpc5200-gpt")) != NULL;
> +           ) {
> +               /* wdt is only implement on gpt0, check has-wdt property. */
> +               has_wdt = of_get_property(np, "fsl,has-wdt", NULL);

Test for both "has-wdt" and "fsl,has-wdt" for now.

Otherwise, looks good.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

* Re: [PATCH 4/4] [POWERPC] Enable restart support for lite5200 board
  2007-10-17 13:02 ` [PATCH 4/4] [POWERPC] Enable restart support for lite5200 board Marian Balakowicz
@ 2007-10-17 15:31   ` Grant Likely
  0 siblings, 0 replies; 10+ messages in thread
From: Grant Likely @ 2007-10-17 15:31 UTC (permalink / raw)
  To: Marian Balakowicz; +Cc: linuxppc-dev

On 10/17/07, Marian Balakowicz <m8@semihalf.com> wrote:
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>

Looks good; I'll pick this one up when you respin the others.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

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

end of thread, other threads:[~2007-10-17 15:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-17 12:56 [PATCH 0/4] [POWERPC] MPC5200: update gpt binding, add restart support Marian Balakowicz
2007-10-17 12:58 ` [PATCH 1/4] [POWERPC] Add mpc52xx_find_and_map_path(), refactor utility functions Marian Balakowicz
2007-10-17 15:02   ` Grant Likely
2007-10-17 12:59 ` [PATCH 2/4] [POWERPC] Update device tree binding for mpc5200 gpt Marian Balakowicz
2007-10-17 15:12   ` Grant Likely
2007-10-17 13:01 ` [PATCH 3/4] [POWERPC] Add restart support for mpc52xx based platforms Marian Balakowicz
2007-10-17 14:02   ` Stephen Rothwell
2007-10-17 15:30   ` Grant Likely
2007-10-17 13:02 ` [PATCH 4/4] [POWERPC] Enable restart support for lite5200 board Marian Balakowicz
2007-10-17 15:31   ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).