Skip to contentSkip to conversation

mpc85xx: HWW-1U-1A board support patches

PATCH New Kyle Moffett 5 participants 24 messages Oct 18, 2011 – Oct 21, 2011 PowerPC

lore
Share & tools
lore
#0 lore raw

cover mpc85xx: HWW-1U-1A board support patches

Hello,

This patch series is a resubmission of a series from several months back. It adds support for the eXMeritus HWW-1U-1A hardware.

I believe all of the prior review comments have been addressed. This code is checkpatch clean using scripts/checkpatch.pl from the Linux kernel GIT clone I did a few days ago.

Comments, critiques, and compliments are highly appreciated.

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#1 lore raw

PATCH 1/3 mpc85xx: Add inline GPIO acessor functions

To ease the implementation of other MPC85xx board ports, several common GPIO helpers are added to <asm/mpc85xx_gpio.h>.

Since each of these compiles to no more than 4-5 instructions it would be very inefficient to call them out of line, therefore we put them entirely in the header file.

The HWW-1U-1A board port which these were written for strongly prefers to set multiple GPIOs as a single batch operation, so the API is designed around that basis.

To assist other board ports, a small set of wrappers are used which provides a standard gpio_request() interface around the MPC85xx-specific functions. This can be enabled with CONFIG_MPC85XX_GENERIC_GPIO

Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Peter Tyser <[email protected]>

--

Changelog:
v2: Moved the inline functions to a non-board-specific header
v3: Added generic Linux-standard GPIO wrappers
v4: Improved comments and fixed minor bugs in the wrapper functions
v5: No changes
v6: Rebased onto the 'next' branch of git://git.denx.de/u-boot-mpc85xx.git
v7: No changes
v8: Rebased onto latest HEAD and add README entry for the config option

---
 README                                  |    5 ++
 arch/powerpc/include/asm/mpc85xx_gpio.h |  120 +++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/include/asm/mpc85xx_gpio.h
README +5 -0
index 7e032a9..91412f2 100644
@@ -359,6 +359,11 @@ The following options need to be configured:
 		ICache only when Code runs from RAM.
 
 - 85xx CPU Options:
+		CONFIG_MPC85XX_GENERIC_GPIO
+
+		Provide a generic gpio_request() interface to the onboard
+		processor GPIOs in the MPC85XX-series chips.
+
 		CONFIG_SYS_FSL_TBCLK_DIV
 
 		Defines the core time base clock divider ratio compared to the
arch/powerpc/include/asm/mpc85xx_gpio.h new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 1/3 mpc85xx: Add inline GPIO acessor functions

README The following options need to be configured: · line 365

Quoted 8 lines · On Tuesday 18 October 2011 19:41:22 Kyle Moffett wrote:
README +4 -0
 
 - 85xx CPU Options:
+		CONFIG_MPC85XX_GENERIC_GPIO
+
+		Provide a generic gpio_request() interface to the onboard
+		processor GPIOs in the MPC85XX-series chips.

do you really need a CONFIG knob for this ? defining this adds no overhead that i can see.

arch/powerpc/include/asm/mpc85xx_gpio.h

Quoted 2 lines
arch/powerpc/include/asm/mpc85xx_gpio.h new file +0 -0

missing #ifdef protection against multiple inclusion
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111018/3d9f535b/attachment.pgp

#3 lore raw

PATCH 1/3 mpc85xx: Add inline GPIO acessor functions

Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 18 October 2011 19:41:22 Kyle Moffett wrote:
README +0 -0
Quoted 8 lines

README The following options need to be configured: · line 365

Quoted 5 lines

- 85xx CPU Options:

README +4 -0
+		CONFIG_MPC85XX_GENERIC_GPIO
+
+		Provide a generic gpio_request() interface to the onboard
+		processor GPIOs in the MPC85XX-series chips.

do you really need a CONFIG knob for this ? defining this adds no overhead that i can see.

I agree, wasn't paying attention that this is just in a .h, so lets remove the CONFIG_ option bits (both in README and in .h)

Quoted 4 lines

arch/powerpc/include/asm/mpc85xx_gpio.h

Quoted 2 lines
arch/powerpc/include/asm/mpc85xx_gpio.h new file +0 -0

missing #ifdef protection against multiple inclusion

please fix.

- k

#4 lore raw

PATCH 1/3 mpc85xx: Add inline GPIO acessor functions

Quoted 14 lines · Kumar Gala
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 18 October 2011 19:41:22 Kyle Moffett wrote:
README +0 -0
Quoted 8 lines

README The following options need to be configured: · line 365

Quoted 5 lines

- 85xx CPU Options:

README +4 -0
+		CONFIG_MPC85XX_GENERIC_GPIO
+
+		Provide a generic gpio_request() interface to the onboard
+		processor GPIOs in the MPC85XX-series chips.

do you really need a CONFIG knob for this ? defining this adds no overhead that i can see.

Quoted 1 line

I agree, wasn't paying attention that this is just in a .h, so lets remove the CONFIG_ option bits (both in README and in .h)

Well, I was concerned that this API could conflict with another provider of the generic GPIO interface (IE: An I2C GPIO chip or whatever).

Looking further it appears that only 3-4 drivers implement the generic GPIO interface, and all of those are CPU-specific, so it should not be a problem in practice.

The reason I originally made this configurable was because I did not want or need the generic GPIO interface; I needed an API that let me set a large group of GPIOs simultaneously. During an early review it was asked why I didn't use the standard interface; so I implemented the simple wrapper functions.

I've removed the CONFIG_* option and will be resubmitting that patch shortly.

Quoted 6 lines
Quoted 4 lines

arch/powerpc/include/asm/mpc85xx_gpio.h

Quoted 2 lines
arch/powerpc/include/asm/mpc85xx_gpio.h new file +0 -0

missing #ifdef protection against multiple inclusion

please fix.

Really? Oops! I have no idea how I missed that. Fixed.

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#5 lore raw

PATCH 2/3 mpc85xx: Add inline GPIO acessor functions

To ease the implementation of other MPC85xx board ports, several common GPIO helpers are added to <asm/mpc85xx_gpio.h>.

Since each of these compiles to no more than 4-5 instructions it would be very inefficient to call them out of line, therefore we put them entirely in the header file.

The HWW-1U-1A board port which these were written for strongly prefers to set multiple GPIOs as a single batch operation, so the API is designed around that basis.

To assist other board ports, a small set of wrappers are used which provides a standard gpio_request() interface around the MPC85xx-specific functions. This can be enabled with CONFIG_MPC85XX_GENERIC_GPIO

Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Peter Tyser <[email protected]>

--

Changelog:
v2: Moved the inline functions to a non-board-specific header
v3: Added generic Linux-standard GPIO wrappers
v4: Improved comments and fixed minor bugs in the wrapper functions
v5: No changes
v6: Rebased onto the 'next' branch of git://git.denx.de/u-boot-mpc85xx.git
v7: No changes
v8: Rebased onto latest HEAD and add README entry for the config option
v9: Removed CONFIG_* option and added missing #ifdef protection

---
 arch/powerpc/include/asm/mpc85xx_gpio.h |  123 +++++++++++++++++++++++++++++++
 1 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/include/asm/mpc85xx_gpio.h
