LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Domen's MPC5200 FEC cleanup patch.
From: Jon Smirl @ 2007-09-16 19:05 UTC (permalink / raw)
  To: Domen Puncer; +Cc: linuxppc-embedded
In-Reply-To: <9e4733910709150855k6ba6dc8fye9762817566208b4@mail.gmail.com>

This adjustment to the error counting is in the Efika patches and not
in yours, should it be in yours too?

--- a/drivers/net/fec_mpc52xx/fec.c 2007-05-30 16:04:50.000000000 +0200
+++ b/drivers/net/fec_mpc52xx/fec.c 2007-05-30 16:09:02.000000000 +0200
@@ -411,7 +411,9 @@

 	stats->rx_bytes = in_be32(&fec->rmon_r_octets);
 	stats->rx_packets = in_be32(&fec->rmon_r_packets);
-	stats->rx_errors = stats->rx_packets - in_be32(&fec->ieee_r_frame_ok);
+	stats->rx_errors = stats->rx_packets - (
+			in_be32(&fec->ieee_r_frame_ok) +
+			in_be32(&fec->rmon_r_mc_pkt));
 	stats->tx_bytes = in_be32(&fec->rmon_t_octets);
 	stats->tx_packets = in_be32(&fec->rmon_t_packets);
 	stats->tx_errors = stats->tx_packets - (

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: Domen's MPC5200 FEC cleanup patch.
From: Jeff Mock @ 2007-09-16 18:42 UTC (permalink / raw)
  To: Jon Smirl; +Cc: Domen Puncer, linuxppc-embedded
In-Reply-To: <9e4733910709161125u15dcd02cj300c0e3a7fda4c0a@mail.gmail.com>



Jon Smirl wrote:
> On 9/16/07, Jon Smirl <jonsmirl@gmail.com> wrote:
>> Another problem...
>>
>> Ifconfig eth0 down
>>
>> hangs the system.
>> I'll try debugging it.
> 
> The hang is something to do with lockd in NFS, it doesn't appear to
> have anything to do with fec. I think I need to build more of NFS into
> my kernel.
> 

I think the NFS hang has something to do with not having a copy of 
portmap running.  I've had this happen with other embedded systems, and 
can usually work around it by using the "-o nolock" option when doing 
the NFS mount.

jeff

^ permalink raw reply

* Re: FDT for Microblaze and PPC405
From: Michal Simek @ 2007-09-14 19:35 UTC (permalink / raw)
  To: Grant Likely, linuxppc-dev
In-Reply-To: <fa686aa40709111009j64925edag511078d88ff904c@mail.gmail.com>

Hi,
I made EDK tcl script for generation DTS test scructure for FDT. Script 
support Microblaze and PowerPC 405.
Script was primary built for generation U-BOOT configs files for Microblaze.
For Microblaze can you generate both files (FDT and U-BOOT).
For PowerPC can you generate only DTS file. Generation U-BOOT configs files 
aren't supported yet. Script ends after generation DTS.
Script has 2.00.a mark.
It is available at www.monstr.eu.

Cheers,
Michal Simek


> On 9/11/07, Michal Simek <Monstr@seznam.cz> wrote:
>> Hi Grant,
>
> (Adding linuxppc-dev mailing list to CC list because we're discussing
> FDT issues)
>
>> I made EDK repository file for generation dts file from Xilinx design. I 
>> sent it to Wolfgang and Steve this week.
>> It is in the same config file as I use for configuration Microblaze for 
>> U-BOOT. If you want I can send you this repository files.
>
> Yes, please do.
>
>> And I start with redesigning Linux kernel for Microblaze. I ported some 
>> peripherals as timer and intc etc.
>> But for some peripherals I need better configuration.
>>
>> I have no time to read information about fdt. Can you tell me what labels 
>> I can use?
>
> Steve has already done a bunch of work in this direction on
> microblaze, I would converse with him.
>
>>
>> For example emaclite driver needs information about turning on/off ping 
>> pong buffer...
>>
>> I would like to make this properly.
>
> FDT design is just as much art as it is science.  It takes taste and
> judgement to desgin a nice set of bindings.  Your best option is to
> draft something and post it to the linuxppc-embedded mailing list for
> review.
>
>>
>> And second question is on early console logs and timers setting. I read 
>> about aliases in FDT. I think that aliases can cover this setting.
>> For example my design contain 4 serial line and I would like to know 
>> which serial line is set on early console.
>
> You use the chosen node for this.  In the chosen node, you add a
> property called "linux,stdout-path" which holds the path to your
> console.  You can look at examples under arch/powerpc/boot/dts/*
>
> Cheers,
> g.
>
>
> -- 
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely@secretlab.ca
> (403) 399-0195
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.485 / Virus Database: 269.13.15/1002 - Release Date: 
> 11.9.2007 05:46
>
> 

^ permalink raw reply

* Re: [PATCH] i2c: devtree-aware iic support for PPC4xx
From: David Gibson @ 2007-09-17  1:31 UTC (permalink / raw)
  To: Eugene Surovegin; +Cc: Jean Delvare, linuxppc-dev, Stefan Roese, i2c
In-Reply-To: <20070916185330.GA32314@gate.ebshome.net>

On Sun, Sep 16, 2007 at 11:53:30AM -0700, Eugene Surovegin wrote:
> On Sun, Sep 16, 2007 at 01:52:02PM +0200, Stefan Roese wrote:
> > This patch reworks existing ibm-iic driver to an of_platform_device
> > and enables it to talk to device tree directly. The ocp quirks are
> > completely removed by this patch.
> > 
> > This is done to enable I2C support for the PPC4xx platforms now
> > being moved from arch/ppc (OCP) to arch/powerpc (of). The first board
> > using this driver will be the AMCC Sequoia (PPC440EPx).
> > 
> > Signed-off-by: Stefan Roese <sr@denx.de>
> > 
> > ---
> > 2nd try with some cleanups. Please let me know if there still are some
> > problems.
> > 
> > Thanks.
> > 
> > commit 5748f81ff53277fa5c16de815b7d6b172ca284e9
> > tree 8284b3f1c836eb6eb06ee6882ee13b9e8f6cbb6b
> > parent d0174640eedc1cd756754f03afe2dbb3d56de74e
> > author Stefan Roese <sr@denx.de> Sun, 16 Sep 2007 13:46:40 +0200
> > committer Stefan Roese <sr@denx.de> Sun, 16 Sep 2007 13:46:40 +0200
> > 
> >  drivers/i2c/busses/Kconfig       |   12 -
> >  drivers/i2c/busses/Makefile      |    1 
> >  drivers/i2c/busses/i2c-ibm_iic.h |    3 
> >  drivers/i2c/busses/i2c-ibm_of.c  |  858 ++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 873 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> > index 9f3a4cd..12453e2 100644
> > --- a/drivers/i2c/busses/Kconfig
> > +++ b/drivers/i2c/busses/Kconfig
> > @@ -220,7 +220,17 @@ config I2C_PIIX4
> >  
> >  config I2C_IBM_IIC
> >  	tristate "IBM PPC 4xx on-chip I2C interface"
> > -	depends on IBM_OCP
> > +	depends on !PPC_MERGE
> > +	help
> > +	  Say Y here if you want to use IIC peripheral found on 
> > +	  embedded IBM PPC 4xx based systems. 
> > +
> > +	  This driver can also be built as a module.  If so, the module
> > +	  will be called i2c-ibm_iic.
> > +
> > +config I2C_IBM_OF
> > +	tristate "IBM PPC 4xx on-chip I2C interface"
> > +	depends on PPC_MERGE
> >  	help
> >  	  Say Y here if you want to use IIC peripheral found on 
> >  	  embedded IBM PPC 4xx based systems. 
> > diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> > index 5b752e4..0cd0bac 100644
> > --- a/drivers/i2c/busses/Makefile
> > +++ b/drivers/i2c/busses/Makefile
> > @@ -17,6 +17,7 @@ obj-$(CONFIG_I2C_HYDRA)		+= i2c-hydra.o
> >  obj-$(CONFIG_I2C_I801)		+= i2c-i801.o
> >  obj-$(CONFIG_I2C_I810)		+= i2c-i810.o
> >  obj-$(CONFIG_I2C_IBM_IIC)	+= i2c-ibm_iic.o
> > +obj-$(CONFIG_I2C_IBM_OF)	+= i2c-ibm_of.o
> >  obj-$(CONFIG_I2C_IOP3XX)	+= i2c-iop3xx.o
> >  obj-$(CONFIG_I2C_IXP2000)	+= i2c-ixp2000.o
> >  obj-$(CONFIG_I2C_IXP4XX)	+= i2c-ixp4xx.o
> 
> Hmm, I just noticed that you basically added a copy of existing 
> driver with small changes to support OF while keeping OCP one.
> 
> Why not just add OF support to the existing code (under some ifdef), 
> and then remove OCP support as soon as ppc -> powerpc transition is 
> finished? Why have two almost identical code in the tree?
> 
> I also personally don't like this _iic -> _of name change (you 
> removed peripheral name and added something which has nothing to do 
> with iic, I never heard of OF peripheral in 4xx chips). Whether you 
> use OCP or OF to pass a little information is quite irrelevant to the 
> iic driver operation.

I concur on this point.  Especially since on 4xx the device tree will
generally be a flattened device tree which is vaguely OF-like, but not
from an actual Open Firmware.

> If you insist on this approach, please add yourself as a maintainer of 
> this code, because I'm not going to support two identical copies of my 
> code in the kernel tree.
> 

-- 
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] i2c: devtree-aware iic support for PPC4xx
From: David Gibson @ 2007-09-17  1:32 UTC (permalink / raw)
  To: Robert Schwebel; +Cc: Jean Delvare, linuxppc-dev, Stefan Roese, i2c
In-Reply-To: <20070916162747.GV23573@pengutronix.de>

On Sun, Sep 16, 2007 at 06:27:47PM +0200, Robert Schwebel wrote:
> On Sun, Sep 16, 2007 at 01:52:02PM +0200, Stefan Roese wrote:
> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> > index 9f3a4cd..12453e2 100644
> > --- a/drivers/i2c/busses/Kconfig
> > +++ b/drivers/i2c/busses/Kconfig
> > @@ -220,7 +220,17 @@ config I2C_PIIX4
> >  
> >  config I2C_IBM_IIC
> >  	tristate "IBM PPC 4xx on-chip I2C interface"
> > -	depends on IBM_OCP
> > +	depends on !PPC_MERGE
> > +	help
> > +	  Say Y here if you want to use IIC peripheral found on 
> > +	  embedded IBM PPC 4xx based systems. 
> 
> Can we agree on one nomenclature - either i2c or iic?

The dual nomenclature comes because linux uses i2c throughout the
subsystem, but all the hardware documentation refers to the controller
ASIC in question as 'IIC'.  So I think the convention is that 'i2c' is
used to refer to the type of bus in general, 'iic' is used to refer to
this particular type of bus controller.

-- 
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] 4xx: Convert Walnut flash mappings to new binding
From: David Gibson @ 2007-09-17  2:02 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <20070915150901.AC712247CE@gemini.denx.de>

On Sat, Sep 15, 2007 at 05:09:01PM +0200, Wolfgang Denk wrote:
> In message <1189866379.17593.2.camel@localhost.localdomain> Josh Boyer wrote:
> > On Sat, 2007-09-15 at 05:23 +0200, Stefan Roese wrote:
> ...
> > > There are not only Bamboo board running PIBS, but running U-Boot too. How 
> > > should we handle this different FLASH partitioning? Same goes for Ebony too 
> > > btw.
> > 
> > That's a good question.  I'm working on making the NOR flash show up for
> > Bamboo right now, and I had intended to just leave the partition
> > subnodes missing.
> 
> Maybe we can have  U-Boot  add  the  partition  information  if  it's
> missing in the device tree, and extend the mtdparts command in U-Boot
> to add / adjust settings so they match what is defined in U-Boot.
> 
> Stefan, what do you think?

If U-Boot is supplying a device tree, it should certainly make the
partition information match its own idea of the partitions.

For older non-device-tree away u-boot, I guess we'll have to make the
cuboot and treeboot wrappers mangle the device tree differently to
correct the partition information.

I suspect the easiest way to do this will be for the dts to contain
both treeboot and u-boot partition info, and have the wrapper delete
or nop the nodes for the other firmware.

-- 
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] 4xx: Convert Walnut flash mappings to new binding
From: David Gibson @ 2007-09-17  2:03 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, Stefan Roese
In-Reply-To: <addcdbe0ab5b83aa58fc4e7df37b0925@kernel.crashing.org>

On Sat, Sep 15, 2007 at 09:20:10PM +0200, Segher Boessenkool wrote:
> >> Maybe we can have  U-Boot  add  the  partition  information  if  it's
> >> missing in the device tree, and extend the mtdparts command in U-Boot
> >> to add / adjust settings so they match what is defined in U-Boot.
> >
> > That would be great for newer U-Boots.  For existing older ones, it
> > doesn't really solve the problem.  But then again, there's no way to
> > possibly define all the partitioning schemes people may have adopted to
> > their needs on their boards.  And I believe that is why David has
> > RedBoot and command line partitioning override what is in the DTS 
> > today.
> 
> Yeah, partitioning information really doesn't belong in the device
> tree -- with the possible exception of the partitions that the
> firmware (uboot in this case) needs to know about anyway.

Indeed - but we had just the same problem, only worse, with the old
approach of hardcoded, configured-in flash maps.

> You *can* put all partitioning info in the device tree, but that
> doesn't mean you *should* :-)

-- 
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] fix xmon input on 440
From: David Gibson @ 2007-09-17  2:52 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: linuxppc-dev
In-Reply-To: <1189802687.20625.74.camel@basalt>

On Fri, Sep 14, 2007 at 03:44:47PM -0500, Hollis Blanchard wrote:
> Implement udbg_getc() for 440, which fixes xmon input.
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>

-- 
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] [POWERPC] DTS cleanup
From: David Gibson @ 2007-09-17  3:24 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <44C67E7D-CF8F-4B14-A883-4632CCE99D1A@kernel.crashing.org>

On Fri, Sep 14, 2007 at 01:11:07PM -0500, Kumar Gala wrote:
> 
> On Sep 14, 2007, at 11:28 AM, Jon Loeliger wrote:
> 
> > Kumar Gala wrote:
> >
> >> Someone really needs to add some macro/preprocessor magic into DTC  
> >> so  this is made a lot simpler.
> >> - k
> >
> > Kumar,
> >
> > I am seriously contemplating this problem.
> > The trick is, I need to quit with the whole
> > Power Point Programmer job title for a bit...
> 
> I'm all for both of these things.  You working on getting DTC to have  
> some macro/include ability and you not being a powerpoint
> programmer.

Maybe we should make some time for all of us to get on IRC together to
discuss this?

I had some thoughts on what I think is a reasonably sane variable /
expression system for dtc.  Not quite the same thing as a macro
system, but a good start on one.

Although I also think we should still consider if using m4 as a
preprocessor (with some preloaded macros) could be sufficient.  Adding
expression and macro functions to dtc itself would be rather a lot of
work.

-- 
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] fix xmon input on 440
From: Josh Boyer @ 2007-09-17  3:26 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev, Hollis Blanchard
In-Reply-To: <20070917025223.GG32725@localhost.localdomain>

On Mon, 2007-09-17 at 12:52 +1000, David Gibson wrote:
> On Fri, Sep 14, 2007 at 03:44:47PM -0500, Hollis Blanchard wrote:
> > Implement udbg_getc() for 440, which fixes xmon input.
> > Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> 

I fixed up the whitespace issues and applied it to my tree.  Oh, and
comments don't need semi-colons ;)

josh

^ permalink raw reply

* Re: [PATCH] fix xmon input on 440
From: Olof Johansson @ 2007-09-17  3:39 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, Hollis Blanchard, David Gibson
In-Reply-To: <1189999598.17593.18.camel@localhost.localdomain>

On Sun, Sep 16, 2007 at 10:26:37PM -0500, Josh Boyer wrote:
> On Mon, 2007-09-17 at 12:52 +1000, David Gibson wrote:
> > On Fri, Sep 14, 2007 at 03:44:47PM -0500, Hollis Blanchard wrote:
> > > Implement udbg_getc() for 440, which fixes xmon input.
> > > Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> > Acked-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> 
> I fixed up the whitespace issues and applied it to my tree.  Oh, and
> comments don't need semi-colons ;)

Well, there's a big difference between:

	while (foo)
		/* moof */;
	return bar;

and:
	while (foo)
		/* moof */
	return bar;

:-)

