Skip to contentSkip to conversation

: Fix e500 v2 core reboot bug

PATCH Superseded Zang Roy-r61911 6 participants 29 messages May 29, 2007 – Jun 13, 2007

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 : Fix e500 v2 core reboot bug

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

---

 arch/powerpc/platforms/85xx/misc.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/misc.c +18 -0
index 3e62fcb..886a13f 100644
@@ -13,11 +13,29 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <asm/irq.h>
+#include <asm/io.h>
+#include <sysdev/fsl_soc.h>
+
+static __be32 __iomem *rstcr;
 
 extern void abort(void);
 
+static int __init mpc85xx_rstcr(void)
+{
+	/* map reset control register */
+	rstcr = ioremap(get_immrbase() + 0xE00B0, 0xff);
+	return 0;
+}
+
+arch_initcall(mpc85xx_rstcr);
+
 void mpc85xx_restart(char *cmd)
 {
 	local_irq_disable();
+	if (rstcr)
+		/* set reset control register */
+		out_be32(rstcr, 0x2);	/* HRESET_REQ */
+	else
+		printk (KERN_EMERG "Error: reset control register not mapped, spinning!\n");
 	abort();
 }
Signature · 1 line
1.5.1
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · On May 28, 2007, at 21:36, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

#2 lore raw
In reply to Zang Roy-r61911
Quoted 6 lines · On May 28, 2007, at 9:36 PM, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

what happens on an e500 based 85xx system?

I'm not terrible happy with blindly writing to rstcr.

- k

Quoted 46 lines

---

 arch/powerpc/platforms/85xx/misc.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/powerpc/platforms/85xx/misc.c +18 -0
index 3e62fcb..886a13f 100644
@@ -13,11 +13,29 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <asm/irq.h>
+#include <asm/io.h>
+#include <sysdev/fsl_soc.h>
+
+static __be32 __iomem *rstcr;
 
 extern void abort(void);
 
+static int __init mpc85xx_rstcr(void)
+{
+	/* map reset control register */
+	rstcr = ioremap(get_immrbase() + 0xE00B0, 0xff);
+	return 0;
+}
+
+arch_initcall(mpc85xx_rstcr);
+
 void mpc85xx_restart(char *cmd)
 {
 	local_irq_disable();
+	if (rstcr)
+		/* set reset control register */
+		out_be32(rstcr, 0x2);	/* HRESET_REQ */
+	else
+		printk (KERN_EMERG "Error: reset control register not mapped,  
 spinning!\n");
 	abort();

}

Signature · 1 line
1.5.1
#3 lore raw
Quoted 10 lines · Kumar Gala
Quoted 6 lines · On May 28, 2007, at 9:36 PM, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

what happens on an e500 based 85xx system?

Without this patch on MPC8548CDS board, after key in "reboot" command, the u-boot will hang at DDR init. See the following log without this patch:

--- log start ---
~ # uname -a
Linux mpc8548cds 2.6.22-rc2-g843b8c89-dirty #5 Tue May 29 16:37:21 CST 2007 ppc
unknown
~ # reboot
~ # Stopping the boa webserver:
Stopping the port mapper:
Stopping inetd:
Syncing hardware clock to system time
hwclock: Could not set the RTC time: Invalid argument Unmounting filesystems
umount: Cannot open /proc/mounts
The system is going down NOW !!
Sending SIGTERM to all processes.
Please stand by while rebooting the system.
Restarting system.

U-Boot 1.1.6-gcd32691c-dirty (Apr 2 2007 - 17:42:01)

CPU:   8548_E, Version: 2.0, (0x80390020)
Core:  E500, Version: 2.0, (0x80210020)
Clock Configuration:
       CPU: 990 MHz, CCB: 396 MHz,
       DDR: 198 MHz, LBC:  49 MHz

L1: D-cache 32 kB enabled
I-cache 32 kB enabled
Board: CDS Version 0x13, PCI Slot 1
CPU Board Revision 114.121 (0x7279)

    PCI1: 32 bit, 33 MHz, async
    PCI2: disabled
I2C:   ready
DRAM:  Initializing

SDRAM: 64 MB
DDR: 256 MB

--- log end --

This patch has been tested on 8548/55 CDS board and 8540/60 ADS board.

Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?
Roy

#4 lore raw
Quoted 10 lines · On May 29, 2007, at 9:34 PM, Zang Roy-r61911 wrote:
Quoted 9 lines · Kumar Gala
Quoted 6 lines · On May 28, 2007, at 9:36 PM, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

Quoted 5 lines
Quoted 1 line

what happens on an e500 based 85xx system?

Without this patch on MPC8548CDS board, after key in "reboot" command, the u-boot will hang at DDR init. See the following log without this patch:

Sorry I meant what happens on a e500 v1 based 85xx system w/this patch.

- k

Quoted 40 lines

--- log start ---
~ # uname -a
Linux mpc8548cds 2.6.22-rc2-g843b8c89-dirty #5 Tue May 29 16:37:21 CST 2007 ppc
unknown
~ # reboot
~ # Stopping the boa webserver:
Stopping the port mapper:
Stopping inetd:
Syncing hardware clock to system time
hwclock: Could not set the RTC time: Invalid argument Unmounting filesystems
umount: Cannot open /proc/mounts
The system is going down NOW !!
Sending SIGTERM to all processes.
Please stand by while rebooting the system.
Restarting system.

U-Boot 1.1.6-gcd32691c-dirty (Apr 2 2007 - 17:42:01)

CPU:   8548_E, Version: 2.0, (0x80390020)
Core:  E500, Version: 2.0, (0x80210020)
Clock Configuration:
       CPU: 990 MHz, CCB: 396 MHz,
       DDR: 198 MHz, LBC:  49 MHz

L1: D-cache 32 kB enabled
I-cache 32 kB enabled
Board: CDS Version 0x13, PCI Slot 1
CPU Board Revision 114.121 (0x7279)

    PCI1: 32 bit, 33 MHz, async
    PCI2: disabled
I2C:   ready
DRAM:  Initializing

SDRAM: 64 MB
DDR: 256 MB

--- log end --

Quoted 7 lines

This patch has been tested on 8548/55 CDS board and 8540/60 ADS board.

Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

- k

#5 lore raw
Quoted 14 lines · Kumar Gala
Quoted 12 lines · On May 29, 2007, at 9:34 PM, Zang Roy-r61911 wrote:
Quoted 10 lines · Kumar Gala
Quoted 6 lines · On May 28, 2007, at 9:36 PM, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

what happens on an e500 based 85xx system?

Quoted 7 lines
Quoted 1 line

Without this patch on MPC8548CDS board, after key in "reboot"

command,

Quoted 2 lines

the u-boot will hang at DDR init. See the following log without this patch:

Sorry I meant what happens on a e500 v1 based 85xx system w/this patch.

E500 V1 core can boot up normally with/without this patch. Such as 8555CDS system.

Quoted 47 lines

- k

Quoted 4 lines

--- log start ---
~ # uname -a
Linux mpc8548cds 2.6.22-rc2-g843b8c89-dirty #5 Tue May 29 16:37:21

CST

Quoted 31 lines

2007 ppc
unknown
~ # reboot
~ # Stopping the boa webserver:
Stopping the port mapper:
Stopping inetd:
Syncing hardware clock to system time
hwclock: Could not set the RTC time: Invalid argument Unmounting filesystems
umount: Cannot open /proc/mounts
The system is going down NOW !!
Sending SIGTERM to all processes.
Please stand by while rebooting the system. Restarting system.

U-Boot 1.1.6-gcd32691c-dirty (Apr 2 2007 - 17:42:01)

CPU:   8548_E, Version: 2.0, (0x80390020)
Core:  E500, Version: 2.0, (0x80210020)
Clock Configuration:
       CPU: 990 MHz, CCB: 396 MHz,
       DDR: 198 MHz, LBC:  49 MHz

L1: D-cache 32 kB enabled
I-cache 32 kB enabled
Board: CDS Version 0x13, PCI Slot 1 CPU Board Revision 114.121 (0x7279)

    PCI1: 32 bit, 33 MHz, async
    PCI2: disabled
I2C:   ready
DRAM:  Initializing
Quoted 6 lines

SDRAM: 64 MB
DDR: 256 MB

--- log end --

This patch has been tested on 8548/55 CDS board and 8540/60 ADS

board.

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

I have seen your suggestion before to add a property in device tree. But I still think the current implementation is simple. Anyway, I can try your suggestion.
Thanks.
Roy

#6 lore raw
Quoted 17 lines · On May 30, 2007, at 12:46 AM, Zang Roy-r61911 wrote:
Quoted 16 lines · Kumar Gala
Quoted 10 lines · On May 29, 2007, at 9:34 PM, Zang Roy-r61911 wrote:
Quoted 9 lines · Kumar Gala
Quoted 6 lines · On May 28, 2007, at 9:36 PM, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

Quoted 3 lines
Quoted 1 line

what happens on an e500 based 85xx system?

Without this patch on MPC8548CDS board, after key in "reboot"

command,

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

the u-boot will hang at DDR init. See the following log without this patch:

Sorry I meant what happens on a e500 v1 based 85xx system w/this patch.

E500 V1 core can boot up normally with/without this patch. Such as 8555CDS system.

Sure, but what happens when you reboot on e500v1 based part?

[snip]

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

I have seen your suggestion before to add a property in device tree. But I still think the current implementation is simple.

While it simple you are depending on the fact that a given implementation may or may not have something at the particular offset. Who knows if 8599 or some future part could put the 'cause my part to smoke and self-destruct' at the same offset in the future :)

Quoted 1 line

Anyway, I can try your suggestion.

I'm thinking have a guts block and putting a property in it makes the most sense.

- k

#7 lore raw
Quoted 16 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

I have seen your suggestion before to add a property in device tree. But I still think the current implementation is simple.

While it simple you are depending on the fact that a given implementation may or may not have something at the particular offset. Who knows if 8599 or some future part could put the 'cause my part to smoke and self-destruct' at the same offset in the future :)

Quoted 4 lines
Quoted 1 line

Anyway, I can try your suggestion.

I'm thinking have a guts block and putting a property in it makes the most sense.

After some discussion on IRC I think the following is the suggested node we should add in.

guts@e00000 {
	compatible = "fsl,mpc8548-guts";
	reg = <e00000 1000>;
	fsl,has-rstcr;
};

- k

#8 lore raw
Quoted 10 lines
Quoted 2 lines

I'm thinking have a guts block and putting a property in it makes the most sense.

After some discussion on IRC I think the following is the suggested node we should add in.

guts@e00000 {
	compatible = "fsl,mpc8548-guts";
	reg = <e00000 1000>;
	fsl,has-rstcr;
};

Except you shouldn't call it "guts".

Segher

#17 lore raw
In reply to Kumar Gala
Quoted 23 lines · Kumar Gala
Quoted 13 lines · On May 30, 2007, at 12:46 AM, Zang Roy-r61911 wrote:
Quoted 12 lines · Kumar Gala
Quoted 10 lines · On May 29, 2007, at 9:34 PM, Zang Roy-r61911 wrote:
Quoted 9 lines · Kumar Gala
Quoted 6 lines · On May 28, 2007, at 9:36 PM, Zang Roy-r61911 wrote:

Fix the e500 v2 core reset bug.
For e500 v2 core, a new reset control register is added to reset the core.
On 85xx CDS board with e500 v2 core, normal reboot code will induce DDR block in u-boot. This patch fixes this bug. It is also tested on legacy e500 v1 core.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

what happens on an e500 based 85xx system?

Without this patch on MPC8548CDS board, after key in "reboot"

command,

Quoted 1 line

the u-boot will hang at DDR init. See the following log without

this

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

patch:

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Sorry I meant what happens on a e500 v1 based 85xx system w/this patch.

E500 V1 core can boot up normally with/without this patch. Such as 8555CDS system.

Sure, but what happens when you reboot on e500v1 based part?

Sorry, Maybe I do not understand clearly.
The u-boot boot up correctly, when I reboot on a e500v1 based part. This patch do not affect the e500v1 core boot up. Current code is enough for e500v1 core. While for E500 v2 core, the u-boot will block without this patch as I posted before.

Is it clear?

Quoted 11 lines

[snip]

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

Quoted 8 lines
Quoted 2 lines

I have seen your suggestion before to add a property in device tree. But I still think the current implementation is simple.

While it simple you are depending on the fact that a given implementation may or may not have something at the particular offset. Who knows if 8599 or some future part could put the 'cause my part to smoke and self-destruct' at the same offset in the future :)

I do not know the future, but I think the 85xx processor should have a compatible register define. I do not think the future 85xx processor will use this offset for other usage. It will cause big confusion. If you study the road map of 85xx processor register define, you can see that next generation processors only use reserved offset for expanded usage.

Quoted 8 lines
Quoted 2 lines

Anyway, I can try your suggestion.

I'm thinking have a guts block and putting a property in it makes the most sense.

- k

#11 lore raw
In reply to Kumar Gala
Quoted 24 lines · Kumar Gala
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

I have seen your suggestion before to add a property in device

tree.

Quoted 11 lines
Quoted 1 line

But I still think the current implementation is simple.

While it simple you are depending on the fact that a given implementation may or may not have something at the particular offset. Who knows if 8599 or some future part could put the 'cause my part to smoke and self-destruct' at the same offset in the future :)

Quoted 1 line

Anyway, I can try your suggestion.

I'm thinking have a guts block and putting a property in it makes

the

Quoted 1 line

most sense.

Quoted 8 lines

After some discussion on IRC I think the following is the suggested node we should add in.

guts@e00000 {
        compatible = "fsl,mpc8548-guts";
        reg = <e00000 1000>;
        fsl,has-rstcr;
};

Great!
Roy

#9 lore raw
In reply to Segher Boessenkool
Quoted 7 lines · Segher Boessenkool
Quoted 1 line
Quoted 1 line

I'm thinking have a guts block and putting a property in it makes

the

Quoted 5 lines
Quoted 1 line

most sense.

After some discussion on IRC I think the following is the suggested node we should add in.

Quoted 7 lines
Quoted 5 lines
guts@e00000 {
      compatible = "fsl,mpc8548-guts";
      reg = <e00000 1000>;
      fsl,has-rstcr;
};

Except you shouldn't call it "guts".

guts has a confused meaning :-)

How about
gub: global utility block
or
guf: global utility feature
?
Any other idea?
Roy

#10 lore raw
In reply to Segher Boessenkool
Quoted 6 lines · Segher Boessenkool
Quoted 6 lines
Quoted 2 lines

I'm thinking have a guts block and putting a property in it makes the most sense.

After some discussion on IRC I think the following is the suggested node we should add in.

Quoted 7 lines
Quoted 5 lines
guts@e00000 {
	compatible = "fsl,mpc8548-guts";
	reg = <e00000 1000>;
	fsl,has-rstcr;
};

Except you shouldn't call it "guts".

You prefer "bowels" ? :-)

Ben.

#12 lore raw
In reply to Kumar Gala
Quoted 22 lines · Kumar Gala
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'm not terrible happy with blindly writing to rstcr.

I can understand you.
But I jut want to make things simple and workable. Any idea?

one idea would be for us to add a property on the soc node. Something like has-rstcr or something similar in a guts node?

I have seen your suggestion before to add a property in device

tree.

Quoted 11 lines
Quoted 1 line

But I still think the current implementation is simple.

While it simple you are depending on the fact that a given implementation may or may not have something at the particular offset. Who knows if 8599 or some future part could put the 'cause my part to smoke and self-destruct' at the same offset in the future :)

Quoted 1 line

Anyway, I can try your suggestion.

I'm thinking have a guts block and putting a property in it makes

the

Quoted 8 lines
Quoted 1 line

most sense.

After some discussion on IRC I think the following is the suggested node we should add in.

guts@e00000 {
        compatible = "fsl,mpc8548-guts";
        reg = <e00000 1000>;

one more zero!

Quoted 2 lines
        fsl,has-rstcr;
};
#13 lore raw
Quoted 7 lines
Quoted 6 lines

After some discussion on IRC I think the following is the suggested node we should add in.

guts@e00000 {
        compatible = "fsl,mpc8548-guts";
        reg = <e00000 1000>;

one more zero!

Yeah.

Quoted 2 lines
Quoted 2 lines
        fsl,has-rstcr;
};

If "guts" is some kind of official name (i.e., the block is called that in the user manual), it looks okay to me. Otherwise, please change; in fact, just change the name anyway (not the compatible), to "shared-soc-regs" or something like that; "name" should be descriptive (but terse).

Segher

#14 lore raw
Quoted 8 lines · Segher Boessenkool
Quoted 7 lines
Quoted 6 lines