arch/powerpc/include/asm/mpc85xx_gpio.h new file +123 -0
new file mode 100644
index 0000000..bcf5b86
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2010 eXMeritus, A Boeing Company
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef  POWERPC_ASM_MPC85XX_GPIO_H_
+# define POWERPC_ASM_MPC85XX_GPIO_H_ 1
+
+# include <asm/immap_85xx.h>
+
+/*
+ * The following internal functions are an MPC85XX-specific GPIO API which
+ * allows setting and querying multiple GPIOs in a single operation.
+ *
+ * All of these look relatively large, but the arguments are almost always
+ * constants, so they compile down to just a few instructions and a
+ * memory-mapped IO operation or two.
+ */
+static inline void mpc85xx_gpio_set(unsigned int mask,
+		unsigned int dir, unsigned int val)
+{
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+
+	/* First mask off the unwanted parts of "dir" and "val" */
+	dir &= mask;
+	val &= mask;
+
+	/* Now read in the values we're supposed to preserve */
+	dir |= (in_be32(&gpio->gpdir) & ~mask);
+	val |= (in_be32(&gpio->gpdat) & ~mask);
+
+	/*
+	 * Poke the new output values first, then set the direction.  This
+	 * helps to avoid transient data when switching from input to output
+	 * and vice versa.
+	 */
+	out_be32(&gpio->gpdat, val);
+	out_be32(&gpio->gpdir, dir);
+}
+
+static inline void mpc85xx_gpio_set_in(unsigned int gpios)
+{
+	mpc85xx_gpio_set(gpios, 0x00000000, 0x00000000);
+}
+
+static inline void mpc85xx_gpio_set_low(unsigned int gpios)
+{
+	mpc85xx_gpio_set(gpios, 0xFFFFFFFF, 0x00000000);
+}
+
+static inline void mpc85xx_gpio_set_high(unsigned int gpios)
+{
+	mpc85xx_gpio_set(gpios, 0xFFFFFFFF, 0xFFFFFFFF);
+}
+
+static inline unsigned int mpc85xx_gpio_get(unsigned int mask)
+{
+	ccsr_gpio_t *gpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR + 0xc00);
+
+	/* Read the requested values */
+	return in_be32(&gpio->gpdat) & mask;
+}
+
+/*
+ * These implement the generic Linux GPIO API on top of the other functions
+ * in this header.
+ */
+static inline int gpio_request(unsigned gpio, const char *label)
+{
+	/* Compatibility shim */
+	return 0;
+}
+
+static inline void gpio_free(unsigned gpio)
+{
+	/* Compatibility shim */
+}
+
+static inline int gpio_direction_input(unsigned gpio)
+{
+	mpc85xx_gpio_set_in(1U << gpio);
+	return 0;
+}
+
+static inline int gpio_direction_output(unsigned gpio, int value)
+{
+	mpc85xx_gpio_set_low(1U << gpio);
+	return 0;
+}
+
+static inline int gpio_get_value(unsigned gpio)
+{
+	return !!mpc85xx_gpio_get(1U << gpio);
+}
+
+static inline void gpio_set_value(unsigned gpio, int value)
+{
+	if (value)
+		mpc85xx_gpio_set_high(1U << gpio);
+	else
+		mpc85xx_gpio_set_low(1U << gpio);
+}
+
+static inline int gpio_is_valid(int gpio)
+{
+	return (gpio >= 0) && (gpio < 32);
+}
+
+#endif /* not POWERPC_ASM_MPC85XX_GPIO_H_ */
Signature · 1 line
1.7.2.5
Applied
#6 lore raw

PATCH 2/3 mpc85xx: Add inline GPIO acessor functions

Quoted 33 lines · Kyle Moffett

To ease the implementation of other MPC85xx board ports, several common GPIO helpers are added to <asm/mpc85xx_gpio.h>.

Since each of these compiles to no more than 4-5 instructions it would be very inefficient to call them out of line, therefore we put them entirely in the header file.

The HWW-1U-1A board port which these were written for strongly prefers to set multiple GPIOs as a single batch operation, so the API is designed around that basis.

To assist other board ports, a small set of wrappers are used which provides a standard gpio_request() interface around the MPC85xx-specific functions. This can be enabled with CONFIG_MPC85XX_GENERIC_GPIO

Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
Cc Peter Tyser <[email protected]>

--

Changelog:
v2: Moved the inline functions to a non-board-specific header
v3: Added generic Linux-standard GPIO wrappers
v4: Improved comments and fixed minor bugs in the wrapper functions
v5: No changes
v6: Rebased onto the 'next' branch of git://git.denx.de/u-boot-mpc85xx.git
v7: No changes
v8: Rebased onto latest HEAD and add README entry for the config option
v9: Removed CONFIG_* option and added missing #ifdef protection
---
arch/powerpc/include/asm/mpc85xx_gpio.h | 123 +++++++++++++++++++++++++++++++

