* [PATCH v2] powerpc/4xx: Add optional "reset_type" property to control reboot via dts
@ 2010-04-28 8:13 Stefan Roese
2010-04-28 14:42 ` Josh Boyer
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Roese @ 2010-04-28 8:13 UTC (permalink / raw)
To: linuxppc-dev
By setting "reset_type" to one of the following values, the default
software reset mechanism may be overidden. Here the possible values of
"reset_type":
1 - PPC4xx core reset
2 - PPC4xx chip reset
3 - PPC4xx system reset (default)
This will be used by a new PPC440SPe board port, which needs a "chip
reset" instead of the default "system reset" to be asserted.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
v2:
- Add small property description to Documentation
- Add sanity check for property value
Documentation/powerpc/dts-bindings/4xx/reboot.txt | 18 +++++++++++++++
arch/powerpc/sysdev/ppc4xx_soc.c | 24 +++++++++++++++++++-
2 files changed, 40 insertions(+), 2 deletions(-)
create mode 100644 Documentation/powerpc/dts-bindings/4xx/reboot.txt
diff --git a/Documentation/powerpc/dts-bindings/4xx/reboot.txt b/Documentation/powerpc/dts-bindings/4xx/reboot.txt
new file mode 100644
index 0000000..d721726
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/4xx/reboot.txt
@@ -0,0 +1,18 @@
+Reboot property to control system reboot on PPC4xx systems:
+
+By setting "reset_type" to one of the following values, the default
+software reset mechanism may be overidden. Here the possible values of
+"reset_type":
+
+ 1 - PPC4xx core reset
+ 2 - PPC4xx chip reset
+ 3 - PPC4xx system reset (default)
+
+Example:
+
+ cpu@0 {
+ device_type = "cpu";
+ model = "PowerPC,440SPe";
+ ...
+ reset-type = <2>; /* Use chip-reset */
+ };
diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/sysdev/ppc4xx_soc.c
index 5c01435..d3d6ce3 100644
--- a/arch/powerpc/sysdev/ppc4xx_soc.c
+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
@@ -191,11 +191,31 @@ static int __init ppc4xx_l2c_probe(void)
arch_initcall(ppc4xx_l2c_probe);
/*
- * At present, this routine just applies a system reset.
+ * Apply a system reset. Alternatively a board specific value may be
+ * provided via the "reset-type" property in the cpu node.
*/
void ppc4xx_reset_system(char *cmd)
{
- mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_RST_SYSTEM);
+ struct device_node *np;
+ u32 reset_type = DBCR0_RST_SYSTEM;
+ const u32 *prop;
+
+ np = of_find_node_by_type(NULL, "cpu");
+ if (np) {
+ prop = of_get_property(np, "reset-type", NULL);
+
+ /*
+ * Check if property exists and if it is in range:
+ * 1 - PPC4xx core reset
+ * 2 - PPC4xx chip reset
+ * 3 - PPC4xx system reset (default)
+ */
+ if ((prop) && ((prop[0] >= 1) && (prop[0] <= 3)))
+ reset_type = prop[0] << 28;
+ }
+
+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | reset_type);
+
while (1)
; /* Just in case the reset doesn't work */
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] powerpc/4xx: Add optional "reset_type" property to control reboot via dts
2010-04-28 8:13 [PATCH v2] powerpc/4xx: Add optional "reset_type" property to control reboot via dts Stefan Roese
@ 2010-04-28 14:42 ` Josh Boyer
0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2010-04-28 14:42 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev
On Wed, Apr 28, 2010 at 10:13:34AM +0200, Stefan Roese wrote:
>By setting "reset_type" to one of the following values, the default
>software reset mechanism may be overidden. Here the possible values of
>"reset_type":
>
> 1 - PPC4xx core reset
> 2 - PPC4xx chip reset
> 3 - PPC4xx system reset (default)
>
>This will be used by a new PPC440SPe board port, which needs a "chip
>reset" instead of the default "system reset" to be asserted.
>
>Signed-off-by: Stefan Roese <sr@denx.de>
>Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
>Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>---
>v2:
>- Add small property description to Documentation
>- Add sanity check for property value
Thanks for the quick respin.
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Ben, I don't have anything else pending for -next at the moment. Can you pick
this up yourself, or do you want me to create a pull request for just this
patch?
josh
>
> Documentation/powerpc/dts-bindings/4xx/reboot.txt | 18 +++++++++++++++
> arch/powerpc/sysdev/ppc4xx_soc.c | 24 +++++++++++++++++++-
> 2 files changed, 40 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/powerpc/dts-bindings/4xx/reboot.txt
>
>diff --git a/Documentation/powerpc/dts-bindings/4xx/reboot.txt b/Documentation/powerpc/dts-bindings/4xx/reboot.txt
>new file mode 100644
>index 0000000..d721726
>--- /dev/null
>+++ b/Documentation/powerpc/dts-bindings/4xx/reboot.txt
>@@ -0,0 +1,18 @@
>+Reboot property to control system reboot on PPC4xx systems:
>+
>+By setting "reset_type" to one of the following values, the default
>+software reset mechanism may be overidden. Here the possible values of
>+"reset_type":
>+
>+ 1 - PPC4xx core reset
>+ 2 - PPC4xx chip reset
>+ 3 - PPC4xx system reset (default)
>+
>+Example:
>+
>+ cpu@0 {
>+ device_type = "cpu";
>+ model = "PowerPC,440SPe";
>+ ...
>+ reset-type = <2>; /* Use chip-reset */
>+ };
>diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/sysdev/ppc4xx_soc.c
>index 5c01435..d3d6ce3 100644
>--- a/arch/powerpc/sysdev/ppc4xx_soc.c
>+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
>@@ -191,11 +191,31 @@ static int __init ppc4xx_l2c_probe(void)
> arch_initcall(ppc4xx_l2c_probe);
>
> /*
>- * At present, this routine just applies a system reset.
>+ * Apply a system reset. Alternatively a board specific value may be
>+ * provided via the "reset-type" property in the cpu node.
> */
> void ppc4xx_reset_system(char *cmd)
> {
>- mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_RST_SYSTEM);
>+ struct device_node *np;
>+ u32 reset_type = DBCR0_RST_SYSTEM;
>+ const u32 *prop;
>+
>+ np = of_find_node_by_type(NULL, "cpu");
>+ if (np) {
>+ prop = of_get_property(np, "reset-type", NULL);
>+
>+ /*
>+ * Check if property exists and if it is in range:
>+ * 1 - PPC4xx core reset
>+ * 2 - PPC4xx chip reset
>+ * 3 - PPC4xx system reset (default)
>+ */
>+ if ((prop) && ((prop[0] >= 1) && (prop[0] <= 3)))
>+ reset_type = prop[0] << 28;
>+ }
>+
>+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | reset_type);
>+
> while (1)
> ; /* Just in case the reset doesn't work */
> }
>--
>1.7.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-28 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-28 8:13 [PATCH v2] powerpc/4xx: Add optional "reset_type" property to control reboot via dts Stefan Roese
2010-04-28 14:42 ` Josh Boyer
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).