After some discussion on IRC I think the following is the suggested node we should add in.

guts@e00000 {
        compatible = "fsl,mpc8548-guts";
        reg = <e00000 1000>;

one more zero!

Quoted 8 lines

Yeah.

Quoted 2 lines
Quoted 2 lines
        fsl,has-rstcr;
};

If "guts" is some kind of official name (i.e., the block is called that in the user manual), it looks okay to me.

No! It is not official name. It is provided by Kumar. It should be a abbr. standing for "Global Utilities" as far as my understand.

Quoted 3 lines

Otherwise, please change; in fact, just change the name anyway (not the compatible), to "shared-soc-regs" or something like that;

I can not agree with you. "shared-soc-regs" can not describe the property of this kind of register.
The official description for this set of registers:

"The global utilities block controls power management, I/O device enabling, power-on-reset (POR) configuration monitoring, general-purpose I/O signal configuration, alternate function selection for multiplexed signals, and clock control.

gub (Kumar's style?): global utilities block
or
global-uti-regs or global-uti (Segher's style?)
may be better.

Quoted 3 lines

"name"
should be descriptive (but terse).

Agree!
But we should reach a agreement!
Thanks.
Roy

#15 lore raw
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

guts@e00000 {

If "guts" is some kind of official name (i.e., the block is called that in the user manual), it looks okay to me.

No! It is not official name. It is provided by Kumar. It should be a abbr. standing for "Global Utilities" as far as my understand.

So the official name is "global utilities block"?

Quoted 12 lines
Quoted 3 lines

Otherwise, please change; in fact, just change the name anyway (not the compatible), to "shared-soc-regs" or something like that;

I can not agree with you. "shared-soc-regs" can not describe the property of this kind of register.
The official description for this set of registers:

"The global utilities block controls power management, I/O device enabling, power-on-reset (POR) configuration monitoring, general-purpose I/O signal configuration, alternate function selection for multiplexed signals, and clock control.

Quoted 4 lines

gub (Kumar's style?): global utilities block
or
global-uti-regs or global-uti (Segher's style?)
may be better.

"global-utilities" sounds fine to me, although the name doesn't actually say anything. Let's avoid abbr.s unless they are very widely known.

Quoted 5 lines
Quoted 3 lines

"name"
should be descriptive (but terse).

Agree!
But we should reach a agreement!

Nah, you guys just need to come up with a good name :-) I would just call it "control" perhaps ;-)

It doesn't matter much, but "name" should be human- readable, human-understandable, and short. A made-up acronym doesn't work (although I like "guts", sure -- put it in your "compatible" property ;-) )

Segher

#16 lore raw
Quoted 24 lines · Segher Boessenkool
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

guts@e00000 {

If "guts" is some kind of official name (i.e., the block is called that in the user manual), it looks okay to me.

No! It is not official name. It is provided by Kumar. It should be a abbr. standing for "Global Utilities" as far as my understand.

So the official name is "global utilities block"?

Quoted 11 lines
Quoted 3 lines

Otherwise, please change; in fact, just change the name anyway (not the compatible), to "shared-soc-regs" or something like that;

I can not agree with you. "shared-soc-regs" can not describe the property of this kind of register.
The official description for this set of registers:

"The global utilities block controls power management, I/O device enabling, power-on-reset (POR) configuration monitoring, general-purpose
I/O signal configuration, alternate function selection for

multiplexed

Quoted 2 lines

signals, and clock control.

Quoted 8 lines
Quoted 4 lines

gub (Kumar's style?): global utilities block
or
global-uti-regs or global-uti (Segher's style?)
may be better.

"global-utilities" sounds fine to me, although the name doesn't actually say anything. Let's avoid abbr.s unless they are very widely known.

"global-utilities" seems good to me!

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

"name"
should be descriptive (but terse).

Agree!
But we should reach a agreement!

Quoted 7 lines

Nah, you guys just need to come up with a good name :-) I would just call it "control" perhaps ;-)

It doesn't matter much, but "name" should be human- readable, human-understandable, and short. A made-up acronym doesn't work (although I like "guts", sure -- put it in your "compatible" property ;-) )

Agree!
Thanks.
Roy

#18 lore raw

PATCH v3 1/1 : Fix e500 v2 core reboot bug

In reply to Zang Roy-r61911

From: roy zang <[email protected]>

Fix the reset bug on 8548CDS board.

Quoted 1 line

From MPC8548CDS with e500 v2 core, a new reset control register is added.

This register is used for the cpu reset.

---
I will update the booting-without-of.txt and apply this method to 8544/8641 in next serial patches.

 arch/powerpc/boot/dts/mpc8548cds.dts |    6 ++++++
 arch/powerpc/platforms/85xx/misc.c   |   30 ++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc8548cds.dts +6 -0
index ad96381..0550a3c 100644
@@ -177,6 +177,12 @@
 			interrupt-parent = <&mpic>;
 		};
 
+		global-utilities@e0000 {	//global utilities reg
+			compatible = "fsl,mpc8548-guts";
+			reg = <e0000 1000>;
+			fsl,has-rstcr;
+		};
+
 		pci1: pci@8000 {
 			interrupt-map-mask = <1f800 0 0 7>;
 			interrupt-map = <
arch/powerpc/platforms/85xx/misc.c +30 -0
index 3e62fcb..6d9451c 100644
@@ -13,11 +13,41 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <sysdev/fsl_soc.h>
+
+static __be32 __iomem *rstcr;
 
 extern void abort(void);
 
+static int __init mpc85xx_rstcr(void)
+{
+	struct device_node *np;
+	np = of_find_node_by_name(NULL, "global-utilities");
+	if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
+		const u32 *prop = of_get_property(np, "reg", NULL);
+		if (prop) {
+		/* map reset control register
+		 * 0xE00B0 is offset of reset control register
+		 */
+			rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
+			if (!rstcr)
+				printk (KERN_EMERG "Error: reset control register not mapped, spinning!\n");
+		}
+	else
+		printk (KERN_INFO "rstcr compatible register does not exist!\n");
+	}
+	return 0;
+}
+
+arch_initcall(mpc85xx_rstcr);
+
 void mpc85xx_restart(char *cmd)
 {
 	local_irq_disable();
+	if (rstcr)
+		/* set reset control register */
+		out_be32(rstcr, 0x2);	/* HRESET_REQ */
 	abort();
 }
Signature · 1 line
1.5.1
#20 lore raw
In reply to Zang Roy-r61911

arch/powerpc/boot/dts/mpc8548cds.dts line 184

Quoted 5 lines
arch/powerpc/boot/dts/mpc8548cds.dts +5 -0
+		global-utilities@e0000 {	//global utilities reg
+			compatible = "fsl,mpc8548-guts";
+			reg = <e0000 1000>;
+			fsl,has-rstcr;
+		};

Looks good.

Quoted 11 lines
arch/powerpc/platforms/85xx/misc.c +10 -0
+	np = of_find_node_by_name(NULL, "global-utilities");
+	if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
+		const u32 *prop = of_get_property(np, "reg", NULL);
+		if (prop) {
+		/* map reset control register
+		 * 0xE00B0 is offset of reset control register
+		 */
+			rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
+			if (!rstcr)
+				printk (KERN_EMERG "Error: reset control register not mapped, 

spinning!\n");

arch/powerpc/platforms/85xx/misc.c line 40

Quoted 4 lines
arch/powerpc/platforms/85xx/misc.c +4 -0
+		}
+	else
+		printk (KERN_INFO "rstcr compatible register does not exist!\n");
+	}

This needs an of_node_put(np). Oh and the indenting is off.

Segher

#21 lore raw
Quoted 24 lines · Segher Boessenkool

arch/powerpc/boot/dts/mpc8548cds.dts line 184

Quoted 5 lines
arch/powerpc/boot/dts/mpc8548cds.dts +5 -0
+             global-utilities@e0000 {        //global utilities reg
+                     compatible = "fsl,mpc8548-guts";
+                     reg = <e0000 1000>;
+                     fsl,has-rstcr;
+             };

Looks good.

arch/powerpc/platforms/85xx/misc.c

Quoted 8 lines
arch/powerpc/platforms/85xx/misc.c +8 -0
+     np = of_find_node_by_name(NULL, "global-utilities");
+     if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
+             const u32 *prop = of_get_property(np, "reg", NULL);
+             if (prop) {
+             /* map reset control register
+              * 0xE00B0 is offset of reset control register
+              */
+                     rstcr = ioremap(get_immrbase() + *prop + 0xB0,

0xff);

Review

Quoted 2 lines
(quoted diff) +2 -0
+                     if (!rstcr)
+                             printk (KERN_EMERG "Error: reset

control register not mapped,

arch/powerpc/platforms/85xx/misc.c

Quoted 4 lines

spinning!\n");

arch/powerpc/platforms/85xx/misc.c +3 -0
+             }
+     else
+             printk (KERN_INFO "rstcr compatible register does not
Quoted 5 lines

exist!\n");

Quoted 1 line

+ }

This needs an of_node_put(np). Oh and the indenting is off.

It is my oversight!
I had thought to add of_node_put(), but forget.
I just checkout the code and decide to have a small revise.

Thanks.
Roy

#26 lore raw
In reply to Segher Boessenkool

From: roy zang <[email protected]>

Fix the reset bug on 8548CDS board.

Quoted 1 line

From MPC8548CDS with e500 v2 core, a new reset control register is added.

This register is used for the cpu reset.

---
Please pick up this one.
Thanks for Segher's comment!

 arch/powerpc/boot/dts/mpc8548cds.dts |    6 ++++++
 arch/powerpc/platforms/85xx/misc.c   |   31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc8548cds.dts +6 -0
index ad96381..0550a3c 100644
@@ -177,6 +177,12 @@
 			interrupt-parent = <&mpic>;
 		};
 
+		global-utilities@e0000 {	//global utilities reg
+			compatible = "fsl,mpc8548-guts";
+			reg = <e0000 1000>;
+			fsl,has-rstcr;
+		};
+
 		pci1: pci@8000 {
 			interrupt-map-mask = <1f800 0 0 7>;
 			interrupt-map = <
arch/powerpc/platforms/85xx/misc.c +31 -0
index 3e62fcb..76f66d4 100644
@@ -13,11 +13,42 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <sysdev/fsl_soc.h>
+
+static __be32 __iomem *rstcr;
 
 extern void abort(void);
 
+static int __init mpc85xx_rstcr(void)
+{
+	struct device_node *np;
+	np = of_find_node_by_name(NULL, "global-utilities");
+	if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
+		const u32 *prop = of_get_property(np, "reg", NULL);
+		if (prop) {
+			/* map reset control register
+			 * 0xE00B0 is offset of reset control register
+			 */
+			rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
+			if (!rstcr)
+				printk (KERN_EMERG "Error: reset control \
+					register not mapped, spinning!\n");
+		}
+		of_node_put(np);
+	} else
+		printk (KERN_INFO "rstcr compatible register does not exist!\n");
+	return 0;
+}
+
+arch_initcall(mpc85xx_rstcr);
+
 void mpc85xx_restart(char *cmd)
 {
 	local_irq_disable();
+	if (rstcr)
+		/* set reset control register */
+		out_be32(rstcr, 0x2);	/* HRESET_REQ */
 	abort();
 }
Signature · 1 line
1.5.1
#22 lore raw
In reply to Zang Roy-r61911

From: roy zang <[email protected]>

Fix the reset bug on 8548CDS board.

Quoted 1 line

From MPC8548CDS with e500 v2 core, a new reset control register is added.

This register is used for the cpu reset.

---
Please ignore the mail sent just now and pick up this one. Sorry for the garbage!
Thanks for Segher's comment.

 arch/powerpc/boot/dts/mpc8548cds.dts |    6 ++++++
 arch/powerpc/platforms/85xx/misc.c   |   31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc8548cds.dts +6 -0
index ad96381..0550a3c 100644
@@ -177,6 +177,12 @@
 			interrupt-parent = <&mpic>;
 		};
 
+		global-utilities@e0000 {	//global utilities reg
+			compatible = "fsl,mpc8548-guts";
+			reg = <e0000 1000>;
+			fsl,has-rstcr;
+		};
+
 		pci1: pci@8000 {
 			interrupt-map-mask = <1f800 0 0 7>;
 			interrupt-map = <
arch/powerpc/platforms/85xx/misc.c +31 -0
index 3e62fcb..76f66d4 100644
@@ -13,11 +13,42 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <sysdev/fsl_soc.h>
+
+static __be32 __iomem *rstcr;
 
 extern void abort(void);
 
+static int __init mpc85xx_rstcr(void)
+{
+	struct device_node *np;
+	np = of_find_node_by_name(NULL, "global-utilities");
+	if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {
+		const u32 *prop = of_get_property(np, "reg", NULL);
+		if (prop) {
+			/* map reset control register
+			 * 0xE00B0 is offset of reset control register
+			 */
+			rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
+			if (!rstcr)
+				printk (KERN_EMERG "Error: reset control \
+					register not mapped, spinning!\n");
+		}
+		of_node_put(np);
+	} else
+		printk (KERN_INFO "rstcr compatible register does not exist!\n");
+	return 0;
+}
+
+arch_initcall(mpc85xx_rstcr);
+
 void mpc85xx_restart(char *cmd)
 {
 	local_irq_disable();
+	if (rstcr)
+		/* set reset control register */
+		out_be32(rstcr, 0x2);	/* HRESET_REQ */
 	abort();
 }
Signature · 1 line
1.5.1
#27 lore raw
In reply to Zang Roy-r61911

arch/powerpc/platforms/85xx/misc.c line 28

Quoted 2 lines
arch/powerpc/platforms/85xx/misc.c +2 -0
+	np = of_find_node_by_name(NULL, "global-utilities");
+	if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {

If this of_get_property fails...

arch/powerpc/platforms/85xx/misc.c line 39

Quoted 11 lines
arch/powerpc/platforms/85xx/misc.c +11 -0
+		const u32 *prop = of_get_property(np, "reg", NULL);
+		if (prop) {
+			/* map reset control register
+			 * 0xE00B0 is offset of reset control register
+			 */
+			rstcr = ioremap(get_immrbase() + *prop + 0xB0, 0xff);
+			if (!rstcr)
+				printk (KERN_EMERG "Error: reset control \
+					register not mapped, spinning!\n");
+		}
+		of_node_put(np);

...you still leak a reference.

Segher

#28 lore raw
Quoted 14 lines · Segher Boessenkool

arch/powerpc/platforms/85xx/misc.c line 28

Quoted 2 lines
arch/powerpc/platforms/85xx/misc.c +2 -0
+     np = of_find_node_by_name(NULL, "global-utilities");
+     if ((np && of_get_property(np, "fsl,has-rstcr", NULL))) {

If this of_get_property fails...

arch/powerpc/platforms/85xx/misc.c

Quoted 6 lines
arch/powerpc/platforms/85xx/misc.c +6 -0
+             const u32 *prop = of_get_property(np, "reg", NULL);
+             if (prop) {
+                     /* map reset control register
+                      * 0xE00B0 is offset of reset control register
+                      */
+                     rstcr = ioremap(get_immrbase() + *prop + 0xB0,

0xff);

Review

Quoted 2 lines
(quoted diff) +2 -0
+                     if (!rstcr)
+                             printk (KERN_EMERG "Error: reset
Quoted 7 lines

control \

Quoted 1 line

+ register not mapped,

spinning!\n");

arch/powerpc/platforms/85xx/misc.c line 39

Quoted 2 lines
arch/powerpc/platforms/85xx/misc.c +2 -0
+             }
+             of_node_put(np);

...you still leak a reference.

You are right!!!
Roy

#23 lore raw
In reply to Zang Roy-r61911
Quoted 5 lines · On Wed, 2007-06-13 at 14:24, Zang Roy-r61911 wrote:

From: roy zang <[email protected]>

Fix the reset bug on 8548CDS board.

Quoted 1 line

From MPC8548CDS with e500 v2 core, a new reset control register is

added.

I am also curious who adds the extra symbol ">" before From, the mailer(I am using evolution) or else ...
:-)
Roy

#24 lore raw
Quoted 5 lines
Quoted 3 lines

Fix the reset bug on 8548CDS board.

Quoted 1 line

From MPC8548CDS with e500 v2 core, a new reset control register is

added.

I am also curious who adds the extra symbol ">" before From, the mailer(I am using evolution) or else ...

The mailer yes, since "From " at the start of line would be confused for an SMTP transport header.

Mail clients traditionally use ">" to prevent this; some mail clients do something different though (a space, for example).

Segher

#25 lore raw
Quoted 2 lines

The mailer yes, since "From " at the start of line would be confused for an SMTP transport header.

Erm, an mbox header I meant of course.

Segher