Quoted 2 lines
1 files changed, 123 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/include/asm/mpc85xx_gpio.h

applied to 85xx

- k

#7 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

In reply to Kyle Moffett

The HWW-1U-1A board needs to be able to override the "reset" command due to hardware design limitations.

Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>

--

Changelog:
v2: Removed in favor of more involved reset rework
v6: Resurrected again (the more involved rework was NAKed)
v7: Fixed remaining checkpatch errors
v8: Also hook __board_restart() from the pre-PQ3 do_reset() code.
Rebased onto the latest HEAD.

---
 arch/powerpc/cpu/mpc85xx/cpu.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu.c +27 -5
index 49c0551..81a17bc 100644
@@ -195,13 +195,24 @@ int checkcpu (void)
 
 /* ------------------------------------------------------------------------- */
 
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+/* Board-specific reset stub */
+__attribute__((__weak__))
+int __board_restart(void)
 {
-/* Everything after the first generation of PQ3 parts has RSTCR */
+	return 0;
+}
+
 #if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
     defined(CONFIG_MPC8555) || defined(CONFIG_MPC8560)
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
 	unsigned long val, msr;
 
+	/* Allow boards to override the reset */
+	int err = __board_restart();
+	if (err)
+		return err;
+
 	/*
 	 * Initiate hard reset in debug control register DBCR0
 	 * Make sure MSR[DE] = 1.  This only resets the core.
@@ -213,14 +224,25 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	val = mfspr(DBCR0);
 	val |= 0x70000000;
 	mtspr(DBCR0,val);
+}
 #else
-	volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	/* Everything after the first generation of PQ3 parts has RSTCR */
+	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+	/* Allow boards to override the reset */
+	int err = __board_restart();
+	if (err)
+		return err;
+
 	out_be32(&gur->rstcr, 0x2);	/* HRESET_REQ */
 	udelay(100);
-#endif
-
 	return 1;
 }
+#endif
+
+
 
 
 /*
Signature · 1 line
1.7.2.5
#8 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

arch/powerpc/cpu/mpc85xx/cpu.c int checkcpu (void) · line 214

Quoted 8 lines · On Tuesday 18 October 2011 19:41:23 Kyle Moffett wrote:
arch/powerpc/cpu/mpc85xx/cpu.c +6 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
 	unsigned long val, msr;
 
+	/* Allow boards to override the reset */
+	int err = __board_restart();
+	if (err)
+		return err;

i thought we decided that do_reset() shouldn't return
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111018/73969316/attachment.pgp

#9 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 5 lines · Mike Frysinger
Quoted 4 lines · On Tuesday 18 October 2011 19:41:23 Kyle Moffett wrote:
(quoted diff) +2 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
	unsigned long val, msr;
Quoted 7 lines

arch/powerpc/cpu/mpc85xx/cpu.c int checkcpu (void) · line 214

Quoted 4 lines
arch/powerpc/cpu/mpc85xx/cpu.c +4 -0
+	/* Allow boards to override the reset */
+	int err = __board_restart();
+	if (err)
+		return err;

i thought we decided that do_reset() shouldn't return -mike

For our hardware we have to coordinate reset between both CPUs on the same physical board, so a "reset" command may hang indefinitely waiting for the other CPU (IE: If it refuses to shutdown in Linux or is running U-Boot).

So for user convenience I need to be able to Ctrl-C the communication. Since "reset" is basically just like any other U-Boot shell command, (except with some side-effects) it seems reasonable to allow a board handler to return an error instead of resetting.

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#10 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 19 lines · Kyle D
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 18 October 2011 19:41:23 Kyle Moffett wrote:
(quoted diff) +2 -0
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
Quoted 8 lines

arch/powerpc/cpu/mpc85xx/cpu.c int checkcpu (void) · line 214

Quoted 6 lines
	unsigned long val, msr;
arch/powerpc/cpu/mpc85xx/cpu.c +4 -0
+	/* Allow boards to override the reset */
+	int err = __board_restart();
+	if (err)
+		return err;

i thought we decided that do_reset() shouldn't return

For our hardware we have to coordinate reset between both CPUs on the same physical board, so a "reset" command may hang indefinitely waiting for the other CPU (IE: If it refuses to shutdown in Linux or is running U-Boot).

Quoted 4 lines

So for user convenience I need to be able to Ctrl-C the communication. Since "reset" is basically just like any other U-Boot shell command, (except with some side-effects) it seems reasonable to allow a board handler to return an error instead of resetting.

i thought this came up before and we said "no". but Wolfgang was more involved in that discussion, so he should be able to better say.

this is probably in the mail archives somewhere too ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111019/aecb00e2/attachment.pgp

#11 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Dear Mike Frysinger,

Quoted 3 lines · In message <[email protected]> you wrote:

i thought this came up before and we said "no". but Wolfgang was more involved in that discussion, so he should be able to better say.

Yes, we said no.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm what passes for a Unix guru in my office. This is  a  frightening
concept. - Lee Ann Goldstein, in <[email protected]>
#12 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

In reply to Moffett

Dear "Moffett, Kyle D",

Quoted 2 lines · In message <[email protected]> you wrote:

Since "reset" is basically just like any other U-Boot shell command,

No, it ain't.

Quoted 2 lines

(except with some side-effects) it seems reasonable to allow a board handler to return an error instead of resetting.

No. Reset will never return. It is supposed to hard reset the board, which means crossing the point of no return.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"In matrimony, to hesitate is sometimes to be saved."        - Butler
#13 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 6 lines · Wolfgang Denk

Dear "Moffett, Kyle D",

Quoted 2 lines · In message <[email protected]> you wrote:

Since "reset" is basically just like any other U-Boot shell command,

Quoted 7 lines

No, it ain't.

Quoted 2 lines

(except with some side-effects) it seems reasonable to allow a board handler to return an error instead of resetting.

No. Reset will never return. It is supposed to hard reset the board, which means crossing the point of no return.

Ok.

By that definition, my board cannot safely use U-Boot's "reset" command.

Would you accept a patch which makes it possible for a board to not implement a "reset" command at all?

There are a few places in common/cmd_bootm.c which are converted to use panic("...") instead of printf("...")+do_reset().

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#14 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 14 lines · Kyle D
Quoted 10 lines · Wolfgang Denk
Quoted 1 line · Kyle D

Since "reset" is basically just like any other U-Boot shell command,

No, it ain't.

Quoted 2 lines

(except with some side-effects) it seems reasonable to allow a board handler to return an error instead of resetting.

No. Reset will never return. It is supposed to hard reset the board, which means crossing the point of no return.

Ok.

Quoted 7 lines

By that definition, my board cannot safely use U-Boot's "reset" command.

Would you accept a patch which makes it possible for a board to not implement a "reset" command at all?

There are a few places in common/cmd_bootm.c which are converted to use panic("...") instead of printf("...")+do_reset().

i guess i'm dumb, but i don't understand why it can't be made to work on your board. but worse comes to worse, you could have your board reset call hang() or panic() ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111019/3a76bd69/attachment.pgp

#15 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 20 lines · Mike Frysinger
Quoted 19 lines · Kyle D
Quoted 10 lines · Wolfgang Denk
Quoted 1 line · Kyle D

Since "reset" is basically just like any other U-Boot shell command,

No, it ain't.

Quoted 2 lines

(except with some side-effects) it seems reasonable to allow a board handler to return an error instead of resetting.

No. Reset will never return. It is supposed to hard reset the board, which means crossing the point of no return.

Ok.

By that definition, my board cannot safely use U-Boot's "reset" command.

Would you accept a patch which makes it possible for a board to not implement a "reset" command at all?

Quoted 6 lines
Quoted 2 lines

There are a few places in common/cmd_bootm.c which are converted to use panic("...") instead of printf("...")+do_reset().

i guess i'm dumb, but i don't understand why it can't be made to work on your board. but worse comes to worse, you could have your board reset call hang() or panic() ...