^ permalink raw reply

* [PATCH] [POWERPC] Remove unused variabls from drivers/ide/ppc/pmac.c
From: Stephen Rothwell @ 2007-09-17  4:06 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev, linux-ide

Removes these warnings:

/home/sfr/kernels/linus/drivers/ide/ppc/pmac.c: In function 'pmac_ide_dma_check':
/home/sfr/kernels/linus/drivers/ide/ppc/pmac.c:1807: warning: unused variable 'map'
/home/sfr/kernels/linus/drivers/ide/ppc/pmac.c:1805: warning: unused variable 'pmif'

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/ide/ppc/pmac.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 4b13cd9..f19eb6d 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1802,9 +1802,7 @@ pmac_ide_dma_check(ide_drive_t *drive)
 {
 	struct hd_driveid *id = drive->id;
 	ide_hwif_t *hwif = HWIF(drive);
-	pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif->hwif_data;
 	int enable = 1;
-	int map;
 	drive->using_dma = 0;
 	
 	if (drive->media == ide_floppy)
-- 
1.5.3.1

^ permalink raw reply related

* [PATCH] [POWERPC] Fix section mismatch in pci code
From: Stephen Rothwell @ 2007-09-17  4:08 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev

Create a helper function (alloc_maybe_bootmem) that is marked __init_refok
to limit the chances of mistakenly refferring to other __init routines.

WARNING: vmlinux.o(.text+0x2a9c4): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.update_dn_pci_info' and '.pci_dn_reconfig_notifier')
WARNING: vmlinux.o(.text+0x36430): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.mpic_msi_init_allocator' and '.find_ht_magic_addr')
WARNING: vmlinux.o(.text+0x5e804): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config')
WARNING: vmlinux.o(.text+0x5e8e8): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config')
WARNING: vmlinux.o(.text+0x5e968): Section mismatch: reference to .init.text:.__alloc_bootmem (between '.celleb_setup_phb' and '.celleb_fake_pci_write_config')

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_dn.c        |    7 +------
 arch/powerpc/lib/Makefile           |    2 +-
 arch/powerpc/lib/alloc.c            |   14 ++++++++++++++
 arch/powerpc/platforms/celleb/pci.c |   19 +++++--------------
 arch/powerpc/sysdev/mpic_msi.c      |    6 +-----
 include/asm-powerpc/system.h        |    2 ++
 6 files changed, 24 insertions(+), 26 deletions(-)
 create mode 100644 arch/powerpc/lib/alloc.c

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index d7d36df..b483903 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -23,8 +23,6 @@
 #include <linux/pci.h>
 #include <linux/string.h>
 #include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/bootmem.h>
 
 #include <asm/io.h>
 #include <asm/prom.h>
@@ -45,10 +43,7 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
 	const u32 *regs;
 	struct pci_dn *pdn;
 
-	if (mem_init_done)
-		pdn = kmalloc(sizeof(*pdn), GFP_KERNEL);
-	else
-		pdn = alloc_bootmem(sizeof(*pdn));
+	pdn = alloc_maybe_bootmem(sizeof(*pdn), GFP_KERNEL);
 	if (pdn == NULL)
 		return NULL;
 	memset(pdn, 0, sizeof(*pdn));
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 0a486d4..23bbb1e 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -7,7 +7,7 @@ EXTRA_CFLAGS		+= -mno-minimal-toc
 endif
 
 ifeq ($(CONFIG_PPC_MERGE),y)
-obj-y			:= string.o
+obj-y			:= string.o alloc.o
 obj-$(CONFIG_PPC32)	+= div64.o copy_32.o checksum_32.o
 endif
 
diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
new file mode 100644
index 0000000..e58c805
--- /dev/null
+++ b/arch/powerpc/lib/alloc.c
@@ -0,0 +1,14 @@
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/bootmem.h>
+
+#include <asm/system.h>
+
+void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
+{
+	if (mem_init_done)
+		return kmalloc(size, mask);
+	else
+		return alloc_bootmem(size);
+}
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index 11336b4..1348b23 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -327,10 +327,7 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
 
 	size = 256;
 	config = &private->fake_config[devno][fn];
-	if (mem_init_done)
-		*config = kzalloc(size, GFP_KERNEL);
-	else
-		*config = alloc_bootmem(size);
+	*config = alloc_maybe_bootmem(size, GFP_KERNEL);
 	if (*config == NULL) {
 		printk(KERN_ERR "PCI: "
 		       "not enough memory for fake configuration space\n");
@@ -341,10 +338,7 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
 
 	size = sizeof(struct celleb_pci_resource);
 	res = &private->res[devno][fn];
-	if (mem_init_done)
-		*res = kzalloc(size, GFP_KERNEL);
-	else
-		*res = alloc_bootmem(size);
+	*res = alloc_maybe_bootmem(size, GFP_KERNEL);
 	if (*res == NULL) {
 		printk(KERN_ERR
 		       "PCI: not enough memory for resource data space\n");
@@ -436,12 +430,9 @@ static int __init phb_set_bus_ranges(struct device_node *dev,
 
 static void __init celleb_alloc_private_mem(struct pci_controller *hose)
 {
-	if (mem_init_done)
-		hose->private_data =
-			kzalloc(sizeof(struct celleb_pci_private), GFP_KERNEL);
-	else
-		hose->private_data =
-			alloc_bootmem(sizeof(struct celleb_pci_private));
+	hose->private_data =
+		alloc_maybe_bootmem(sizeof(struct celleb_pci_private),
+			GFP_KERNEL);
 }
 
 int __init celleb_setup_phb(struct pci_controller *phb)
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index 9ca4d8f..d272a52 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -9,7 +9,6 @@
  */
 
 #include <linux/irq.h>
-#include <linux/bootmem.h>
 #include <linux/bitmap.h>
 #include <linux/msi.h>
 #include <asm/mpic.h>
@@ -152,10 +151,7 @@ int mpic_msi_init_allocator(struct mpic *mpic)
 	size = BITS_TO_LONGS(mpic->irq_count) * sizeof(long);
 	pr_debug("mpic: allocator bitmap size is 0x%x bytes\n", size);
 
-	if (mem_init_done)
-		mpic->hwirq_bitmap = kmalloc(size, GFP_KERNEL);
-	else
-		mpic->hwirq_bitmap = alloc_bootmem(size);
+	mpic->hwirq_bitmap = alloc_maybe_bootmem(size, GFP_KERNEL);
 
 	if (!mpic->hwirq_bitmap) {
 		pr_debug("mpic: ENOMEM allocating allocator bitmap!\n");
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 41520b7..f7879fc 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -189,6 +189,8 @@ extern int mem_init_done;	/* set on boot once kmalloc can be called */
 extern unsigned long memory_limit;
 extern unsigned long klimit;
 
+extern void *alloc_maybe_bootmem(size_t size, gfp_t mask);
+
 extern int powersave_nap;	/* set if nap mode can be used in idle loop */
 
 /*
-- 
1.5.3.1

^ permalink raw reply related

* Re: [PATCH] fix xmon input on 440
From: Hollis Blanchard @ 2007-09-17  4:15 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <20070917033924.GA24914@lixom.net>

On Sun, 2007-09-16 at 22:39 -0500, Olof Johansson wrote:
> On Sun, Sep 16, 2007 at 10:26:37PM -0500, Josh Boyer wrote:
> > On Mon, 2007-09-17 at 12:52 +1000, David Gibson wrote:
> > > On Fri, Sep 14, 2007 at 03:44:47PM -0500, Hollis Blanchard wrote:
> > > > Implement udbg_getc() for 440, which fixes xmon input.
> > > > Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
> > > Acked-by: David Gibson <david@gibson.dropbear.id.au>
> > > 
> > 
> > I fixed up the whitespace issues and applied it to my tree.  Oh, and
> > comments don't need semi-colons ;)
> 
> Well, there's a big difference between:
> 
> 	while (foo)
> 		/* moof */;
> 	return bar;
> 
> and:
> 	while (foo)
> 		/* moof */
> 	return bar;

Right, so this commit is broken:
http://git.infradead.org/?p=users/jwboyer/powerpc.git;a=commitdiff;h=81ec428065c01e37fb143ad31dc04fea27fddcac

-- 
Hollis Blanchard
IBM Linux Technology Center

^ permalink raw reply

* libfdt:  Add fdt_node_offset_by_prop_value()
From: David Gibson @ 2007-09-17  4:28 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

This patch adds a function to libfdt to locate nodes containing a
property with a specific value.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/libfdt/fdt_ro.c
===================================================================
--- dtc.orig/libfdt/fdt_ro.c	2007-09-17 14:00:22.000000000 +1000
+++ dtc/libfdt/fdt_ro.c	2007-09-17 14:04:18.000000000 +1000
@@ -407,3 +407,54 @@ int fdt_parent_offset(const void *fdt, i
 	return fdt_supernode_atdepth_offset(fdt, nodeoffset,
 					    nodedepth - 1, NULL);
 }
+
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+				  const char *propname,
+				  const void *propval, int proplen)
+{
+	uint32_t tag;
+	int offset, nextoffset;
+	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);
+
+	return -FDT_ERR_NOTFOUND;
+}
Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h	2007-09-17 14:00:04.000000000 +1000
+++ dtc/libfdt/libfdt.h	2007-09-17 14:00:23.000000000 +1000
@@ -146,6 +146,10 @@ int fdt_supernode_atdepth_offset(const v
 int fdt_node_depth(const void *fdt, int nodeoffset);
 int fdt_parent_offset(const void *fdt, int nodeoffset);
 
+int fdt_node_offset_by_prop_value(const void *fdt, int startoffset,
+				  const char *propname,
+				  const void *propval, int proplen);
+
 /* Write-in-place functions */
 int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
 			const void *val, int len);
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests	2007-09-17 14:00:04.000000000 +1000
+++ dtc/tests/Makefile.tests	2007-09-17 14:00:23.000000000 +1000
@@ -1,5 +1,6 @@
 LIB_TESTS_L = root_node find_property subnode_offset path_offset \
 	get_name getprop get_path supernode_atdepth_offset parent_offset \
+	node_offset_by_prop_value \
 	notfound \
 	setprop_inplace nop_property nop_node \
 	sw_tree1 \
Index: dtc/tests/node_offset_by_prop_value.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/node_offset_by_prop_value.c	2007-09-17 14:00:23.000000000 +1000
@@ -0,0 +1,110 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ *	Testcase for fdt_path_offset()
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdarg.h>
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "tests.h"
+#include "testdata.h"
+
+void vcheck_search(void *fdt, const char *propname, const void *propval,
+		  int proplen, va_list ap)
+{
+	int offset = -1, target;
+
+	do {
+		target = va_arg(ap, int);
+		verbose_printf("Searching (target = %d): %d ->",
+			       target, offset);
+		offset = fdt_node_offset_by_prop_value(fdt, offset, propname,
+						       propval, proplen);
+		verbose_printf("%d\n", offset);
+
+		if (offset != target)
+			FAIL("fdt_node_offset_by_prop_value() returns %d "
+			     "instead of %d", offset, target);
+	} while (target >= 0);
+}
+
+void check_search(void *fdt, const char *propname, const void *propval,
+		  int proplen, ...)
+{
+	va_list ap;
+
+	va_start(ap, proplen);
+	vcheck_search(fdt, propname, propval, proplen, ap);
+	va_end(ap);
+}
+
+void check_search_str(void *fdt, const char *propname, const char *propval, ...)
+{
+	va_list ap;
+
+	va_start(ap, propval);
+	vcheck_search(fdt, propname, propval, strlen(propval)+1, ap);
+	va_end(ap);
+}
+
+#define check_search_val(fdt, propname, propval, ...) \
+	{ \
+		typeof(propval) val = (propval); \
+		check_search((fdt), (propname), &val, sizeof(val), \
+			     ##__VA_ARGS__); \
+	}
+
+int main(int argc, char *argv[])
+{
+	void *fdt;
+	int subnode1_offset, subnode2_offset;
+	int subsubnode1_offset, subsubnode2_offset;
+
+	test_init(argc, argv);
+	fdt = load_blob_arg(argc, argv);
+
+	subnode1_offset = fdt_path_offset(fdt, "/subnode1");
+	subnode2_offset = fdt_path_offset(fdt, "/subnode2");
+	subsubnode1_offset = fdt_path_offset(fdt, "/subnode1/subsubnode");
+	subsubnode2_offset = fdt_path_offset(fdt, "/subnode2/subsubnode");
+
+	if ((subnode1_offset < 0) || (subnode2_offset < 0)
+	    || (subsubnode1_offset < 0) || (subsubnode2_offset < 0))
+		FAIL("Can't find required nodes");
+
+	check_search_val(fdt, "prop-int", TEST_VALUE_1, 0, subnode1_offset,
+			 subsubnode1_offset, -FDT_ERR_NOTFOUND);
+
+	check_search_val(fdt, "prop-int", TEST_VALUE_2, subnode2_offset,
+			 subsubnode2_offset, -FDT_ERR_NOTFOUND);
+
+	check_search_str(fdt, "prop-str", TEST_STRING_1, 0, -FDT_ERR_NOTFOUND);
+
+	check_search_str(fdt, "prop-str", "no such string", -FDT_ERR_NOTFOUND);
+
+	check_search_val(fdt, "prop-int", TEST_VALUE_1+1, -FDT_ERR_NOTFOUND);
+
+	check_search(fdt, "no-such-prop", NULL, 0, -FDT_ERR_NOTFOUND);
+
+	PASS();
+}
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh	2007-09-17 14:00:04.000000000 +1000
+++ dtc/tests/run_tests.sh	2007-09-17 14:00:23.000000000 +1000
@@ -40,6 +40,7 @@ tree1_tests () {
     run_test get_path $TREE
     run_test supernode_atdepth_offset $TREE
     run_test parent_offset $TREE
+    run_test node_offset_by_prop_value $TREE
     run_test notfound $TREE
 
     # Write-in-place tests

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

* dtc: Cleanup testsuite organization
From: David Gibson @ 2007-09-17  4:39 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

run_tests.sh from the dtc testsuite currently has a facility ro run
just "functional" or just "stress" tests.  This distinction is carried
over from libhugetlbfs where the test framework originated, and where
it made sense.

In dtc, we have no stress tests, so running these subsections isn't
particularly interesting.  This patch removes these test subsets,
instead defining a single "libfdt" test subset for testcases related
to libfdt (and not dtc proper only.  Currently that's all of the
testcases, but with any luck we'll have some dtc testcases in the
future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests	2007-09-04 14:17:32.000000000 +1000
+++ dtc/tests/Makefile.tests	2007-09-04 14:17:36.000000000 +1000
@@ -49,18 +49,6 @@
 checkv:	tests
 	cd $(TESTS_PREFIX); ./run_tests.sh -v
 
-func:	tests
-	cd $(TESTS_PREFIX); ./run_tests.sh -t func
-
-funcv:	tests
-	cd $(TESTS_PREFIX); ./run_tests.sh -t func -v
-
-stress:	tests
-	cd $(TESTS_PREFIX); ./run_tests.sh -t stress
-
-stressv: tests
-	cd $(TESTS_PREFIX); ./run_tests.sh -t stress -v
-
 ifneq ($(DEPTARGETS),)
 -include $(TESTS_DEPFILES)
 endif
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh	2007-09-04 14:16:22.000000000 +1000
+++ dtc/tests/run_tests.sh	2007-09-04 14:55:29.000000000 +1000
@@ -49,7 +49,7 @@
     run_test nop_node $TREE
 }
 
-functional_tests () {
+libfdt_tests () {
     # Make sure we don't have stale blobs lying around
     rm -f *.test.dtb
 
@@ -86,10 +86,6 @@
     run_test truncated_property
 }
 
-stress_tests () {
-    ITERATIONS=10           # Number of iterations for looping tests
-}
-
 while getopts "vdt:" ARG ; do
     case $ARG in
 	"v")
@@ -102,16 +98,13 @@
 done
 
 if [ -z "$TESTSETS" ]; then
-    TESTSETS="func stress"
+    TESTSETS="libfdt"
 fi
 
 for set in $TESTSETS; do
     case $set in
-	"func")
-	    functional_tests
-	    ;;
-	"stress")
-	    stress_tests
+	"libfdt")
+	    libfdt_tests
 	    ;;
     esac
 done

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

* [PATCH] [POWERPC] Remove cmd_line from head*.S
From: Stephen Rothwell @ 2007-09-17  4:41 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev

It is just a C char array, so declare it thusly.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/head_32.S        |    8 --------
 arch/powerpc/kernel/head_40x.S       |    7 -------
 arch/powerpc/kernel/head_44x.S       |    8 --------
 arch/powerpc/kernel/head_64.S        |    8 --------
 arch/powerpc/kernel/head_8xx.S       |    8 --------
 arch/powerpc/kernel/head_fsl_booke.S |    8 --------
 arch/powerpc/kernel/setup-common.c   |    2 ++
 7 files changed, 2 insertions(+), 47 deletions(-)

This version has the definition in setup-common.c.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 0e3df1f..a2e4df0 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -1300,14 +1300,6 @@ empty_zero_page:
 swapper_pg_dir:
 	.space	4096
 
-/*
- * This space gets a copy of optional info passed to us by the bootstrap
- * Used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-	.globl	cmd_line
-cmd_line:
-	.space	512
-
 	.globl intercept_table
 intercept_table:
 	.long 0, 0, i0x200, i0x300, i0x400, 0, i0x600, i0x700
diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index a8e0457..8a69eec 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -1006,13 +1006,6 @@ critical_stack_top:
 	.globl	exception_stack_top
 exception_stack_top:
 
-/* This space gets a copy of optional info passed to us by the bootstrap
- * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-	.globl	cmd_line
-cmd_line:
-	.space	512
-
 /* Room for two PTE pointers, usually the kernel and current user pointers
  * to their respective root page table.
  */
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index e26d26e..e405c59 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -744,14 +744,6 @@ exception_stack_bottom:
 exception_stack_top:
 
 /*
- * This space gets a copy of optional info passed to us by the bootstrap
- * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-	.globl	cmd_line
-cmd_line:
-	.space	512
-
-/*
  * Room for two PTE pointers, usually the kernel and current user pointers
  * to their respective root page table.
  */
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index cec5908..f4ae82e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1540,11 +1540,3 @@ empty_zero_page:
 	.globl	swapper_pg_dir
 swapper_pg_dir:
 	.space	PAGE_SIZE
-
-/*
- * This space gets a copy of optional info passed to us by the bootstrap
- * Used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-	.globl	cmd_line
-cmd_line:
-	.space	COMMAND_LINE_SIZE
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 901be47..22e1a3c 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -835,14 +835,6 @@ empty_zero_page:
 swapper_pg_dir:
 	.space	4096
 
-/*
- * This space gets a copy of optional info passed to us by the bootstrap
- * Used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-	.globl	cmd_line
-cmd_line:
-	.space	512
-
 /* Room for two PTE table poiners, usually the kernel and current user
  * pointer to their respective root page table (pgdir).
  */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 1f155d3..5f47adb 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -1050,14 +1050,6 @@ exception_stack_bottom:
 exception_stack_top:
 
 /*
- * This space gets a copy of optional info passed to us by the bootstrap
- * which is used to pass parameters into the kernel like root=/dev/sda1, etc.
- */
-	.globl	cmd_line
-cmd_line:
-	.space	512
-
-/*
  * Room for two PTE pointers, usually the kernel and current user pointers
  * to their respective root page table.
  */
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 50ef38c..36c90ba 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -76,6 +76,8 @@ EXPORT_SYMBOL(machine_id);
 
 unsigned long klimit = (unsigned long) _end;
 
+char cmd_line[COMMAND_LINE_SIZE];
+
 /*
  * This still seems to be needed... -- paulus
  */ 
-- 
1.5.3.1

^ permalink raw reply related

* Re: Domen's MPC5200 FEC cleanup patch.
From: Domen Puncer @ 2007-09-17  5:33 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-embedded
In-Reply-To: <9e4733910709161205k15106ba1sd2f0597f2601f222@mail.gmail.com>

On 16/09/07 15:05 -0400, Jon Smirl wrote:
> This adjustment to the error counting is in the Efika patches and not
> in yours, should it be in yours too?

I know about this patch.

Error counting is reworked in newer anyway (mixing rmon and ieee
counters didn't look very nice to me).


	Domen

> 
> --- a/drivers/net/fec_mpc52xx/fec.c 2007-05-30 16:04:50.000000000 +0200
> +++ b/drivers/net/fec_mpc52xx/fec.c 2007-05-30 16:09:02.000000000 +0200
> @@ -411,7 +411,9 @@
> 
>  	stats->rx_bytes = in_be32(&fec->rmon_r_octets);
>  	stats->rx_packets = in_be32(&fec->rmon_r_packets);
> -	stats->rx_errors = stats->rx_packets - in_be32(&fec->ieee_r_frame_ok);
> +	stats->rx_errors = stats->rx_packets - (
> +			in_be32(&fec->ieee_r_frame_ok) +
> +			in_be32(&fec->rmon_r_mc_pkt));
>  	stats->tx_bytes = in_be32(&fec->rmon_t_octets);
>  	stats->tx_packets = in_be32(&fec->rmon_t_packets);
>  	stats->tx_errors = stats->tx_packets - (
> 
> -- 
> Jon Smirl
> jonsmirl@gmail.com

^ permalink raw reply

* Re: [PATCH] i2c: devtree-aware iic support for PPC4xx
From: Stefan Roese @ 2007-09-17  5:34 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Jean Delvare, i2c
In-Reply-To: <20070916185330.GA32314@gate.ebshome.net>

On Sunday 16 September 2007, Eugene Surovegin wrote:
> Hmm, I just noticed that you basically added a copy of existing
> driver with small changes to support OF while keeping OCP one.
>
> Why not just add OF support to the existing code (under some ifdef),
> and then remove OCP support as soon as ppc -> powerpc transition is
> finished? Why have two almost identical code in the tree?

My understanding was, that adding many #ifdef's into the code was not the 
preferred way. I could of course change this patch to not add an additional 
driver but extend the existing driver with a bunch of #ifdef's to support 
both versions.

This approach of multiple drivers seems to be common in the kernel right now:

drivers/mtd/maps/physmap.c
drivers/mtd/maps/physmap_of.c

or

drivers/usb/host/ohci-ppc-soc.c
drivers/usb/host/ohci-ppc-of.c

Any other opinions on this? How should this be handled to get accepted 
upstream? Two different drivers with removing the "old" one later when 
arch/ppc is gone, or one driver which supports both versions and removing the 
ocp support in this driver later?

> I also personally don't like this _iic -> _of name change (you
> removed peripheral name and added something which has nothing to do
> with iic, I never heard of OF peripheral in 4xx chips). Whether you
> use OCP or OF to pass a little information is quite irrelevant to the
> iic driver operation.

The "old" name "i2c-ibm_iic" is kind of redundant. Nearly all bus drivers are 
named "i2c-platform". Perhaps a better name would be "i2c-ppc4xx" then. 
This "of" name was borrowed from already existing device-tree aware drivers 
like drivers/mtd/maps/physmap_of.c or drivers/usb/host/ohci-ppc-of.c.

> If you insist on this approach, please add yourself as a maintainer of
> this code, because I'm not going to support two identical copies of my
> code in the kernel tree.

I "insist" in nothing. I'm just trying to get this device-tree aware I2C 
driver support upstream.

Best regards,
Stefan

^ permalink raw reply

* libfdt: Consistently use big-endian property data in testcases
From: David Gibson @ 2007-09-17  5:42 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev

Flat device trees always have integers in their structure stored as
big-endian.  From this point of view, property values are
bags-of-bytes and any endianness is up to users of the device tree to
determine.

The libfdt testcases which use properties with integer values,
currently use native endian format for the architecture on which the
testcases are run.  This works ok for now, since both the creation and
checking of the example device trees happen in the same endianness.

This will become a problem, however, for tests of dtc which we want to
add in the nearish future.  dtc always uses big-endian format for
'cell' format data in properties; as it needs to in order to produce
powerpc-usable device trees when hosted on a little-endian
architecture.

This patch, therefore, changes the libfdt testsuite to use big-endian
format always for integer format data, in order to interoperate sanely
with future dtc testcases.  This also means that the example trees
created by the testsuite should now be byte-for-byte identical
regardless of dtc and libfdt's host platform, which is arguably an
advantage.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>

Index: dtc/tests/testdata.h
===================================================================
--- dtc.orig/tests/testdata.h	2007-09-17 11:50:21.000000000 +1000
+++ dtc/tests/testdata.h	2007-09-17 15:41:10.000000000 +1000
@@ -1,5 +1,16 @@
-#define TEST_VALUE_1	0xdeadbeef
-#define TEST_VALUE_2	0xabcd1234
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define cell_to_fdt(x)	(x)
+#else
+/* We do this as a big hairy expression instead of using bswap_32()
+ * because we need it to work in asm as well as C. */
+#define cell_to_fdt(x)	((((x) >> 24) & 0xff) | (((x) >> 8) & 0xff00) \
+			 | (((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000))
+#endif
+
+#define TEST_VALUE_1	cell_to_fdt(0xdeadbeef)
+#define TEST_VALUE_2	cell_to_fdt(0xabcd1234)
 
 #define TEST_STRING_1	"hello world"
 


-- 
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] i2c: devtree-aware iic support for PPC4xx
From: David Gibson @ 2007-09-17  5:50 UTC (permalink / raw)
  To: Stefan Roese; +Cc: Jean Delvare, linuxppc-dev, i2c
In-Reply-To: <200709170734.09079.sr@denx.de>

On Mon, Sep 17, 2007 at 07:34:08AM +0200, Stefan Roese wrote:
> On Sunday 16 September 2007, Eugene Surovegin wrote:
> > Hmm, I just noticed that you basically added a copy of existing
> > driver with small changes to support OF while keeping OCP one.
> >
> > Why not just add OF support to the existing code (under some ifdef),
> > and then remove OCP support as soon as ppc -> powerpc transition is
> > finished? Why have two almost identical code in the tree?
> 
> My understanding was, that adding many #ifdef's into the code was not the 
> preferred way. I could of course change this patch to not add an additional 
> driver but extend the existing driver with a bunch of #ifdef's to support 
> both versions.

#ifdefs are yucky, but so is duplication.  I'm not sure which is the
lesser evil in this case.

> This approach of multiple drivers seems to be common in the kernel right now:
> 
> drivers/mtd/maps/physmap.c
> drivers/mtd/maps/physmap_of.c

Not a relevant example.  Despite the names, physmap and physmap_of
don't really do the same thing at all.  I've been meaning to rename
physmap_of...

> 
> or
> 
> drivers/usb/host/ohci-ppc-soc.c
> drivers/usb/host/ohci-ppc-of.c

Also ibm_emac vs. ibm_new_emac (not merged yet).

> Any other opinions on this? How should this be handled to get accepted 
> upstream? Two different drivers with removing the "old" one later when 
> arch/ppc is gone, or one driver which supports both versions and removing the 
> ocp support in this driver later?
> 
> > I also personally don't like this _iic -> _of name change (you
> > removed peripheral name and added something which has nothing to do
> > with iic, I never heard of OF peripheral in 4xx chips). Whether you
> > use OCP or OF to pass a little information is quite irrelevant to the
> > iic driver operation.
> 
> The "old" name "i2c-ibm_iic" is kind of redundant. Nearly all bus drivers are 
> named "i2c-platform". Perhaps a better name would be "i2c-ppc4xx" then. 
> This "of" name was borrowed from already existing device-tree aware drivers 
> like drivers/mtd/maps/physmap_of.c or drivers/usb/host/ohci-ppc-of.c.

'ibm' is not specific enough - it's not like it's used on even a very
large fraction of ibm platforms - and 'of' is verging on misleading
(since OF != device tree, although they're related).  'iic' isn't
arbitrary - it comes from the name used in the documentation.
Although 'i2c-ppc4xx' probably is a better name, in any case.

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

* [PATCH] Make sure to of_node_get() the result of pci_device_to_OF_node()
From: Michael Ellerman @ 2007-09-17  6:03 UTC (permalink / raw)
  To: linuxppc-dev

pci_device_to_OF_node() returns the device node attached to a PCI device,
but doesn't actually grab a reference - we need to do it ourselves.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/cell/axon_msi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 57a6149..2b2dfcc 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -119,7 +119,7 @@ static struct axon_msic *find_msi_translator(struct pci_dev *dev)
 	const phandle *ph;
 	struct axon_msic *msic = NULL;
 
-	dn = pci_device_to_OF_node(dev);
+	dn = of_node_get(pci_device_to_OF_node(dev));
 	if (!dn) {
 		dev_dbg(&dev->dev, "axon_msi: no pci_dn found\n");
 		return NULL;
@@ -176,7 +176,7 @@ static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg)
 	int len;
 	const u32 *prop;
 
-	dn = pci_device_to_OF_node(dev);
+	dn = of_node_get(pci_device_to_OF_node(dev));
 	if (!dn) {
 		dev_dbg(&dev->dev, "axon_msi: no pci_dn found\n");
 		return -ENODEV;
-- 
1.5.1.3.g7a33b

^ permalink raw reply related

* [PATCH 1/7] Store the base address in dcr_host_t
From: Michael Ellerman @ 2007-09-17  6:05 UTC (permalink / raw)
  To: linuxppc-dev

In its current form, dcr_map() doesn't remember the base address you passed
it, which means you need to store it somewhere else. Rather than adding the
base to another struct it seems simpler to store it in the dcr_host_t.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/sysdev/dcr.c        |    2 +-
 include/asm-powerpc/dcr-mmio.h   |    6 +++++-
 include/asm-powerpc/dcr-native.h |    6 ++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index e82d54d..ab11c0b 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -104,7 +104,7 @@ u64 of_translate_dcr_address(struct device_node *dev,
 dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
 		   unsigned int dcr_c)
 {
-	dcr_host_t ret = { .token = NULL, .stride = 0 };
+	dcr_host_t ret = { .token = NULL, .stride = 0, .base = dcr_n };
 	u64 addr;
 
 	pr_debug("dcr_map(%s, 0x%x, 0x%x)\n",
diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h
index 5dbfca8..6b82c3b 100644
--- a/include/asm-powerpc/dcr-mmio.h
+++ b/include/asm-powerpc/dcr-mmio.h
@@ -23,7 +23,11 @@
 
 #include <asm/io.h>
 
-typedef struct { void __iomem *token; unsigned int stride; } dcr_host_t;
+typedef struct {
+	void __iomem *token;
+	unsigned int stride;
+	unsigned int base;
+} dcr_host_t;
 
 #define DCR_MAP_OK(host)	((host).token != NULL)
 
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
index 05af081..f41058c 100644
--- a/include/asm-powerpc/dcr-native.h
+++ b/include/asm-powerpc/dcr-native.h
@@ -22,11 +22,13 @@
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
-typedef struct {} dcr_host_t;
+typedef struct {
+	unsigned int base;
+} dcr_host_t;
 
 #define DCR_MAP_OK(host)	(1)
 
-#define dcr_map(dev, dcr_n, dcr_c)	((dcr_host_t){})
+#define dcr_map(dev, dcr_n, dcr_c)	((dcr_host_t){ .base = (dcr_n) })
 #define dcr_unmap(host, dcr_n, dcr_c)	do {} while (0)
 #define dcr_read(host, dcr_n)		mfdcr(dcr_n)
 #define dcr_write(host, dcr_n, value)	mtdcr(dcr_n, value)
-- 
1.5.1.3.g7a33b

^ permalink raw reply related

* [PATCH 2/7] Update mpic to use dcr_host_t.base
From: Michael Ellerman @ 2007-09-17  6:05 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <449a181e8169af98984bb2d61a759c23e55d19b4.1190009070.git.michael@ellerman.id.au>

Now that dcr_host_t contains the base address, we can use that in the mpic
code, rather than storing it separately.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/sysdev/mpic.c |   28 +++++++++++-----------------
 include/asm-powerpc/mpic.h |    6 ------
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 8de29f2..16b1f4b 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -156,8 +156,7 @@ static inline u32 _mpic_read(enum mpic_reg_type type,
 	switch(type) {
 #ifdef CONFIG_PPC_DCR
 	case mpic_access_dcr:
-		return dcr_read(rb->dhost,
-				rb->dbase + reg + rb->doff);
+		return dcr_read(rb->dhost, rb->dhost.base + reg);
 #endif
 	case mpic_access_mmio_be:
 		return in_be32(rb->base + (reg >> 2));
@@ -174,8 +173,7 @@ static inline void _mpic_write(enum mpic_reg_type type,
 	switch(type) {
 #ifdef CONFIG_PPC_DCR
 	case mpic_access_dcr:
-		return dcr_write(rb->dhost,
-				 rb->dbase + reg + rb->doff, value);
+		return dcr_write(rb->dhost, rb->dhost.base + reg, value);
 #endif
 	case mpic_access_mmio_be:
 		return out_be32(rb->base + (reg >> 2), value);
@@ -279,9 +277,11 @@ static void _mpic_map_mmio(struct mpic *mpic, unsigned long phys_addr,
 static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
 			  unsigned int offset, unsigned int size)
 {
-	rb->dbase = mpic->dcr_base;
-	rb->doff = offset;
-	rb->dhost = dcr_map(mpic->irqhost->of_node, rb->dbase + rb->doff, size);
+	const u32 *dbasep;
+
+	dbasep = of_get_property(mpic->irqhost->of_node, "dcr-reg", NULL);
+
+	rb->dhost = dcr_map(mpic->irqhost->of_node, *dbasep + offset, size);
 	BUG_ON(!DCR_MAP_OK(rb->dhost));
 }
 
@@ -1075,20 +1075,14 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 	BUG_ON(paddr == 0 && node == NULL);
 
 	/* If no physical address passed in, check if it's dcr based */
-	if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL)
-		mpic->flags |= MPIC_USES_DCR;
-
+	if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL) {
 #ifdef CONFIG_PPC_DCR
-	if (mpic->flags & MPIC_USES_DCR) {
-		const u32 *dbasep;
-		dbasep = of_get_property(node, "dcr-reg", NULL);
-		BUG_ON(dbasep == NULL);
-		mpic->dcr_base = *dbasep;
+		mpic->flags |= MPIC_USES_DCR;
 		mpic->reg_type = mpic_access_dcr;
-	}
 #else
-	BUG_ON (mpic->flags & MPIC_USES_DCR);
+		BUG();
 #endif /* CONFIG_PPC_DCR */
+	}
 
 	/* If the MPIC is not DCR based, and no physical address was passed
 	 * in, try to obtain one
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index edb4a7c..ae84dde 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -224,8 +224,6 @@ struct mpic_reg_bank {
 	u32 __iomem	*base;
 #ifdef CONFIG_PPC_DCR
 	dcr_host_t	dhost;
-	unsigned int	dbase;
-	unsigned int	doff;
 #endif /* CONFIG_PPC_DCR */
 };
 
@@ -289,10 +287,6 @@ struct mpic
 	struct mpic_reg_bank	cpuregs[MPIC_MAX_CPUS];
 	struct mpic_reg_bank	isus[MPIC_MAX_ISU];
 
-#ifdef CONFIG_PPC_DCR
-	unsigned int		dcr_base;
-#endif
-
 	/* Protected sources */
 	unsigned long		*protected;
 
-- 
1.5.1.3.g7a33b

^ permalink raw reply related

* [PATCH 3/7] Use dcr_host_t.base in ibm_emac_mal
From: Michael Ellerman @ 2007-09-17  6:05 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <449a181e8169af98984bb2d61a759c23e55d19b4.1190009070.git.michael@ellerman.id.au>

This requires us to do a sort-of fake dcr_map(), so that base is set
properly. This will be fixed/removed when the device-tree-aware emac driver
is merged.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 drivers/net/ibm_emac/ibm_emac_mal.c |    5 ++++-
 drivers/net/ibm_emac/ibm_emac_mal.h |    5 ++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ibm_emac/ibm_emac_mal.c b/drivers/net/ibm_emac/ibm_emac_mal.c
index cabd984..b08da96 100644
--- a/drivers/net/ibm_emac/ibm_emac_mal.c
+++ b/drivers/net/ibm_emac/ibm_emac_mal.c
@@ -421,7 +421,10 @@ static int __init mal_probe(struct ocp_device *ocpdev)
 		       ocpdev->def->index);
 		return -ENOMEM;
 	}
-	mal->dcrbase = maldata->dcr_base;
+
+	/* XXX This only works for native dcr for now */
+	mal->dcrhost = dcr_map(NULL, maldata->dcr_base, 0);
+
 	mal->def = ocpdev->def;
 
 	INIT_LIST_HEAD(&mal->poll_list);
diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h
index 64bc338..6b1fbeb 100644
--- a/drivers/net/ibm_emac/ibm_emac_mal.h
+++ b/drivers/net/ibm_emac/ibm_emac_mal.h
@@ -191,7 +191,6 @@ struct mal_commac {
 };
 
 struct ibm_ocp_mal {
-	int			dcrbase;
 	dcr_host_t		dcrhost;
 
 	struct list_head	poll_list;
@@ -209,12 +208,12 @@ struct ibm_ocp_mal {
 
 static inline u32 get_mal_dcrn(struct ibm_ocp_mal *mal, int reg)
 {
-	return dcr_read(mal->dcrhost, mal->dcrbase + reg);
+	return dcr_read(mal->dcrhost, mal->dcrhost.base + reg);
 }
 
 static inline void set_mal_dcrn(struct ibm_ocp_mal *mal, int reg, u32 val)
 {
-	dcr_write(mal->dcrhost, mal->dcrbase + reg, val);
+	dcr_write(mal->dcrhost, mal->dcrhost.base + reg, val);
 }
 
 /* Register MAL devices */
-- 
1.5.1.3.g7a33b

^ permalink raw reply related


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