linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sbc8560: Fix warm reboot with board specific reset function
@ 2009-08-13 23:06 Paul Gortmaker
  2009-08-14  4:38 ` Kumar Gala
  2009-08-14  4:39 ` Kumar Gala
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Gortmaker @ 2009-08-13 23:06 UTC (permalink / raw)
  To: linuxppc-dev

From: Liang Li <Liang.Li@windriver.com>

The existing fsl_rstcr_restart function fails to reset the sbc8560
board. This implements a board specific reset function that uses
the RCR(Reset Control Register) of the board's EPLD to do a reset.

Signed-off-by: Liang Li <Liang.Li@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/powerpc/platforms/85xx/sbc8560.c |   39 ++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index cc27807..86dcca2 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -267,6 +267,43 @@ arch_initcall(sbc8560_rtc_init);
 
 #endif	/* M48T59 */
 
+static __u8 __iomem *brstcr;
+
+static int __init sbc8560_bdrstcr_init(void)
+{
+	struct device_node *np;
+	struct resource res;
+
+	np = of_find_compatible_node(NULL, NULL, "wrs,sbc8560-brstcr");
+	if (np == NULL) {
+		printk(KERN_WARNING "sbc8560: No board specific RSTCR in DTB.\n");
+		return -ENODEV;
+	}
+
+	of_address_to_resource(np, 0, &res);
+
+	printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start);
+
+	brstcr = ioremap(res.start, res.end - res.start);
+	if(!brstcr)
+		printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
+
+	of_node_put(np);
+
+	return 0;
+}
+
+arch_initcall(sbc8560_bdrstcr_init);
+
+void sbc8560_rstcr_restart(char * cmd)
+{
+	local_irq_disable();
+	if(brstcr)
+		out_8(brstcr,in_8(brstcr) & 0x7f);
+
+	while(1);
+}
+
 define_machine(sbc8560) {
 	.name			= "SBC8560",
 	.probe			= sbc8560_probe,
@@ -274,7 +311,7 @@ define_machine(sbc8560) {
 	.init_IRQ		= sbc8560_pic_init,
 	.show_cpuinfo		= sbc8560_show_cpuinfo,
 	.get_irq		= mpic_get_irq,
-	.restart		= fsl_rstcr_restart,
+	.restart		= sbc8560_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
 };
-- 
1.6.3.3

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

* Re: [PATCH] sbc8560: Fix warm reboot with board specific reset function
  2009-08-13 23:06 [PATCH] sbc8560: Fix warm reboot with board specific reset function Paul Gortmaker
@ 2009-08-14  4:38 ` Kumar Gala
  2009-08-14 14:43   ` Paul Gortmaker
  2009-08-14  4:39 ` Kumar Gala
  1 sibling, 1 reply; 7+ messages in thread
From: Kumar Gala @ 2009-08-14  4:38 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linuxppc-dev


On Aug 13, 2009, at 6:06 PM, Paul Gortmaker wrote:

> From: Liang Li <Liang.Li@windriver.com>
>
> The existing fsl_rstcr_restart function fails to reset the sbc8560
> board. This implements a board specific reset function that uses
> the RCR(Reset Control Register) of the board's EPLD to do a reset.
>
> Signed-off-by: Liang Li <Liang.Li@windriver.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
> arch/powerpc/platforms/85xx/sbc8560.c |   39 ++++++++++++++++++++++++ 
> ++++++++-
> 1 files changed, 38 insertions(+), 1 deletions(-)

The reason it didn't was that feature doesnt exist on the mpc8560 :)

- k

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

* Re: [PATCH] sbc8560: Fix warm reboot with board specific reset function
  2009-08-13 23:06 [PATCH] sbc8560: Fix warm reboot with board specific reset function Paul Gortmaker
  2009-08-14  4:38 ` Kumar Gala
@ 2009-08-14  4:39 ` Kumar Gala
  2009-08-14 14:36   ` [PATCH v2] " Paul Gortmaker
  1 sibling, 1 reply; 7+ messages in thread
From: Kumar Gala @ 2009-08-14  4:39 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linuxppc-dev


On Aug 13, 2009, at 6:06 PM, Paul Gortmaker wrote:

> From: Liang Li <Liang.Li@windriver.com>
>
> The existing fsl_rstcr_restart function fails to reset the sbc8560
> board. This implements a board specific reset function that uses
> the RCR(Reset Control Register) of the board's EPLD to do a reset.
>
> Signed-off-by: Liang Li <Liang.Li@windriver.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
> arch/powerpc/platforms/85xx/sbc8560.c |   39 ++++++++++++++++++++++++ 
> ++++++++-
> 1 files changed, 38 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/ 
> platforms/85xx/sbc8560.c
> index cc27807..86dcca2 100644
> --- a/arch/powerpc/platforms/85xx/sbc8560.c
> +++ b/arch/powerpc/platforms/85xx/sbc8560.c
> @@ -267,6 +267,43 @@ arch_initcall(sbc8560_rtc_init);
>
> #endif	/* M48T59 */
>
> +static __u8 __iomem *brstcr;
> +
> +static int __init sbc8560_bdrstcr_init(void)
> +{
> +	struct device_node *np;
> +	struct resource res;
> +
> +	np = of_find_compatible_node(NULL, NULL, "wrs,sbc8560-brstcr");
> +	if (np == NULL) {
> +		printk(KERN_WARNING "sbc8560: No board specific RSTCR in DTB.\n");
> +		return -ENODEV;
> +	}
> +
> +	of_address_to_resource(np, 0, &res);
> +
> +	printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start);
> +
> +	brstcr = ioremap(res.start, res.end - res.start);
> +	if(!brstcr)
> +		printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
> +
> +	of_node_put(np);
> +
> +	return 0;
> +}
> +
> +arch_initcall(sbc8560_bdrstcr_init);
> +
> +void sbc8560_rstcr_restart(char * cmd)
> +{
> +	local_irq_disable();
> +	if(brstcr)
> +		out_8(brstcr,in_8(brstcr) & 0x7f);

how about using clrbits8()

> +
> +	while(1);
> +}
> +
> define_machine(sbc8560) {
> 	.name			= "SBC8560",
> 	.probe			= sbc8560_probe,
> @@ -274,7 +311,7 @@ define_machine(sbc8560) {
> 	.init_IRQ		= sbc8560_pic_init,
> 	.show_cpuinfo		= sbc8560_show_cpuinfo,
> 	.get_irq		= mpic_get_irq,
> -	.restart		= fsl_rstcr_restart,
> +	.restart		= sbc8560_rstcr_restart,
> 	.calibrate_decr		= generic_calibrate_decr,
> 	.progress		= udbg_progress,
> };
> -- 
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* [PATCH v2] sbc8560: Fix warm reboot with board specific reset function
  2009-08-14  4:39 ` Kumar Gala
@ 2009-08-14 14:36   ` Paul Gortmaker
  2009-08-14 20:21     ` Kumar Gala
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Gortmaker @ 2009-08-14 14:36 UTC (permalink / raw)
  To: Linuxppc-dev

From: Liang Li <Liang.Li@windriver.com>

The existing fsl_rstcr_restart function is not applicable to the
mpc8560. The Global Utilities Block on this earlier CPU doesn't have
the control/reset register at 0xe00b0.  This implements a board
specific reset function that uses the RCR(Reset Control Register) of
the sbc8560's EPLD to do a reset.

Signed-off-by: Liang Li <Liang.Li@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---

v2: update comment, change outb(x, inb(x)&0x7f) --> clrbits(x,0x80)

 arch/powerpc/platforms/85xx/sbc8560.c |   39 ++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index cc27807..a5ad1c7 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -267,6 +267,43 @@ arch_initcall(sbc8560_rtc_init);
 
 #endif	/* M48T59 */
 
+static __u8 __iomem *brstcr;
+
+static int __init sbc8560_bdrstcr_init(void)
+{
+	struct device_node *np;
+	struct resource res;
+
+	np = of_find_compatible_node(NULL, NULL, "wrs,sbc8560-brstcr");
+	if (np == NULL) {
+		printk(KERN_WARNING "sbc8560: No board specific RSTCR in DTB.\n");
+		return -ENODEV;
+	}
+
+	of_address_to_resource(np, 0, &res);
+
+	printk(KERN_INFO "sbc8560: Found BRSTCR at i/o 0x%x\n", res.start);
+
+	brstcr = ioremap(res.start, res.end - res.start);
+	if(!brstcr)
+		printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
+
+	of_node_put(np);
+
+	return 0;
+}
+
+arch_initcall(sbc8560_bdrstcr_init);
+
+void sbc8560_rstcr_restart(char * cmd)
+{
+	local_irq_disable();
+	if(brstcr)
+		clrbits8(brstcr, 0x80);
+
+	while(1);
+}
+
 define_machine(sbc8560) {
 	.name			= "SBC8560",
 	.probe			= sbc8560_probe,
@@ -274,7 +311,7 @@ define_machine(sbc8560) {
 	.init_IRQ		= sbc8560_pic_init,
 	.show_cpuinfo		= sbc8560_show_cpuinfo,
 	.get_irq		= mpic_get_irq,
-	.restart		= fsl_rstcr_restart,
+	.restart		= sbc8560_rstcr_restart,
 	.calibrate_decr		= generic_calibrate_decr,
 	.progress		= udbg_progress,
 };
-- 
1.6.3.3

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

* Re: [PATCH] sbc8560: Fix warm reboot with board specific reset function
  2009-08-14  4:38 ` Kumar Gala
@ 2009-08-14 14:43   ` Paul Gortmaker
  2009-08-14 14:53     ` Kumar Gala
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Gortmaker @ 2009-08-14 14:43 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

Kumar Gala wrote:
> 
> On Aug 13, 2009, at 6:06 PM, Paul Gortmaker wrote:
> 
>> From: Liang Li <Liang.Li@windriver.com>
>>
>> The existing fsl_rstcr_restart function fails to reset the sbc8560
>> board. This implements a board specific reset function that uses
>> the RCR(Reset Control Register) of the board's EPLD to do a reset.
>>
>> Signed-off-by: Liang Li <Liang.Li@windriver.com>
>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>> ---
>> arch/powerpc/platforms/85xx/sbc8560.c |   39 
>> ++++++++++++++++++++++++++++++++-
>> 1 files changed, 38 insertions(+), 1 deletions(-)
> 
> The reason it didn't was that feature doesnt exist on the mpc8560 :)

I could see how that might have an impact on the
functionality.... :-)

So, what should the guts block of the 8560 dts look
like? It currently has the standard:

------------
global-utilities@e0000 {
   compatible = "fsl,mpc8560-guts";
   reg = <0xe0000 0x1000>;
   fsl,has-rstcr;
};
------------

MPC8560 has a guts block, but saying "has-rstcr", as
you've pointed out, is a bit of a lie. If we remove that
tag, then we'll trip the:

 printk(KERN_INFO "rstcr compatible register does not exist!\n");

which isn't the end of the world, but at the moment it
reads more like an error message, vs. an informative one.

Paul.

> 
> - k

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

* Re: [PATCH] sbc8560: Fix warm reboot with board specific reset function
  2009-08-14 14:43   ` Paul Gortmaker
@ 2009-08-14 14:53     ` Kumar Gala
  0 siblings, 0 replies; 7+ messages in thread
From: Kumar Gala @ 2009-08-14 14:53 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linuxppc-dev


On Aug 14, 2009, at 9:43 AM, Paul Gortmaker wrote:

> Kumar Gala wrote:
>> On Aug 13, 2009, at 6:06 PM, Paul Gortmaker wrote:
>>> From: Liang Li <Liang.Li@windriver.com>
>>>
>>> The existing fsl_rstcr_restart function fails to reset the sbc8560
>>> board. This implements a board specific reset function that uses
>>> the RCR(Reset Control Register) of the board's EPLD to do a reset.
>>>
>>> Signed-off-by: Liang Li <Liang.Li@windriver.com>
>>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>>> ---
>>> arch/powerpc/platforms/85xx/sbc8560.c |   39 ++++++++++++++++++++++ 
>>> ++++++++++-
>>> 1 files changed, 38 insertions(+), 1 deletions(-)
>> The reason it didn't was that feature doesnt exist on the mpc8560 :)
>
> I could see how that might have an impact on the
> functionality.... :-)
>
> So, what should the guts block of the 8560 dts look
> like? It currently has the standard:
>
> ------------
> global-utilities@e0000 {
>  compatible = "fsl,mpc8560-guts";
>  reg = <0xe0000 0x1000>;
>  fsl,has-rstcr;
> };
> ------------
>
> MPC8560 has a guts block, but saying "has-rstcr", as
> you've pointed out, is a bit of a lie. If we remove that
> tag, then we'll trip the:
>
> printk(KERN_INFO "rstcr compatible register does not exist!\n");
>
> which isn't the end of the world, but at the moment it
> reads more like an error message, vs. an informative one.

we should probably remove 'fsl,has-rstcr' from the .dts since that's  
just wrong.  I've got no issue w/either removing the warning or  
changing its wording.

- k

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

* Re: [PATCH v2] sbc8560: Fix warm reboot with board specific reset function
  2009-08-14 14:36   ` [PATCH v2] " Paul Gortmaker
@ 2009-08-14 20:21     ` Kumar Gala
  0 siblings, 0 replies; 7+ messages in thread
From: Kumar Gala @ 2009-08-14 20:21 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: Linuxppc-dev


On Aug 14, 2009, at 9:36 AM, Paul Gortmaker wrote:

> From: Liang Li <Liang.Li@windriver.com>
>
> The existing fsl_rstcr_restart function is not applicable to the
> mpc8560. The Global Utilities Block on this earlier CPU doesn't have
> the control/reset register at 0xe00b0.  This implements a board
> specific reset function that uses the RCR(Reset Control Register) of
> the sbc8560's EPLD to do a reset.
>
> Signed-off-by: Liang Li <Liang.Li@windriver.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>
> v2: update comment, change outb(x, inb(x)&0x7f) --> clrbits(x,0x80)


applied to next

- k

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

end of thread, other threads:[~2009-08-14 20:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-13 23:06 [PATCH] sbc8560: Fix warm reboot with board specific reset function Paul Gortmaker
2009-08-14  4:38 ` Kumar Gala
2009-08-14 14:43   ` Paul Gortmaker
2009-08-14 14:53     ` Kumar Gala
2009-08-14  4:39 ` Kumar Gala
2009-08-14 14:36   ` [PATCH v2] " Paul Gortmaker
2009-08-14 20:21     ` Kumar Gala

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).