Each board has two separate processor units on it, each with their own memory and devices. If either processor reboots on its own then both will hang and be unusable.

So U-Boot MUST NOT reset without negotiating, even if the current CPU has crashed, as that will cause the other (possibly perfectly operational) CPU to also crash.

I suppose in theory I could add the __board_restart() hook and make it call "panic()", but by removing do_reset() entirely for my board, I get helpful link errors for tracking down places which should be calling panic() or whatever instead.

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#16 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 3 lines · Kyle D

So U-Boot MUST NOT reset without negotiating, even if the current CPU has crashed, as that will cause the other (possibly perfectly operational) CPU to also crash.

so why can't you have your do_reset() board hook negotiate with the other CPU to reset the system ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111019/38f3827f/attachment.pgp

#17 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 7 lines · Mike Frysinger
Quoted 3 lines · Kyle D

So U-Boot MUST NOT reset without negotiating, even if the current CPU has crashed, as that will cause the other (possibly perfectly operational) CPU to also crash.

so why can't you have your do_reset() board hook negotiate with the other CPU to reset the system ?

That's what I originally implemented. The problem is the negotiation can take an unbounded amount of time to execute, so if it's run from the command line then it needs to be interruptible (EG: with Ctrl-C), which means it needs to be able to return an error.

I can see if I can come up with yet another possible alternative, but I'd like to try to get the less-controversial patches (especially the GPIO header and the e1000 ones) merged first.

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#18 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 6 lines · Kyle D
Quoted 5 lines · Mike Frysinger
Quoted 3 lines · Kyle D

So U-Boot MUST NOT reset without negotiating, even if the current CPU has crashed, as that will cause the other (possibly perfectly operational) CPU to also crash.

Quoted 7 lines
Quoted 2 lines

so why can't you have your do_reset() board hook negotiate with the other CPU to reset the system ?

That's what I originally implemented. The problem is the negotiation can take an unbounded amount of time to execute, so if it's run from the command line then it needs to be interruptible (EG: with Ctrl-C), which means it needs to be able to return an error.

what's wrong with an unbounded amount of time ? if the user wants it to reset, then it should do so regardless of how long.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111019/3fa96c65/attachment.pgp

#19 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

In reply to Moffett

Dear "Moffett, Kyle D",

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 3 lines

so why can't you have your do_reset() board hook negotiate with the other CPU to reset the system ?

That's what I originally implemented. The problem is the negotiation can take an unbounded amount of time to execute, so if it's run from the command line then it needs to be interruptible (EG: with Ctrl-C), which means it needs to be able to return an error.

Why would it need to be interruptable? When you type "reset", then you are gone. You cannot interrupt that command any more.

If it takes a long time like in your case, so you might print a message "Please stand by / have a cup of coffee while resetting" or so...

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I think they're going to take all this money that we  spend  now  on
war and death --"                   "And make them spend it on life."
	-- Edith Keeler and Kirk, "The City on the Edge of Forever",
	   stardate unknown.
#20 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

In reply to Moffett

Dear "Moffett, Kyle D",

Quoted 2 lines · In message <[email protected]> you wrote:

By that definition, my board cannot safely use U-Boot's "reset" command.

You can call halt() or panic() as last stage of your reset implementation.

Heh. Mike writes the same ;-)

Quoted 5 lines

Would you accept a patch which makes it possible for a board to not implement a "reset" command at all?

There are a few places in common/cmd_bootm.c which are converted to use panic("...") instead of printf("...")+do_reset().

This is not acceptable, as changes behaviour: panic() will halt the system, not reset it.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Actual war is a very messy business. Very, very messy business.
	-- Kirk, "A Taste of Armageddon", stardate 3193.0
#21 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Quoted 11 lines · Wolfgang Denk

Dear "Moffett, Kyle D",

Quoted 6 lines · In message <[email protected]> you wrote:

Would you accept a patch which makes it possible for a board to not implement a "reset" command at all?

There are a few places in common/cmd_bootm.c which are converted to use panic("...") instead of printf("...")+do_reset().

This is not acceptable, as changes behaviour: panic() will halt the system, not reset it.

That is obviously wrong, as a 5 second glance at panic() in the file lib/vsprintf.c would tell you. For 540 of the 567 board configs in the include/configs/ directory, panic will directly call do_reset(); only 27 of the configs (less than 5%) set CONFIG_PANIC_HANG.

The only change with the patch for boards without CONFIG_PANIC_HANG is that panic() has an extra udelay() to ensure that the serial console messages go out before the reset.

For the boards that *do* set CONFIG_PANIC_HANG, none of the fatal errors in common/cmd_bootm.c should cause U-Boot to reset, they are all valid panic() conditions, such as GZIP overwrite errors and fatal image format issues. In those cases this is also a bugfix.

Patch to follow shortly.

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port? I'm keeping a blog here: http://pureperl.blogspot.com/

#22 lore raw

PATCH 2/3 mpc85xx: Add a board-specific restart hook

Dear "Moffett, Kyle D",

Quoted 5 lines · In message <[email protected]> you wrote:

For the boards that *do* set CONFIG_PANIC_HANG, none of the fatal errors in common/cmd_bootm.c should cause U-Boot to reset, they are all valid panic() conditions, such as GZIP overwrite errors and fatal image format issues. In those cases this is also a bugfix.

These boards may rely on such behaviour, for example by then booting an altenative image. This _is_ a change of behavior, even if only for a relatively small number of boards.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are always alternatives.
	-- Spock, "The Galileo Seven", stardate 2822.3
#23 lore raw

PATCH 3/3 mpc85xx: Add board support for the eXMeritus HWW-1U-1A devices

In reply to Kyle Moffett

The eXMeritus HWW-1U-1A unit is a DO-160-certified 13lb 1U chassis with 3 independent TEMPEST zones. Two independent P2020 computers may be found inside each zone. Complete hardware support is included.

High-level hardware overview:
* DO-160 certified for passenger aircraft (noncritical)
* TEMPEST ceritified for RED/BLACK separation
* 3 zones per chassis, 2 computers per zone (total of 6)
* Dual-core 1.066GHz P2020 per computer
* One 2GB DDR2 SO-RDIMM module per computer (upgradable to 4GB)
* Removable 80GB or 160GB Intel X18-M SSD per computer
* Front-accessible dual-port E1000E per computer
* Front-accessible serial console per computer
* Front-accessible USB port per computer
* Internal Gigabit crossover within each TEMPEST zone
* Internal unidirectional fiber links across TEMPEST zones
* Battery-backed DS1339 I2C RTC on each CPU.

Combined, each 13lb 1U chassis contains 12GB RAM, 12 cores @ 1.066GHz, 12 front-accessible Gigabit Ethernet ports and 960GB of solid-state storage with a total power consumption of ~200W.

Additional notes:
* SPD detection is only known to work with the DO-160-certified DIMMs

* A U-Boot built with 36-bit address-space seems to work, but I don't yet have a usable 36-bit kernel or DTB, so it's mostly untested.

* CPU reset is a little quirky due to hardware misfeature, see the extensive comments in the board_reset() function in hww1u1a.c

Cc Andy Fleming <[email protected]>
Cc Kumar Gala <[email protected]>
---
 MAINTAINERS                       |    4 +
 board/exmeritus/hww1u1a/Makefile  |   48 ++++
 board/exmeritus/hww1u1a/ddr.c     |   34 +++
 board/exmeritus/hww1u1a/gpios.h   |   69 +++++
 board/exmeritus/hww1u1a/hww1u1a.c |  549 +++++++++++++++++++++++++++++++++++++
 board/exmeritus/hww1u1a/law.c     |   34 +++
 board/exmeritus/hww1u1a/tlb.c     |  106 +++++++
 boards.cfg                        |    2 +
 include/configs/HWW1U1A.h         |  473 ++++++++++++++++++++++++++++++++
 9 files changed, 1319 insertions(+), 0 deletions(-)
 create mode 100644 board/exmeritus/hww1u1a/Makefile
 create mode 100644 board/exmeritus/hww1u1a/ddr.c
 create mode 100644 board/exmeritus/hww1u1a/gpios.h
 create mode 100644 board/exmeritus/hww1u1a/hww1u1a.c
 create mode 100644 board/exmeritus/hww1u1a/law.c
 create mode 100644 board/exmeritus/hww1u1a/tlb.c
 create mode 100644 include/configs/HWW1U1A.h
