LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] MTD for Taco
From: Josh Boyer @ 2008-01-16 23:34 UTC (permalink / raw)
  To: Sean MacLennan; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <478E7643.5040804@pikatech.com>

On Wed, 16 Jan 2008 16:25:23 -0500
Sean MacLennan <smaclennan@pikatech.com> wrote:

> Sean MacLennan wrote:
> > How about adding a config option that lets you specify 8 bit access? 
> > Something like CONFIG_NDFC_8BIT_ACCESS. We could default it to no and 
> > put a little blurb that says something like:
> >
> > On some platforms the 32bit read/writes cause a machine access 
> > exception. If you get a machine access exception while reading the NAND 
> > bad block table, try turning on 8 bit access.
> >   
> I know it would be better if 32 bit access just worked, but nobody 
> actively objected to this idea, so here is a patch ;)

I'm objecting, but not on the bit access reasons :).

1) Needs to go to the linux-mtd@lists.infradead.org list with the
maintainer CC'd (Thomas Gleixner)

2) I don't want this driver enabled in mainline for boards in
arch/powerpc until it fully understands how to parse device trees.

You could separate out the 8-bit access option and send that to
linux-mtd though

josh

^ permalink raw reply

* Re: [PATCH 1/5] Warp Base Platform
From: Stephen Rothwell @ 2008-01-16 23:36 UTC (permalink / raw)
  To: Sean MacLennan; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <478E9369.5090605@pikatech.com>

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

On Wed, 16 Jan 2008 18:29:45 -0500 Sean MacLennan <smaclennan@pikatech.com> wrote:
>
> Everybody happy with this patch?

I am happy (about this patch at least :-))

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 1/5] Warp Base Platform
From: Josh Boyer @ 2008-01-16 23:39 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev, Stefan Roese, Sean MacLennan
In-Reply-To: <20080117103648.e225e9f5.sfr@canb.auug.org.au>

On Thu, 17 Jan 2008 10:36:48 +1100
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> On Wed, 16 Jan 2008 18:29:45 -0500 Sean MacLennan <smaclennan@pikatech.com> wrote:
> >
> > Everybody happy with this patch?
> 
> I am happy (about this patch at least :-))

Yes, I have this queued up.

josh

^ permalink raw reply

* Re: Fixed phy
From: Anton Vorontsov @ 2008-01-16 23:26 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-dev
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B039BA0D3@ismail.innsys.innovsys.com>

Hello Rune,

On Wed, Jan 16, 2008 at 10:50:53AM -0600, Rune Torgersen wrote:
> 
> Hi
> We're doing a port to 2.6.24-rc7, and we need to set up two ethernets
> with fixed phy's as they have phyless interfaces to a switch.
> WE cannot find any good examples on how to do this. We've found the
> fixed speed PHY emulation in the configuration, but are unsure on
> how to set the PHY's up in the device tree.
> 
> This is using a 8280 cpu and ethernet on the FCC's

See these patches:

Fixed phy subsystem rework:
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/047777.html

Fixed phy generic dts parsing & gianfar support:
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/047778.html

Fixed phy support for fs_enet driver (SCC/FCC/FEC):
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048090.html

Example of usage:
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/047779.html

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: [PATCH] MTD for Taco
From: Sean MacLennan @ 2008-01-16 23:51 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20080116173421.4c886514@zod.rchland.ibm.com>

Josh Boyer wrote:
> On Wed, 16 Jan 2008 16:25:23 -0500
> Sean MacLennan <smaclennan@pikatech.com> wrote:
>
>   
>> Sean MacLennan wrote:
>>     
>>> How about adding a config option that lets you specify 8 bit access? 
>>> Something like CONFIG_NDFC_8BIT_ACCESS. We could default it to no and 
>>> put a little blurb that says something like:
>>>
>>> On some platforms the 32bit read/writes cause a machine access 
>>> exception. If you get a machine access exception while reading the NAND 
>>> bad block table, try turning on 8 bit access.
>>>   
>>>       
>> I know it would be better if 32 bit access just worked, but nobody 
>> actively objected to this idea, so here is a patch ;)
>>     
>
> I'm objecting, but not on the bit access reasons :).
>
> 1) Needs to go to the linux-mtd@lists.infradead.org list with the
> maintainer CC'd (Thomas Gleixner)
>   
Ok.
> 2) I don't want this driver enabled in mainline for boards in
> arch/powerpc until it fully understands how to parse device trees.
>   
Fair enough. I thought it would be better to have a driver that compiles 
and is usable for arch/powerpc, even if not quite correct. We (PIKA) are 
going to be using a NAND flash, so we need the ndfc driver working. But 
I can understand wanting it "right" before you put it in the kernel.

Cheers,
   Sean

^ permalink raw reply

* Re: [Add mpc5121 support PATCH v2 2/8] Add mpc512x ipic support
From: David Gibson @ 2008-01-17  0:16 UTC (permalink / raw)
  To: John Rigby; +Cc: linuxppc-dev
In-Reply-To: <1200519447-25555-2-git-send-email-jrigby@freescale.com>

On Wed, Jan 16, 2008 at 02:37:21PM -0700, John Rigby wrote:
> Added ipic_info entries for vectors used by 512x that
> were previously unused by 83xx.

I've always wondered what these great big tables in the ipic driver
were for.  Are they anything that could be better repsresented in the
device tree?

> diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
> index 7274750..4c016da 100644
> --- a/arch/powerpc/sysdev/ipic.c
> +++ b/arch/powerpc/sysdev/ipic.c
> @@ -48,6 +48,13 @@ static struct ipic_info ipic_info[] = {
>  		.bit	= 17,
>  		.prio_mask = 1,
>  	},
> +	[3] = {
> +		.mask	= IPIC_SIMSR_H,
> +		.prio	= IPIC_SIPRR_C,
> +		.force	= IPIC_SIFCR_H,
> +		.bit	= 18,
> +		.prio_mask = 2,
> +	},
>  	[4] = {
>  		.mask	= IPIC_SIMSR_H,
>  		.prio	= IPIC_SIPRR_C,
> @@ -55,6 +62,34 @@ static struct ipic_info ipic_info[] = {
>  		.bit	= 19,
>  		.prio_mask = 3,
>  	},
> +	[5] = {
> +		.mask	= IPIC_SIMSR_H,
> +		.prio	= IPIC_SIPRR_C,
> +		.force	= IPIC_SIFCR_H,
> +		.bit	= 20,
> +		.prio_mask = 4,
> +	},
[...]

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH 4/4 v2] powerpc: Katana750i - Add platform support
From: Mark A. Greer @ 2008-01-17  0:35 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linuxppc-dev
In-Reply-To: <20080117102702.5e21fc22.sfr@canb.auug.org.au>

