* [PATCH] powerpc/4xx: Add optional "reset_type" property to control reboot via dts
@ 2010-04-26 13:39 Stefan Roese
2010-04-26 18:28 ` Josh Boyer
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Roese @ 2010-04-26 13:39 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>
---
arch/powerpc/sysdev/ppc4xx_soc.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/sysdev/ppc4xx_soc.c
index 5c01435..fe54216 100644
--- a/arch/powerpc/sysdev/ppc4xx_soc.c
+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
@@ -191,11 +191,24 @@ 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);
+ if (prop)
+ 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] 3+ messages in thread
* Re: [PATCH] powerpc/4xx: Add optional "reset_type" property to control reboot via dts
2010-04-26 13:39 [PATCH] powerpc/4xx: Add optional "reset_type" property to control reboot via dts Stefan Roese
@ 2010-04-26 18:28 ` Josh Boyer
2010-04-27 13:58 ` Stefan Roese
0 siblings, 1 reply; 3+ messages in thread
From: Josh Boyer @ 2010-04-26 18:28 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev
On Mon, Apr 26, 2010 at 03:39:01PM +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":
NEAT! A 4xx patch! I haven't gotten enough of these lately, so forgive my
nit picking ;)
>
> 1 - PPC4xx core reset
> 2 - PPC4xx chip reset
> 3 - PPC4xx system reset (default)
We should probably put a brief description of this in the dts bindings under
Documentation (or whereever we're storing them these days. I saw something
about a wiki?).
Also, while it's not a large issue, I wonder if there will be confusion on
whether 'reset-type' is "the type of reset to use" or "the type of reset that
was just done". There are some products that actually care about the latter for
various RAS issues. I don't, however, have a great alternative property name
that comes to mind though.
>This will be used by a new PPC440SPe board port, which needs a "chip
>reset" instead of the default "system reset" to be asserted.
I'm curious why that is?
>Signed-off-by: Stefan Roese <sr@denx.de>
>Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
>Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>---
> arch/powerpc/sysdev/ppc4xx_soc.c | 17 +++++++++++++++--
> 1 files changed, 15 insertions(+), 2 deletions(-)
>
>diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/sysdev/ppc4xx_soc.c
>index 5c01435..fe54216 100644
>--- a/arch/powerpc/sysdev/ppc4xx_soc.c
>+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
>@@ -191,11 +191,24 @@ 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);
>+ if (prop)
>+ reset_type = prop[0] << 28;
>+ }
While I don't think it's a big issue, I wonder if we should sanity check the
resulting value here. I could see someone being dumb and doing:
reset-type = "system";
or something like that. If that is done, what would the resulting shift on it
turn into?
josh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/4xx: Add optional "reset_type" property to control reboot via dts
2010-04-26 18:28 ` Josh Boyer
@ 2010-04-27 13:58 ` Stefan Roese
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2010-04-27 13:58 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev
Hi Josh,
On Monday 26 April 2010 20:28:29 Josh Boyer wrote:
> On Mon, Apr 26, 2010 at 03:39:01PM +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":
> NEAT! A 4xx patch! I haven't gotten enough of these lately, so forgive my
> nit picking ;)
Sure. Comments welcome, as always.
> > 1 - PPC4xx core reset
> > 2 - PPC4xx chip reset
> > 3 - PPC4xx system reset (default)
>
> We should probably put a brief description of this in the dts bindings
> under Documentation (or whereever we're storing them these days. I saw
> something about a wiki?).
Right. I thought about this as well (too late). I'll include a short
documentation in my next patch version.
> Also, while it's not a large issue, I wonder if there will be confusion on
> whether 'reset-type' is "the type of reset to use" or "the type of reset
> that was just done". There are some products that actually care about the
> latter for various RAS issues. I don't, however, have a great alternative
> property name that comes to mind though.
I'll stick with this name for now then.
> >This will be used by a new PPC440SPe board port, which needs a "chip
> >reset" instead of the default "system reset" to be asserted.
>
> I'm curious why that is?
Hmmm. Frankly, I can't remember the background here. You might what to check
this for yourself. Katmai has the same issue. And I just copied this reboot
code from Katmai for this new 440SPe board.
BTW: Once this patch is finished/accepted, I'll cook up a short katmai patch
to fix this reboot issue here too.
> >Signed-off-by: Stefan Roese <sr@denx.de>
> >Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
> >Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >---
> >
> > arch/powerpc/sysdev/ppc4xx_soc.c | 17 +++++++++++++++--
> > 1 files changed, 15 insertions(+), 2 deletions(-)
> >
> >diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c
> >b/arch/powerpc/sysdev/ppc4xx_soc.c index 5c01435..fe54216 100644
> >--- a/arch/powerpc/sysdev/ppc4xx_soc.c
> >+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
> >@@ -191,11 +191,24 @@ 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);
> >+ if (prop)
> >+ reset_type = prop[0] << 28;
> >+ }
>
> While I don't think it's a big issue, I wonder if we should sanity check
> the resulting value here. I could see someone being dumb and doing:
>
> reset-type = "system";
>
> or something like that. If that is done, what would the resulting shift on
> it turn into?
Good idea. I'll add a check in the next version.
Thanks.
Cheers,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-27 13:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-26 13:39 [PATCH] powerpc/4xx: Add optional "reset_type" property to control reboot via dts Stefan Roese
2010-04-26 18:28 ` Josh Boyer
2010-04-27 13:58 ` Stefan Roese
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.