MAINTAINERS +4 -0
index bb95e6d..9de41f7 100644
@@ -319,6 +319,10 @@ Reinhard Meyer <[email protected]>
 	TOP5200		MPC5200
 	TOP9000		ARM926EJS (AT91SAM9xxx SoC)
 
+Kyle Moffett <[email protected]>
+
+	HWW1U1A		P2020
+
 Tolunay Orkun <[email protected]>
 
 	csb272		PPC405GP
board/exmeritus/hww1u1a/Makefile new file +48 -0

48 lines not on this page · raw message

board/exmeritus/hww1u1a/ddr.c new file +34 -0
new file mode 100644
index 0000000..36d02ad
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2009-2010 eXMeritus, A Boeing Company
+ * Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ */
+
+#include <common.h>
+
+#include <asm/fsl_ddr_sdram.h>
+#include <asm/fsl_ddr_dimm_params.h>
+
+void fsl_ddr_board_options(memctl_options_t *popts,
+				dimm_params_t *pdimm,
+				unsigned int ctrl_num)
+{
+	/*
+	 * We only support one DIMM, so according to the P2020 docs we should
+	 * set the options as follows:
+	 */
+	popts->cs_local_opts[0].odt_rd_cfg = 0;
+	popts->cs_local_opts[0].odt_wr_cfg = 4;
+	popts->cs_local_opts[1].odt_rd_cfg = 0;
+	popts->cs_local_opts[1].odt_wr_cfg = 0;
+	popts->half_strength_driver_enable = 0;
+
+	/* Manually configured for our static clock rate */
+	popts->clk_adjust = 4;
+	popts->cpo_override = 4;
+	popts->write_data_delay = 2;
+	popts->twoT_en = 0;
+}
board/exmeritus/hww1u1a/gpios.h new file +69 -0

69 lines not on this page · raw message

board/exmeritus/hww1u1a/hww1u1a.c new file +549 -0

549 lines not on this page · raw message

board/exmeritus/hww1u1a/law.c new file +34 -0
new file mode 100644
index 0000000..1281c56
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008-2009 Freescale Semiconductor, Inc.
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, [email protected].
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/fsl_law.h>
+#include <asm/mmu.h>
+
+struct law_entry law_table[] = {
+	SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_LBC),
+};
+
+int num_law_entries = ARRAY_SIZE(law_table);
board/exmeritus/hww1u1a/tlb.c new file +106 -0

106 lines not on this page · raw message

boards.cfg +2 -0
index bd70a66..e1c16e7 100644
@@ -552,6 +552,8 @@ sbc8560                      powerpc     mpc85xx     sbc8560             -
 sbc8560_33                   powerpc     mpc85xx     sbc8560             -              -           sbc8560
 sbc8560_66                   powerpc     mpc85xx     sbc8560             -              -           sbc8560
 socrates                     powerpc     mpc85xx     socrates
+HWW1U1A                      powerpc     mpc85xx     hww1u1a             exmeritus
+HWW1U1A_36BIT                powerpc     mpc85xx     hww1u1a             exmeritus      -           HWW1U1A:36BIT
 MPC8536DS                    powerpc     mpc85xx     mpc8536ds           freescale      -           MPC8536DS
 MPC8536DS_36BIT              powerpc     mpc85xx     mpc8536ds           freescale      -           MPC8536DS:36BIT
 MPC8536DS_NAND               powerpc     mpc85xx     mpc8536ds           freescale      -           MPC8536DS:NAND
include/configs/HWW1U1A.h new file +473 -0

473 lines not on this page · raw message

Signature · 1 line
1.7.2.5