On Thu, Jan 17, 2008 at 10:27:02AM +1100, Stephen Rothwell wrote:
> Hi Mark,
> 
> On Wed, 16 Jan 2008 15:12:10 -0700 "Mark A. Greer" <mgreer@mvista.com> wrote:
> >
> > +static void __init katana750i_setup_arch(void)
> > +{
> > +	struct device_node *np;
> > +	phys_addr_t paddr;
> > +	const unsigned int *reg;
> > +
> > +	np = of_find_compatible_node(NULL, NULL, "katana750i,cpld");
> > +	if (!np)
> > +		printk(KERN_WARNING "No CPLD DT node; functionality reduced\n");
> > +	else {
> > +		reg = of_get_property(np, "reg", NULL);
> > +		if (!reg)
> > +			printk(KERN_WARNING "No CPLD reg property; "
> > +					"functionality reduced\n");
> > +		else {
> > +			paddr = of_translate_address(np, reg);
> > +			of_node_put(np);
> > +			cpld_base = ioremap(paddr, reg[1]);
> > +		}
> > +	}
> 
> You need an of_node_put(np) for the !reg case above.  Maybe you should
> just put it after the else clause instead of in it.

Erg, yes...duh.

Thanks again, Stephen.

Mark

^ permalink raw reply

* Re: [PATCH 1/4] powerpc: mv64x60 - Use early_* PCI accessors for hotswap reg
From: Mark A. Greer @ 2008-01-17  0:47 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1200523739.6755.33.camel@pasglop>

On Thu, Jan 17, 2008 at 09:48:59AM +1100, Benjamin Herrenschmidt wrote:
> 
> On Mon, 2008-01-14 at 15:51 -0700, Mark A. Greer wrote:
> > From: Mark A. Greer <mgreer@mvista.com>
> > 
> > The mv64x60 Hotswap register is on the first hose of the mv64x60
> > hostbridge.  To access it, manually find the hose structure and
> > use the early_* PCI accessor routines because the hostbridge is
> > normally hidden.
> 
> Can't we unhide the NB instead ?

Hi Ben.

Possibly but it may cause issues since many hostbridge have BARs
that don't comply with the PCI spec which may get hosed when scanning
the PCI bus.  Maybe fixups/quirks/whatever will help but I'm not sure
that's any cleaner.  TBH, I'm not familiar enough with the PCI subsystem
to answer this intelligently.

Mark

^ permalink raw reply

* Re: [PATCH 3/4] powerpc: Katana750i - Add DTS file
From: David Gibson @ 2008-01-17  1:06 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20080116204809.GA24595@mag.az.mvista.com>

On Wed, Jan 16, 2008 at 01:48:09PM -0700, Mark A. Greer wrote:
> On Wed, Jan 16, 2008 at 11:22:28AM +1100, David Gibson wrote:
> > On Tue, Jan 15, 2008 at 12:08:06PM -0700, Mark A. Greer wrote:
> > > On Tue, Jan 15, 2008 at 10:34:06AM +1100, David Gibson wrote:
> > > > On Mon, Jan 14, 2008 at 03:59:26PM -0700, Mark A. Greer wrote:
> > > > > From: Mark A. Greer <mgreer@mvista.com>
> > > 
> > > Hi David.  Thanks for the review.
> > > 
> > > > > Add DTS file for the Emerson Katana 750i & 752i platforms.
> > > > 
> > > > [snip]
> > > > > +/dts-v1/;
> > > > > +
> > > > > +/ {
> > > > > +	#address-cells = <1>;
> > > > > +	#size-cells = <1>;
> > > > > +	model = "Katana-75xi";	/* Default */
> > > > > +	compatible = "emerson,katana-750i";
> > > > > +	coherency-off;
> > > > 
> > > > Where is this flag used from?
> > > 
> > > Its used in the bootwrapper if & when you use the mv64x60 code to setup
> > > some of the windows to the I/O ctlrs.  This port does use that code
> > > (because firmware doesn't do it properly) so I need the flag.
> > 
> > Hrm.. ok.  I'm just wondering if a new flag is really the right
> > approach for this, or whether you should be basing the setup off the
> > compatible property, either for the board or for the main bridge.
> 
> I'd prefer to keep the flag.  Otherwise, the bootwrapper will need a
> table to look up the compatible field to see if coherency is supposed
> to be on or off.  We'd have to add an entry to that table for any
> compatible that need coherency off, etc.  A flag seems cleaner.

Hrm.  Except that you already have such a table in the cuboot file,
adding another flag to that wouldn't be hard.

What piece of hardware is it that actually determines whether
coherency works or not?  The CPU?  The bridge?

[snip]
> > > > > +		CUNIT: cunit@f200 {
> > > > 
> > > > What is this device?  It needs some sort of "compatible" value.
> > > 
> > > Does it?  Its a separate block of regs but its only used in the mpsc
> > > node--its never looked up on its own by kernel code.  Do all nodes need
> > > "compatible" even when it'll never be used?  (Just want to know.)
> > 
> > Hrm.. if it's really just extra mpsc registers, should it be a
> > seperate device, or just another range in the mpsc's "reg" property?
> 
> Okay, putting into the reg property makes sense.  Its values will be
> put into both mpsc@xxx 'reg' properties since its share.  That doesn't
> matter, correct?

Ah, sorry, I forgot there were multiple mpscs.  Their reg properties
certainly shouldn't overlap, so you will need a separate node.
However, you could combine your several nodes with MPSC common
registers into a single "mpsc-common" (or something) block.  That
would also reduce the number of phandles you need in the mpsc nodes,
too.

Or possibly this should be arranged as for the multiethernet.

> Also, would you mind letting it go thru as it is now and I'll make a
> separate patch to change this dts, the prpmc2800.dts, and related code
> afterwards?

Well, that's not really up to me.

[snip]
> > Yes :(.  I've looked at this before, though obviously I never got to
> > figuring out what to do about it.
> > 
> > > IMHO we need a way to change the default cmdline in the field so
> > > sysadmins can change it per board and not have to type it in every time
> > > they boot.  /chosen/bootargs and __builtin_cmdline can both do that.
> > > We don't need both, though.  And, since bootargs is specified by OF
> > > and documented in booting-without-of.txt, can we finally get rid of
> > > __builtin_cmdline?  I'd sure like to.
> > > 
> > > We can probably get rid of CONFIG_CMDLINE too since everyone uses DTs
> > > now and they can have a /chosen/bootargs.  Anyone have a reason to keep
> > > CONFIG_CMDLINE around?
> > > 
> > > Would you mind elaborating on why you are opposed to /chosen/bootargs?
> > 
> > Just because it's nasty for people to have to go in and change the dts
> > just to change their default command line - which they might well want
> > to do for things as simple as setting a default root device.
> 
> Yeah, but changing CONFIG_CMDLINE requires a kernel rebuild so
> that's not great either.  Modifying __builtin_cmdline is probably the
> easiest way to change things in the field (assuming you have a zImage)
> but its also the least standard way of the three. :(

But since the device tree is built into the zImage, changing it there
will also require a rebuild.  No difference from that PoV.  I'd really
suggest leaving this with CONFIG_CMDLINE just for similarity to other
platforms until we figure out how to clean up the commandline
confusion more generally.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH 1/3] 8xx: Analogue & Micro Adder875 board support.
From: Bryan O'Donoghue @ 2008-01-17  1:34 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <20080116091607.6aa76d11@kernel.crashing.org>

On Wed, 2008-01-16 at 09:16 +0300, Vitaly Bordug wrote:

Greetings Vitaly !

> On Tue, 15 Jan 2008 23:25:02 +0000
> Bryan O'Donoghue wrote:
> 
> > Greetings Scott.
> > 
> > I've tried both of the procedures you've outlined on the Adder875 with
> > the patches supplied against the paulus git tree to no avail.
> > 
> > Pass #1 :
> > 
> > Doing it safe with cuImage.8xx
> > 
> 
> [...]
> > => bootm 0x400000
> > ## Booting image at 00400000 ...
> >    Image Name:   Linux-2.6.24-rc6-g4f43143f-dirty
> >    Image Type:   PowerPC Linux Kernel Image (gzip compressed)
> >    Data Size:    1032266 Bytes = 1008.1 kB
> >    Load Address: 00400000
> >    Entry Point:  00400554
> >    Verifying Checksum ... OK
> >    Uncompressing Kernel Image ... OK
> > 
> > I haven't as yet tried to single step through the bootup process -
> > but, just to say that assuming the above procedure isn't _too_ far
> > wrong - the stuff posted to the list agains the tree you've
> > recommended doesn't seem to work..
> > 
> yes the sequence seems correct, so I'd check cmdline params, contents of chosen node in dts, etc to make sure stuff is being written to the proper UART with proper settings.

Indeed - thing is for the cuImage.8xx it's definitely _not_ something
simple like a UART not set at the expected baud rate.

Using an Adder875 booted from U-Boot and cuImage.8xx with a  a bdi2000
as a debugger - after the jump to kernel startup we don't even hit
start_kernel ! There's no question about it - for whatever reason the
cuImage.8xx for this board is definitely broken.

I've been doing some experiments in the last hour or so mapping vmlinux
to 0x400554 in gdb - since that's the entry point above - and setting an
instruction breakpoint to do some instruction stepping.

When I do that with cuImage.8xx I find that in kernel/head_8xx.S the
code dies before going into virtual memory mode - haven't nailed down
exactly where yet.

Point being if I boot a uImage + dtb

bootm 0x400000 - 0x500000 with a breakpoint set at start_kernel - then
the uImage + dtb version _will_ hit start_kernel - where we are in
virtual mode...

_something_ wierd is for sure wrong with the cuImage.8xx and
unfortunately it's not a simple as a silly baud rate.

> > 
> following the u-boot way (which is more correct imo) you'll need to add some code that fixes up frequencies and stuff inside dtb, or you may try to hardcode those values inside dts(if you know exactly what should be  there). Just adding CONFIG_*LIBFDT is not going to work.

I agree, makes sense to go with the flow of things tbh.

It still leaves as unanswered why exactly the ucImage.8xx kernel dies
suddenly before hitting start_kernel - whereas the uImage + dtb boy is
getting much further along in the boot.

I suppose I'll do some debug with the uImage - and try to see what else
it wants to complete the boot though, it'd be nice if the cuImage worked
so there'd be a safety net to use as a comparison to get the uImage +
dtb running properly.

^ permalink raw reply

* Re: [PATCH 4/4 v2] powerpc: Katana750i - Add platform support
From: David Gibson @ 2008-01-17  1:58 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20080116221210.GC7228@mag.az.mvista.com>

On Wed, Jan 16, 2008 at 03:12:10PM -0700, Mark A. Greer wrote:
> From: Mark A. Greer <mgreer@mvista.com>
> 
> Add support for the Emerson Katana 750i & 752i platforms.
> 
> Signed-off-by: Mark A. Greer <mgreer@mvista.com>
[snip]
> +typedef enum {
> +	BOARD_TYPE_750I,
> +	BOARD_TYPE_752I,
> +} katana750i_board_type;

This enum appears to be pointless.  You never use it as a type, and
there's no reason to explicitly give array indices for the
board_info[] array.

> +struct katana750i_board_info {
> +	char	cpld_prod_id;
> +	char	*model;
> +	char	*bridge_type;
> +};
> +
> +static struct katana750i_board_info katana750i_board_info[] = {
> +	[BOARD_TYPE_750I] = {
> +		.cpld_prod_id	= KATANA750I_PRODUCT_ID_750I,
> +		.model		= "Katana-750i",
> +		.bridge_type	= "mv64360",
> +	},
> +	[BOARD_TYPE_752I] = {
> +		.cpld_prod_id	= KATANA750I_PRODUCT_ID_752I,
> +		.model		= "Katana-752i",
> +		.bridge_type	= "mv64460",
> +	},
> +};
[...]

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH 3/4] powerpc: Katana750i - Add DTS file
From: Mark A. Greer @ 2008-01-17  2:28 UTC (permalink / raw)
  To: Mark A. Greer, linuxppc-dev
In-Reply-To: <20080117010634.GA11567@localhost.localdomain>

On Thu, Jan 17, 2008 at 12:06:34PM +1100, David Gibson wrote:
> On Wed, Jan 16, 2008 at 01:48:09PM -0700, Mark A. Greer wrote:
> > On Wed, Jan 16, 2008 at 11:22:28AM +1100, David Gibson wrote:
> > > On Tue, Jan 15, 2008 at 12:08:06PM -0700, Mark A. Greer wrote:
> > > > On Tue, Jan 15, 2008 at 10:34:06AM +1100, David Gibson wrote:
> > > > > On Mon, Jan 14, 2008 at 03:59:26PM -0700, Mark A. Greer wrote:
> > > > > > From: Mark A. Greer <mgreer@mvista.com>
> > > > 
> > > > Hi David.  Thanks for the review.
> > > > 
> > > > > > Add DTS file for the Emerson Katana 750i & 752i platforms.
> > > > > 
> > > > > [snip]
> > > > > > +/dts-v1/;
> > > > > > +
> > > > > > +/ {
> > > > > > +	#address-cells = <1>;
> > > > > > +	#size-cells = <1>;
> > > > > > +	model = "Katana-75xi";	/* Default */
> > > > > > +	compatible = "emerson,katana-750i";
> > > > > > +	coherency-off;
> > > > > 
> > > > > Where is this flag used from?
> > > > 
> > > > Its used in the bootwrapper if & when you use the mv64x60 code to setup
> > > > some of the windows to the I/O ctlrs.  This port does use that code
> > > > (because firmware doesn't do it properly) so I need the flag.
> > > 
> > > Hrm.. ok.  I'm just wondering if a new flag is really the right
> > > approach for this, or whether you should be basing the setup off the
> > > compatible property, either for the board or for the main bridge.
> > 
> > I'd prefer to keep the flag.  Otherwise, the bootwrapper will need a
> > table to look up the compatible field to see if coherency is supposed
> > to be on or off.  We'd have to add an entry to that table for any
> > compatible that need coherency off, etc.  A flag seems cleaner.
> 
> Hrm.  Except that you already have such a table in the cuboot file,
> adding another flag to that wouldn't be hard.
> 
> What piece of hardware is it that actually determines whether
> coherency works or not?  The CPU?  The bridge?

The bridge + the platform.  There's a hw erratum that some boards have
worked around and other haven't.

Spoze I can just code it in the cuboot file as you say.
I'll have to remove the sanity check in the kernel that ensures
that coherency-off & CONFIG_NOT_COHERENT_CACHE match.

> [snip]
> > > > > > +		CUNIT: cunit@f200 {
> > > > > 
> > > > > What is this device?  It needs some sort of "compatible" value.
> > > > 
> > > > Does it?  Its a separate block of regs but its only used in the mpsc
> > > > node--its never looked up on its own by kernel code.  Do all nodes need
> > > > "compatible" even when it'll never be used?  (Just want to know.)
> > > 
> > > Hrm.. if it's really just extra mpsc registers, should it be a
> > > seperate device, or just another range in the mpsc's "reg" property?
> > 
> > Okay, putting into the reg property makes sense.  Its values will be
> > put into both mpsc@xxx 'reg' properties since its share.  That doesn't
> > matter, correct?
> 
> Ah, sorry, I forgot there were multiple mpscs.  Their reg properties
> certainly shouldn't overlap, so you will need a separate node.

Okay.

> However, you could combine your several nodes with MPSC common
> registers into a single "mpsc-common" (or something) block.  That
> would also reduce the number of phandles you need in the mpsc nodes,
> too.

True, that will help.

> Or possibly this should be arranged as for the multiethernet.

Do you mean putting sdma/brg/... as subnodes of the mpsc node?
I remember debating this way back when.  IIRC, leaving them out seemed
like the right thing to do (tm).  If you think that's better, I can do
that.

> > Also, would you mind letting it go thru as it is now and I'll make a
> > separate patch to change this dts, the prpmc2800.dts, and related code
> > afterwards?
> 
> Well, that's not really up to me.

Yeah, but paulus is looing to you to monitor bootwrapper stuff so... :)

> [snip]
> > > Yes :(.  I've looked at this before, though obviously I never got to
> > > figuring out what to do about it.
> > > 
> > > > IMHO we need a way to change the default cmdline in the field so
> > > > sysadmins can change it per board and not have to type it in every time
> > > > they boot.  /chosen/bootargs and __builtin_cmdline can both do that.
> > > > We don't need both, though.  And, since bootargs is specified by OF
> > > > and documented in booting-without-of.txt, can we finally get rid of
> > > > __builtin_cmdline?  I'd sure like to.
> > > > 
> > > > We can probably get rid of CONFIG_CMDLINE too since everyone uses DTs
> > > > now and they can have a /chosen/bootargs.  Anyone have a reason to keep
> > > > CONFIG_CMDLINE around?
> > > > 
> > > > Would you mind elaborating on why you are opposed to /chosen/bootargs?
> > > 
> > > Just because it's nasty for people to have to go in and change the dts
> > > just to change their default command line - which they might well want
> > > to do for things as simple as setting a default root device.
> > 
> > Yeah, but changing CONFIG_CMDLINE requires a kernel rebuild so
> > that's not great either.  Modifying __builtin_cmdline is probably the
> > easiest way to change things in the field (assuming you have a zImage)
> > but its also the least standard way of the three. :(
> 
> But since the device tree is built into the zImage, changing it there
> will also require a rebuild.

Nope, you can run the wrapper script to change it without rebuilding the
kernel.  You just need the dts file and a working dtc (and the wrapper
script).  Goes back to paulus' original intent with the wrapper script.

> No difference from that PoV.  I'd really
> suggest leaving this with CONFIG_CMDLINE just for similarity to other
> platforms until we figure out how to clean up the commandline
> confusion more generally.

I think (hope) your opinion may change when you see my previous comment.

Mark

^ permalink raw reply

* Re: [PATCH 1/4] powerpc: mv64x60 - Use early_* PCI accessors for hotswap reg
From: Benjamin Herrenschmidt @ 2008-01-17  2:39 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20080117004744.GC1917@mag.az.mvista.com>


On Wed, 2008-01-16 at 17:47 -0700, Mark A. Greer wrote:
> On Thu, Jan 17, 2008 at 09:48:59AM +1100, Benjamin Herrenschmidt wrote:
> > 
> > On Mon, 2008-01-14 at 15:51 -0700, Mark A. Greer wrote:
> > > From: Mark A. Greer <mgreer@mvista.com>
> > > 
> > > The mv64x60 Hotswap register is on the first hose of the mv64x60
> > > hostbridge.  To access it, manually find the hose structure and
> > > use the early_* PCI accessor routines because the hostbridge is
> > > normally hidden.
> > 
> > Can't we unhide the NB instead ?
> 
> Hi Ben.
> 
> Possibly but it may cause issues since many hostbridge have BARs
> that don't comply with the PCI spec which may get hosed when scanning
> the PCI bus. 

True. But it's nice to be able to see their config space.

I tend to use a header quirk to blank the BARs of the host bridge in
those cases. But that does mean that the sizing operation is done on
them (writing ff's etc...) which might be an issue in your case (or
not).

Ben.

^ permalink raw reply

* Patches added to master/for-2.6.25 branch of powerpc.git
From: Paul Mackerras @ 2008-01-17  4:39 UTC (permalink / raw)
  To: linuxppc-dev

Includes commits pulled from Josh Boyer's tree.

Anton Vorontsov (1):
      [POWERPC] booting-without-of: localbus should not include board name

Cyrill Gorcunov (3):
      [POWERPC] Use for_each macros in arch/powerpc/sysdev
      [POWERPC] Use for_each macros in arch/powerpc/kernel
      [POWERPC] Use for_each macros in arch/powerpc/platforms/powermac

Geert Uytterhoeven (1):
      [POWERPC] Kill sparse warning in HPTE_V_COMPARE()

Grant Likely (4):
      [POWERPC] 4xx: typo in calling machine_device_initcall() for Sequoia board
      [POWERPC] Add of_find_matching_node() helper function
      [POWERPC] powermac: Use machine_*_initcall() hooks in platform code
      [POWERPC] cell: Use machine_*_initcall() hooks in platform code

Hollis Blanchard (1):
      [POWERPC] 4xx: enable built-in networking for Sequoia defconfig

Jochen Friedrich (1):
      [POWERPC] Update .gitignore files

Jon Loeliger (1):
      [POWERPC] Use <linux/of_{platform, device}.h> and not <asm/...> variants.

Jon Tollefson (1):
      [POWERPC] Add hugepagesz boot-time parameter

Mark A. Greer (1):
      [POWERPC] #address-cells & #size-cells properties are not inherited

Matthias Fuchs (1):
      [POWERPC] 4xx: Add 405GPr and 405EP support in boot wrapper

Stefan Roese (2):
      [POWERPC] 4xx: Add EMAC support to Kilauea defconfig
      [POWERPC] 4xx: PCIe: Increase max busses per port to 64

Stephen Neuendorffer (5):
      [POWERPC] Xilinx: update compatible list for interrupt controller
      [POWERPC] Xilinx: Add correct compatible list for device tree bus bindings.
      [POWERPC] Xilinx: Update booting-without-of.
      [POWERPC] Xilinx: updated device tree compatibility to match uboot bsp generator.
      [POWERPC] Xilinx uartlite: Section type fixups

Stephen Rothwell (10):
      [POWERPC] The pci_dn class_code is only used by EEH
      [POWERPC] The pci_dn pcidev is only used by EEH
      [POWERPC] iSeries: eliminate pci_dn bussubno
      [POWERPC] eeh.c: Use for_each_child_of_node
      [POWERPC] pci_32.c: Use for_each_child_of_node
      [POWERPC] therm_pm72: Suppress some compile warnings
      [POWERPC] arch/powerpc/kernel: Use for_each_child_of_node
      [POWERPC] therm_windtunnel: Eliminate some build warnings
      [POWERPC] therm_adt746x: Eliminate some build warnings
      [POWERPC] Check that the syscall table matches the syscall numbers

^ permalink raw reply

* [PATCH 0/2] Add crashdump shutdown hooks
From: Michael Neuling @ 2008-01-17  4:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, RAISCH, THEMANN
In-Reply-To: <1197539957.623622.326790809699.qpush@coopers>

The following patches add crashdump shutdown hooks for POWERPC.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
Updated for suggests made by Paulus

^ permalink raw reply

* [PATCH 1/2] Make setjmp/longjmp code generic
From: Michael Neuling @ 2008-01-17  4:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, RAISCH, THEMANN
In-Reply-To: <1200545142.37022.89292279731.qpush@coopers>

This makes the setjmp/longjmp code used by xmon, generically available
to other code.  It also removes the requirement for debugger hooks to
be only called on 0x300 (data storage) exception.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---

 arch/powerpc/kernel/misc.S   |   65 +++++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/mm/fault.c      |    6 +--
 arch/powerpc/xmon/setjmp.S   |   61 ----------------------------------------
 arch/powerpc/xmon/xmon.c     |    6 ---
 include/asm-powerpc/setjmp.h |   18 +++++++++++
 5 files changed, 86 insertions(+), 70 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/misc.S
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/misc.S
+++ linux-2.6-ozlabs/arch/powerpc/kernel/misc.S
@@ -8,6 +8,8 @@
  * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
  * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
  *
+ * setjmp/longjmp and xmon_save_regs code by Paul Mackerras.
+ *
  * 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
@@ -15,6 +17,8 @@
  */
 #include <asm/ppc_asm.h>
 #include <asm/unistd.h>
+#include <asm/asm-compat.h>
+#include <asm/asm-offsets.h>
 
 	.text
 
@@ -51,3 +55,64 @@ _GLOBAL(kernel_execve)
 	bnslr
 	neg	r3,r3
 	blr
+
+_GLOBAL(setjmp)
+	mflr	r0
+	PPC_STL	r0,0(r3)
+	PPC_STL	r1,SZL(r3)
+	PPC_STL	r2,2*SZL(r3)
+	mfcr	r0
+	PPC_STL	r0,3*SZL(r3)
+	PPC_STL	r13,4*SZL(r3)
+	PPC_STL	r14,5*SZL(r3)
+	PPC_STL	r15,6*SZL(r3)
+	PPC_STL	r16,7*SZL(r3)
+	PPC_STL	r17,8*SZL(r3)
+	PPC_STL	r18,9*SZL(r3)
+	PPC_STL	r19,10*SZL(r3)
+	PPC_STL	r20,11*SZL(r3)
+	PPC_STL	r21,12*SZL(r3)
+	PPC_STL	r22,13*SZL(r3)
+	PPC_STL	r23,14*SZL(r3)
+	PPC_STL	r24,15*SZL(r3)
+	PPC_STL	r25,16*SZL(r3)
+	PPC_STL	r26,17*SZL(r3)
+	PPC_STL	r27,18*SZL(r3)
+	PPC_STL	r28,19*SZL(r3)
+	PPC_STL	r29,20*SZL(r3)
+	PPC_STL	r30,21*SZL(r3)
+	PPC_STL	r31,22*SZL(r3)
+	li	r3,0
+	blr
+
+_GLOBAL(longjmp)
+	PPC_LCMPI r4,0
+	bne	1f
+	li	r4,1
+1:	PPC_LL	r13,4*SZL(r3)
+	PPC_LL	r14,5*SZL(r3)
+	PPC_LL	r15,6*SZL(r3)
+	PPC_LL	r16,7*SZL(r3)
+	PPC_LL	r17,8*SZL(r3)
+	PPC_LL	r18,9*SZL(r3)
+	PPC_LL	r19,10*SZL(r3)
+	PPC_LL	r20,11*SZL(r3)
+	PPC_LL	r21,12*SZL(r3)
+	PPC_LL	r22,13*SZL(r3)
+	PPC_LL	r23,14*SZL(r3)
+	PPC_LL	r24,15*SZL(r3)
+	PPC_LL	r25,16*SZL(r3)
+	PPC_LL	r26,17*SZL(r3)
+	PPC_LL	r27,18*SZL(r3)
+	PPC_LL	r28,19*SZL(r3)
+	PPC_LL	r29,20*SZL(r3)
+	PPC_LL	r30,21*SZL(r3)
+	PPC_LL	r31,22*SZL(r3)
+	PPC_LL	r0,3*SZL(r3)
+	mtcrf	0x38,r0
+	PPC_LL	r0,0(r3)
+	PPC_LL	r1,SZL(r3)
+	PPC_LL	r2,2*SZL(r3)
+	mtlr	r0
+	mr	r3,r4
+	blr
Index: linux-2.6-ozlabs/arch/powerpc/mm/fault.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/mm/fault.c
+++ linux-2.6-ozlabs/arch/powerpc/mm/fault.c
@@ -167,10 +167,8 @@ int __kprobes do_page_fault(struct pt_re
 	if (notify_page_fault(regs))
 		return 0;
 
-	if (trap == 0x300) {
-		if (debugger_fault_handler(regs))
-			return 0;
-	}
+	if (unlikely(debugger_fault_handler(regs)))
+		return 0;
 
 	/* On a kernel SLB miss we can only check for a valid exception entry */
 	if (!user_mode(regs) && (address >= TASK_SIZE))
Index: linux-2.6-ozlabs/arch/powerpc/xmon/setjmp.S
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/xmon/setjmp.S
+++ linux-2.6-ozlabs/arch/powerpc/xmon/setjmp.S
@@ -12,67 +12,6 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
-_GLOBAL(xmon_setjmp)
-	mflr	r0
-	PPC_STL	r0,0(r3)
-	PPC_STL	r1,SZL(r3)
-	PPC_STL	r2,2*SZL(r3)
-	mfcr	r0
-	PPC_STL	r0,3*SZL(r3)
-	PPC_STL	r13,4*SZL(r3)
-	PPC_STL	r14,5*SZL(r3)
-	PPC_STL	r15,6*SZL(r3)
-	PPC_STL	r16,7*SZL(r3)
-	PPC_STL	r17,8*SZL(r3)
-	PPC_STL	r18,9*SZL(r3)
-	PPC_STL	r19,10*SZL(r3)
-	PPC_STL	r20,11*SZL(r3)
-	PPC_STL	r21,12*SZL(r3)
-	PPC_STL	r22,13*SZL(r3)
-	PPC_STL	r23,14*SZL(r3)
-	PPC_STL	r24,15*SZL(r3)
-	PPC_STL	r25,16*SZL(r3)
-	PPC_STL	r26,17*SZL(r3)
-	PPC_STL	r27,18*SZL(r3)
-	PPC_STL	r28,19*SZL(r3)
-	PPC_STL	r29,20*SZL(r3)
-	PPC_STL	r30,21*SZL(r3)
-	PPC_STL	r31,22*SZL(r3)
-	li	r3,0
-	blr
-
-_GLOBAL(xmon_longjmp)
-	PPC_LCMPI r4,0
-	bne	1f
-	li	r4,1
-1:	PPC_LL	r13,4*SZL(r3)
-	PPC_LL	r14,5*SZL(r3)
-	PPC_LL	r15,6*SZL(r3)
-	PPC_LL	r16,7*SZL(r3)
-	PPC_LL	r17,8*SZL(r3)
-	PPC_LL	r18,9*SZL(r3)
-	PPC_LL	r19,10*SZL(r3)
-	PPC_LL	r20,11*SZL(r3)
-	PPC_LL	r21,12*SZL(r3)
-	PPC_LL	r22,13*SZL(r3)
-	PPC_LL	r23,14*SZL(r3)
-	PPC_LL	r24,15*SZL(r3)
-	PPC_LL	r25,16*SZL(r3)
-	PPC_LL	r26,17*SZL(r3)
-	PPC_LL	r27,18*SZL(r3)
-	PPC_LL	r28,19*SZL(r3)
-	PPC_LL	r29,20*SZL(r3)
-	PPC_LL	r30,21*SZL(r3)
-	PPC_LL	r31,22*SZL(r3)
-	PPC_LL	r0,3*SZL(r3)
-	mtcrf	0x38,r0
-	PPC_LL	r0,0(r3)
-	PPC_LL	r1,SZL(r3)
-	PPC_LL	r2,2*SZL(r3)
-	mtlr	r0
-	mr	r3,r4
-	blr
-
 /*
  * Grab the register values as they are now.
  * This won't do a particularily good job because we really
Index: linux-2.6-ozlabs/arch/powerpc/xmon/xmon.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/xmon/xmon.c
+++ linux-2.6-ozlabs/arch/powerpc/xmon/xmon.c
@@ -40,6 +40,7 @@
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
 #include <asm/firmware.h>
+#include <asm/setjmp.h>
 
 #ifdef CONFIG_PPC64
 #include <asm/hvcall.h>
@@ -71,12 +72,9 @@ static unsigned long ncsum = 4096;
 static int termch;
 static char tmpstr[128];
 
-#define JMP_BUF_LEN	23
 static long bus_error_jmp[JMP_BUF_LEN];
 static int catch_memory_errors;
 static long *xmon_fault_jmp[NR_CPUS];
-#define setjmp xmon_setjmp
-#define longjmp xmon_longjmp
 
 /* Breakpoint stuff */
 struct bpt {
@@ -162,8 +160,6 @@ int xmon_no_auto_backtrace;
 extern void xmon_enter(void);
 extern void xmon_leave(void);
 
-extern long setjmp(long *);
-extern void longjmp(long *, long);
 extern void xmon_save_regs(struct pt_regs *);
 
 #ifdef CONFIG_PPC64
Index: linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
===================================================================
--- /dev/null
+++ linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2007 Michael Neuling
+ *
+ *      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.
+ *
+ */
+#ifndef _ASM_POWERPC_SETJMP_H
+#define _ASM_POWERPC_SETJMP_H
+
+#define JMP_BUF_LEN    23
+
+extern long setjmp(long *);
+extern void longjmp(long *, long);
+
+#endif /* _ASM_POWERPC_SETJMP_H */

^ permalink raw reply

* [PATCH 2/2] kdump shutdown hook support
From: Michael Neuling @ 2008-01-17  4:45 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, RAISCH, THEMANN
In-Reply-To: <1200545142.37022.89292279731.qpush@coopers>

This adds hooks into the default_machine_crash_shutdown so drivers can
register a function to be run in the first kernel before we hand off
to the second kernel.  This should only be used in exceptional
circumstances, like where the device can't be reset in the second
kernel alone (as is the case with eHEA).  To emphasize this, the
number of handles allowed to be registered is currently #def to 1.

This uses the setjmp/longjmp code to call out to the registered hooks,
so any bogus exceptions we encounter will hopefully be recoverable.  

Tested with bogus data and instruction exceptions.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---

 arch/powerpc/kernel/crash.c |  106 +++++++++++++++++++++++++++++++++++++++++---
 include/asm-powerpc/kexec.h |    3 +
 2 files changed, 104 insertions(+), 5 deletions(-)

Index: linux-2.6-ozlabs/arch/powerpc/kernel/crash.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/crash.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/crash.c
@@ -32,6 +32,8 @@
 #include <asm/lmb.h>
 #include <asm/firmware.h>
 #include <asm/smp.h>
+#include <asm/system.h>
+#include <asm/setjmp.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
@@ -45,6 +47,11 @@ int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 cpumask_t cpus_in_sr = CPU_MASK_NONE;
 
+#define CRASH_HANDLER_MAX 1
+/* NULL terminated list of shutdown handles */
+static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
+static DEFINE_SPINLOCK(crash_handlers_lock);
+
 #ifdef CONFIG_SMP
 static atomic_t enter_on_soft_reset = ATOMIC_INIT(0);
 
@@ -285,9 +292,72 @@ static inline void crash_kexec_stop_spus
 }
 #endif /* CONFIG_SPU_BASE */
 
+/*
+ * Register a function to be called on shutdown.  Only use this if you
+ * can't reset your device in the second kernel.
+ */
+int crash_shutdown_register(crash_shutdown_t handler)
+{
+	unsigned int i, rc;
+
+	spin_lock(&crash_handlers_lock);
+	for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
+		if (!crash_shutdown_handles[i]) {
+			/* Insert handle at first empty entry */
+			crash_shutdown_handles[i] = handler;
+			rc = 0;
+			break;
+		}
+
+	if (i == CRASH_HANDLER_MAX) {
+		printk(KERN_ERR "Crash shutdown handles full, "
+		       "not registered.\n");
+		rc = 1;
+	}
+
+	spin_unlock(&crash_handlers_lock);
+	return rc;
+}
+EXPORT_SYMBOL(crash_shutdown_register);
+
+int crash_shutdown_unregister(crash_shutdown_t handler)
+{
+	unsigned int i, rc;
+
+	spin_lock(&crash_handlers_lock);
+	for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
+		if (crash_shutdown_handles[i] == handler)
+			break;
+
+	if (i == CRASH_HANDLER_MAX) {
+		printk(KERN_ERR "Crash shutdown handle not found\n");
+		rc = 1;
+	} else {
+		/* Shift handles down */
+		for (; crash_shutdown_handles[i]; i++)
+			crash_shutdown_handles[i] =
+				crash_shutdown_handles[i+1];
+		rc = 0;
+	}
+
+	spin_unlock(&crash_handlers_lock);
+	return rc;
+}
+EXPORT_SYMBOL(crash_shutdown_unregister);
+
+static unsigned long crash_shutdown_buf[JMP_BUF_LEN];
+
+static int handle_fault(struct pt_regs *regs)
+{
+	longjmp(crash_shutdown_buf, 1);
+	return 0;
+}
+
 void default_machine_crash_shutdown(struct pt_regs *regs)
 {
-	unsigned int irq;
+	unsigned int i;
+	int (*old_handler)(struct pt_regs *regs);
+
 
 	/*
 	 * This function is only called after the system
@@ -301,15 +371,41 @@ void default_machine_crash_shutdown(stru
 	 */
 	hard_irq_disable();
 
-	for_each_irq(irq) {
-		struct irq_desc *desc = irq_desc + irq;
+	for_each_irq(i) {
+		struct irq_desc *desc = irq_desc + i;
 
 		if (desc->status & IRQ_INPROGRESS)
-			desc->chip->eoi(irq);
+			desc->chip->eoi(i);
 
 		if (!(desc->status & IRQ_DISABLED))
-			desc->chip->disable(irq);
+			desc->chip->disable(i);
+	}
+
+	/*
+	 * Call registered shutdown routines savely.  Swap out
+	 * __debugger_fault_handler, and replace on exit.
+	 */
+	old_handler = __debugger_fault_handler;
+	__debugger_fault_handler = handle_fault;
+	for (i = 0; crash_shutdown_handles[i]; i++) {
+		if (setjmp(crash_shutdown_buf) == 0) {
+			/*
+			 * Insert syncs and delay to ensure
+			 * instructions in the dangerous region don't
+			 * leak away from this protected region.
+			 */
+			asm volatile("sync; isync");
+			/* dangerous region */
+			crash_shutdown_handles[i]();
+			asm volatile("sync; isync");
+			/* 
+			 * wait a little while to see if we get a
+			 * machine check 
+			 */
+			__delay(200);
+		}
 	}
+	__debugger_fault_handler = old_handler;
 
 	/*
 	 * Make a note of crashing cpu. Will be used in machine_kexec
Index: linux-2.6-ozlabs/include/asm-powerpc/kexec.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/kexec.h
+++ linux-2.6-ozlabs/include/asm-powerpc/kexec.h
@@ -123,6 +123,9 @@ struct pt_regs;
 extern void default_machine_kexec(struct kimage *image);
 extern int default_machine_kexec_prepare(struct kimage *image);
 extern void default_machine_crash_shutdown(struct pt_regs *regs);
+typedef void (*crash_shutdown_t)(void);
+extern int crash_shutdown_register(crash_shutdown_t handler);
+extern int crash_shutdown_unregister(crash_shutdown_t handler);
 
 extern void machine_kexec_simple(struct kimage *image);
 extern void crash_kexec_secondary(struct pt_regs *regs);

^ permalink raw reply

* Re: Patches added to master/for-2.6.25 branch of powerpc.git
From: Olof Johansson @ 2008-01-17  4:58 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <18318.56299.476711.644917@cargo.ozlabs.ibm.com>

Hi,

On Thu, Jan 17, 2008 at 03:39:07PM +1100, Paul Mackerras wrote:
> Includes commits pulled from Josh Boyer's tree.

Any reason for why you didn't pull from mine?


Thanks,

-Olof

^ permalink raw reply

* Re: [libfdt] RFC: Node iterators (v2)
From: David Gibson @ 2008-01-17  5:10 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, jdl
In-Reply-To: <20080116062022.GD5016@localhost.localdomain>

On Wed, Jan 16, 2008 at 05:20:22PM +1100, David Gibson wrote:
> Here's my counter-attempt at node iterators for libfdt.  It's based on
> an internal function very similar to Scott's fdt_next_node(), but the
> exported interfaces are altered to be (IMO) safer and simpler.
> 
> So far, it only handles iterating across immediate children of a node,
> not traversing an entire subtree.  I'm still working on extending the
> internals to cover that case.  No property iteration as yet, either.

And here's a revised version.  This now also handles recursive
iteration and iteration across nodes without respect to depth.  I've
removed the for_each() macros for the time being, because they were
making my brain hurt, but I'm still contemplating bringing them back.
Several libfdt functions are now implemented using the new iterator,
so this ends up as a code-size-reducing patch.

I'm pretty happy with the basic outline of this now, although the
names and details might want a bit of polish still.

Index: dtc/libfdt/fdt_ro.c
===================================================================
--- dtc.orig/libfdt/fdt_ro.c	2008-01-17 11:53:56.000000000 +1100
+++ dtc/libfdt/fdt_ro.c	2008-01-17 15:46:04.000000000 +1100
@@ -65,7 +65,7 @@
 static int nodename_eq(const void *fdt, int offset,
 		       const char *s, int len)
 {
-	const char *p = fdt_offset_ptr(fdt, offset, len+1);
+	const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1);
 
 	if (! p)
 		/* short match */
@@ -104,50 +104,24 @@ int fdt_num_mem_rsv(const void *fdt)
 	return i;
 }
 
-int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
+int fdt_subnode_offset_namelen(const void *fdt, int offset,
 			       const char *name, int namelen)
 {
-	int level = 0;
-	uint32_t tag;
-	int offset, nextoffset;
+	int depth;
 
 	CHECK_HEADER(fdt);
 
-	tag = fdt_next_tag(fdt, parentoffset, &nextoffset);
-	if (tag != FDT_BEGIN_NODE)
-		return -FDT_ERR_BADOFFSET;
-
-	do {
-		offset = nextoffset;
-		tag = fdt_next_tag(fdt, offset, &nextoffset);
-
-		switch (tag) {
-		case FDT_END:
-			return -FDT_ERR_TRUNCATED;
-
-		case FDT_BEGIN_NODE:
-			level++;
-			if (level != 1)
-				continue;
-			if (nodename_eq(fdt, offset+FDT_TAGSIZE, name, namelen))
-				/* Found it! */
-				return offset;
-			break;
-
-		case FDT_END_NODE:
-			level--;
-			break;
-
-		case FDT_PROP:
-		case FDT_NOP:
-			break;
-
-		default:
-			return -FDT_ERR_BADSTRUCTURE;
-		}
-	} while (level >= 0);
+	for (depth = 0;
+	     offset >= 0;
+	     offset = _fdt_next_node(fdt, offset, &depth)) {
+		if (depth < 0)
+			return -FDT_ERR_NOTFOUND;
+		else if ((depth == 1)
+			 && nodename_eq(fdt, offset, name, namelen))
+			return offset;
+	}
 
-	return -FDT_ERR_NOTFOUND;
+	return offset; /* error */
 }
 
 int fdt_subnode_offset(const void *fdt, int parentoffset,
@@ -307,76 +281,61 @@ uint32_t fdt_get_phandle(const void *fdt
 
 int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen)
 {
-	uint32_t tag;
-	int p = 0, overflow = 0;
-	int offset, nextoffset, namelen;
+	int pdepth = 0, p = 0;
+	int offset, depth, namelen;
 	const char *name;
 
 	CHECK_HEADER(fdt);
 
-	tag = fdt_next_tag(fdt, 0, &nextoffset);
-	if (tag != FDT_BEGIN_NODE)
-		return -FDT_ERR_BADSTRUCTURE;
-
 	if (buflen < 2)
 		return -FDT_ERR_NOSPACE;
-	buf[0] = '/';
-	p = 1;
 
-	while (nextoffset <= nodeoffset) {
-		offset = nextoffset;
-		tag = fdt_next_tag(fdt, offset, &nextoffset);
-		switch (tag) {
-		case FDT_END:
-			return -FDT_ERR_BADOFFSET;
+	for (offset = 0, depth = 0;
+	     (offset >= 0) && (offset <= nodeoffset);
+	     offset = _fdt_next_node(fdt, offset, &depth)) {
+		if (pdepth < depth)
+			continue; /* overflowed buffer */
 
-		case FDT_BEGIN_NODE:
-			name = fdt_get_name(fdt, offset, &namelen);
-			if (!name)
-				return namelen;
-			if (overflow || ((p + namelen + 1) > buflen)) {
-				overflow++;
-				break;
-			}
+		while (pdepth > depth) {
+			do {
+				p--;
+			} while (buf[p-1] != '/');
+			pdepth--;
+		}
+
+		name = fdt_get_name(fdt, offset, &namelen);
+		if (!name)
+			return namelen;
+		if ((p + namelen + 1) <= buflen) {
 			memcpy(buf + p, name, namelen);
 			p += namelen;
 			buf[p++] = '/';
-			break;
-
-		case FDT_END_NODE:
-			if (overflow) {
-				overflow--;
-				break;
-			}
-			do {
-				p--;
-			} while  (buf[p-1] != '/');
-			break;
+			pdepth++;
+		}
 
-		case FDT_PROP:
-		case FDT_NOP:
-			break;
+		if (offset == nodeoffset) {
+			if (pdepth < (depth + 1))
+				return -FDT_ERR_NOSPACE;
 
-		default:
-			return -FDT_ERR_BADSTRUCTURE;
+			if (p > 1) /* special case so that root path is "/", not "" */
+				p--;
+			buf[p] = '\0';
+			return p;
 		}
 	}
 
-	if (overflow)
-		return -FDT_ERR_NOSPACE;
+	if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
+		return -FDT_ERR_BADOFFSET;
+	else if (offset == -FDT_ERR_BADOFFSET)
+		return -FDT_ERR_BADSTRUCTURE;
 
-	if (p > 1) /* special case so that root path is "/", not "" */
-		p--;
-	buf[p] = '\0';
-	return p;
+	return offset; /* error from _fdt_next_node() */
 }
 
 int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset,
 				 int supernodedepth, int *nodedepth)
 {
-	int level = -1;
-	uint32_t tag;
-	int offset, nextoffset = 0;
+	int offset, depth;
 	int supernodeoffset = -FDT_ERR_INTERNAL;
 
 	CHECK_HEADER(fdt);
@@ -384,38 +343,29 @@ int fdt_supernode_atdepth_offset(const v
 	if (supernodedepth < 0)
 		return -FDT_ERR_NOTFOUND;
 
-	do {
-		offset = nextoffset;
-		tag = fdt_next_tag(fdt, offset, &nextoffset);
-		switch (tag) {
-		case FDT_END:
-			return -FDT_ERR_BADOFFSET;
-
-		case FDT_BEGIN_NODE:
-			level++;
-			if (level == supernodedepth)
-				supernodeoffset = offset;
-			break;
-
-		case FDT_END_NODE:
-			level--;
-			break;
-
-		case FDT_PROP:
-		case FDT_NOP:
-			break;
-
-		default:
-			return -FDT_ERR_BADSTRUCTURE;
+	for (offset = 0, depth = 0;
+	     (offset >= 0) && (offset <= nodeoffset);
+	     offset = _fdt_next_node(fdt, offset, &depth)) {
+		if (depth == supernodedepth)
+			supernodeoffset = offset;
+
+		if (offset == nodeoffset) {
+			if (nodedepth)
+				*nodedepth = depth;
+
+			if (supernodedepth > depth)
+				return -FDT_ERR_NOTFOUND;
+			else
+				return supernodeoffset;
 		}
-	} while (offset < nodeoffset);
+	}
 
-	if (nodedepth)
-		*nodedepth = level;
+	if ((offset == -FDT_ERR_NOTFOUND) || (offset >= 0))
+		return -FDT_ERR_BADOFFSET;
+	else if (offset == -FDT_ERR_BADOFFSET)
+		return -FDT_ERR_BADSTRUCTURE;
 
-	if (supernodedepth > level)
-		return -FDT_ERR_NOTFOUND;
-	return supernodeoffset;
+	return offset; /* error from _fdt_next_node() */
 }
 
 int fdt_node_depth(const void *fdt, int nodeoffset)
@@ -443,51 +393,27 @@ int fdt_node_offset_by_prop_value(const 
 				  const char *propname,
 				  const void *propval, int proplen)
 {
-	uint32_t tag;
-	int offset, nextoffset;
+	int offset;
 	const void *val;
 	int len;
 
 	CHECK_HEADER(fdt);
 
-	if (startoffset >= 0) {
-		tag = fdt_next_tag(fdt, startoffset, &nextoffset);
-		if (tag != FDT_BEGIN_NODE)
-			return -FDT_ERR_BADOFFSET;
-	} else {
-		nextoffset = 0;
-	}
-
 	/* FIXME: The algorithm here is pretty horrible: we scan each
 	 * property of a node in fdt_getprop(), then if that didn't
 	 * find what we want, we scan over them again making our way
 	 * to the next node.  Still it's the easiest to implement
 	 * approach; performance can come later. */
-	do {
-		offset = nextoffset;
-		tag = fdt_next_tag(fdt, offset, &nextoffset);
-
-		switch (tag) {
-		case FDT_BEGIN_NODE:
-			val = fdt_getprop(fdt, offset, propname, &len);
-			if (val
-			    && (len == proplen)
-			    && (memcmp(val, propval, len) == 0))
-				return offset;
-			break;
-
-		case FDT_PROP:
-		case FDT_END:
-		case FDT_END_NODE:
-		case FDT_NOP:
-			break;
-
-		default:
-			return -FDT_ERR_BADSTRUCTURE;
-		}
-	} while (tag != FDT_END);
+	for (offset = _fdt_next_node(fdt, startoffset, NULL);
+	     offset >= 0;
+	     offset = _fdt_next_node(fdt, offset, NULL)) {
+		val = fdt_getprop(fdt, offset, propname, &len);
+		if (val && (len == proplen)
+		    && (memcmp(val, propval, len) == 0))
+			return offset;
+	}
 
-	return -FDT_ERR_NOTFOUND;
+	return offset; /* error from _fdt_next_node() */
 }
 
 int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle)
@@ -553,31 +479,15 @@ int fdt_node_offset_by_compatible(const 
 	 * that didn't find what we want, we scan over them again
 	 * making our way to the next node.  Still it's the easiest to
 	 * implement approach; performance can come later. */
-	do {
-		offset = nextoffset;
-		tag = fdt_next_tag(fdt, offset, &nextoffset);
-
-		switch (tag) {
-		case FDT_BEGIN_NODE:
-			err = fdt_node_check_compatible(fdt, offset,
-							compatible);
-			if ((err < 0)
-			    && (err != -FDT_ERR_NOTFOUND))
-				return err;
-			else if (err == 0)
-				return offset;
-			break;
-
-		case FDT_PROP:
-		case FDT_END:
-		case FDT_END_NODE:
-		case FDT_NOP:
-			break;
-
-		default:
-			return -FDT_ERR_BADSTRUCTURE;
-		}
-	} while (tag != FDT_END);
+	for (offset = _fdt_next_node(fdt, startoffset, NULL);
+	     offset >= 0;
+	     offset = _fdt_next_node(fdt, offset, NULL)) {
+		err = fdt_node_check_compatible(fdt, offset, compatible);
+		if ((err < 0) && (err != -FDT_ERR_NOTFOUND))
+			return err;
+		else if (err == 0)
+			return offset;
+	}
 
-	return -FDT_ERR_NOTFOUND;
+	return offset; /* error from _fdt_next_node() */
 }
Index: dtc/libfdt/fdt.c
===================================================================
--- dtc.orig/libfdt/fdt.c	2008-01-17 11:53:56.000000000 +1100
+++ dtc/libfdt/fdt.c	2008-01-17 14:57:23.000000000 +1100
@@ -129,6 +129,47 @@ uint32_t fdt_next_tag(const void *fdt, i
 	return tag;
 }
 
+int _fdt_next_node(const void *fdt, int offset, int *depth)
+{
+	int nextoffset = 0;
+	uint32_t tag;
+
+	if (offset >= 0) {
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+		if (tag != FDT_BEGIN_NODE)
+			return -FDT_ERR_BADOFFSET;
+	}
+
+	do {
+		offset = nextoffset;
+		tag = fdt_next_tag(fdt, offset, &nextoffset);
+
+		switch (tag) {
+		case FDT_PROP:
+		case FDT_NOP:
+			break;
+
+		case FDT_BEGIN_NODE:
+			if (depth)
+				(*depth)++;
+			break;
+
+		case FDT_END_NODE:
+			if (depth)
+				(*depth)--;
+			break;
+
+		case FDT_END:
+			return -FDT_ERR_NOTFOUND;
+
+		default:
+			return -FDT_ERR_BADSTRUCTURE;
+		}
+	} while (tag != FDT_BEGIN_NODE);
+
+	return offset;
+}
+
 const char *_fdt_find_string(const char *strtab, int tabsize, const char *s)
 {
 	int len = strlen(s) + 1;
Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h	2008-01-17 11:53:56.000000000 +1100
+++ dtc/libfdt/libfdt.h	2008-01-17 15:05:11.000000000 +1100
@@ -131,6 +131,12 @@ static inline void *fdt_offset_ptr_w(voi
 uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
 
 /**********************************************************************/
+/* Traversal functions                                                */
+/**********************************************************************/
+
+int _fdt_next_node(const void *fdt, int offset, int *depth);
+
+/**********************************************************************/
 /* General functions                                                  */
 /**********************************************************************/
 


-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: Patches added to master/for-2.6.25 branch of powerpc.git
From: Paul Mackerras @ 2008-01-17  5:25 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev
In-Reply-To: <20080117045856.GA26617@lixom.net>

Olof Johansson writes:

> Any reason for why you didn't pull from mine?

Sorry, just an oversight.  Pulled and pushed out now.

Paul.

^ permalink raw reply

* Re: [PATCH 1/2] Make setjmp/longjmp code generic
From: Olof Johansson @ 2008-01-17  5:38 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev, RAISCH, Paul Mackerras, THEMANN
In-Reply-To: <20080117044542.2F6CD70006@localhost.localdomain>

Hi,

On Thu, Jan 17, 2008 at 03:45:42PM +1100, Michael Neuling wrote:

> Index: linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
> ===================================================================
> --- /dev/null
> +++ linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
> @@ -0,0 +1,18 @@
> +/*
> + * Copyright (C) 2007 Michael Neuling
> + *
> + *      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.
> + *
> + */
> +#ifndef _ASM_POWERPC_SETJMP_H
> +#define _ASM_POWERPC_SETJMP_H
> +
> +#define JMP_BUF_LEN    23
> +
> +extern long setjmp(long *);
> +extern void longjmp(long *, long);
> +
> +#endif /* _ASM_POWERPC_SETJMP_H */

Should the above be inside #ifdef __KERNEL__?


-Olof

^ permalink raw reply

* Re: [PATCH 1/2] Make setjmp/longjmp code generic
From: Michael Neuling @ 2008-01-17  5:36 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, RAISCH, Paul Mackerras, THEMANN
In-Reply-To: <20080117053857.GA29035@lixom.net>



In message <20080117053857.GA29035@lixom.net> you wrote:
> Hi,
> 
> On Thu, Jan 17, 2008 at 03:45:42PM +1100, Michael Neuling wrote:
> 
> > Index: linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
> > ===================================================================
> > --- /dev/null
> > +++ linux-2.6-ozlabs/include/asm-powerpc/setjmp.h
> > @@ -0,0 +1,18 @@
> > +/*
> > + * Copyright (C) 2007 Michael Neuling
                     ^^^^^^

> > + *
> > + *      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.
> > + *
> > + */
> > +#ifndef _ASM_POWERPC_SETJMP_H
> > +#define _ASM_POWERPC_SETJMP_H
> > +
> > +#define JMP_BUF_LEN    23
> > +
> > +extern long setjmp(long *);
> > +extern void longjmp(long *, long);
> > +
> > +#endif /* _ASM_POWERPC_SETJMP_H */
> 
> Should the above be inside #ifdef __KERNEL__?

Yep... _and_ it's 2008 now!

I'll update.

Mikey

^ permalink raw reply

* Endian problem when accessing internel regs on 8347
From: Bruce_Leonard @ 2008-01-17  6:26 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,

I've got an MPC8347 running the 2.6.24-rc5 kernel and I'm trying to access 
the GPIO registers.  I already have a driver that's doing related work 
(tho across PCI) and I just want to remap the internal CPU address to a 
kernal address and be able to read/write the register using an IOCTL call 
from user space.  My problem is, every accessor I try does an endian 
conversion before giving me my data.  So here's some code snipits of what 
I'm doing:

request_mem_region(0xe0000c00, 24, "my driver");  // 0xe0000c00 is the 
memory mapped location of the GPIO regs
data_ptr2 = ioremap(0xe0000c00, 24);

Then in the IOCTL function I try to read from the register.  First I 
tried:

ioread32(data_ptr2);

I know that the mapping is working okay because I got the data from the 
GPIO direction register, but it's been byte swapped.  The contents of the 
register are 0xFFFFFFE7, but what my user space app gets back is 
0xE7FFFFFF.  I've tried all the varients I can find, readl(), inl(), 
in_be32(), in_le32(), even __raw_readl().  They all give me back byte 
swapped data.  I'm very confused.  Especially since I've looked at 
in_be32() and in_le32(), they're both inline assembly, and they use 
different instructions.  They can't be giving me the same results.  I'm 
sure I'm not the first person to want to access PowerPC internal registers 
through a driver.  Can anyone give me a hint what I'm doing wrong?

As an additional question related to PowerPC inline assembly, can anyone 
tell me what "%U1%X1" means in the following:

__asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync" : "=r" (ret) : 
"m" (*addr));

Thanks.

See 'ya!

Bruce

^ permalink raw reply

* Re: [PATCH 1/2] Make setjmp/longjmp code generic
From: Stephen Rothwell @ 2008-01-17  6:36 UTC (permalink / raw)
  To: Michael Neuling
  Cc: Olof Johansson, linuxppc-dev, RAISCH, Paul Mackerras, THEMANN
In-Reply-To: <15983.1200548209@neuling.org>

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

On Thu, 17 Jan 2008 16:36:49 +1100 Michael Neuling <mikey@neuling.org> wrote:
>
> > 
> > Should the above be inside #ifdef __KERNEL__?
> 
> Yep... _and_ it's 2008 now!

I think that if you don't list the file for exporting to user mode (in
the Kbuild file), then you shouldn't need the __KERNEL__ protectors.

But it is, indeed, 2008. :-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH 1/2] Make setjmp/longjmp code generic
From: Stephen Rothwell @ 2008-01-17  6:39 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev, RAISCH, Paul Mackerras, THEMANN
In-Reply-To: <20080117044542.2F6CD70006@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 527 bytes --]

On Thu, 17 Jan 2008 15:45:42 +1100 Michael Neuling <mikey@neuling.org> wrote:
>
> +++ linux-2.6-ozlabs/arch/powerpc/kernel/misc.S
> @@ -8,6 +8,8 @@
>   * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com)
>   * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com)
>   *
> + * setjmp/longjmp and xmon_save_regs code by Paul Mackerras.
                         ^^^^^^^^^^^^^^
This doesn't exist here.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox