* [PATCH] ucc_geth: eliminate max-speed, change interface-type to phy-connection-type
From: Kim Phillips @ 2007-05-02 19:21 UTC (permalink / raw)
To: jeff; +Cc: netdev, linuxppc-dev
It was agreed that phy-connection-type was a better name for
the interface-type property, so this patch renames it.
Also, the max-speed property name was determined too generic,
and is therefore eliminated in favour of phy-connection-type
derivation logic.
includes corrections to copyright text.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
Jeff, this patch depends on Stephen Rothwell's
"[PATCH 2/2] Rename get_property to of_get_property: drivers"
patch dated Tue, 1 May 2007 13:54:02 +1000
drivers/net/ucc_geth.c | 40 ++++++++++++++++------------------------
drivers/net/ucc_geth_mii.c | 9 +++++----
drivers/net/ucc_geth_mii.h | 10 +++++-----
3 files changed, 26 insertions(+), 33 deletions(-)
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index d7aff81..361eca0 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
*
* Author: Shlomi Gridish <gridish@freescale.com>
* Li Yang <leoli@freescale.com>
@@ -3737,21 +3737,21 @@ static int ucc_geth_close(struct net_device *dev)
const struct ethtool_ops ucc_geth_ethtool_ops = { };
-static phy_interface_t to_phy_interface(const char *interface_type)
+static phy_interface_t to_phy_interface(const char *phy_connection_type)
{
- if (strcasecmp(interface_type, "mii") == 0)
+ if (strcasecmp(phy_connection_type, "mii") == 0)
return PHY_INTERFACE_MODE_MII;
- if (strcasecmp(interface_type, "gmii") == 0)
+ if (strcasecmp(phy_connection_type, "gmii") == 0)
return PHY_INTERFACE_MODE_GMII;
- if (strcasecmp(interface_type, "tbi") == 0)
+ if (strcasecmp(phy_connection_type, "tbi") == 0)
return PHY_INTERFACE_MODE_TBI;
- if (strcasecmp(interface_type, "rmii") == 0)
+ if (strcasecmp(phy_connection_type, "rmii") == 0)
return PHY_INTERFACE_MODE_RMII;
- if (strcasecmp(interface_type, "rgmii") == 0)
+ if (strcasecmp(phy_connection_type, "rgmii") == 0)
return PHY_INTERFACE_MODE_RGMII;
- if (strcasecmp(interface_type, "rgmii-id") == 0)
+ if (strcasecmp(phy_connection_type, "rgmii-id") == 0)
return PHY_INTERFACE_MODE_RGMII_ID;
- if (strcasecmp(interface_type, "rtbi") == 0)
+ if (strcasecmp(phy_connection_type, "rtbi") == 0)
return PHY_INTERFACE_MODE_RTBI;
return PHY_INTERFACE_MODE_MII;
@@ -3819,29 +3819,21 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->phy_address = *prop;
/* get the phy interface type, or default to MII */
- prop = of_get_property(np, "interface-type", NULL);
+ prop = of_get_property(np, "phy-connection-type", NULL);
if (!prop) {
/* handle interface property present in old trees */
prop = of_get_property(phy, "interface", NULL);
- if (prop != NULL)
+ if (prop != NULL) {
phy_interface = enet_to_phy_interface[*prop];
- else
+ max_speed = enet_to_speed[*prop];
+ } else
phy_interface = PHY_INTERFACE_MODE_MII;
} else {
phy_interface = to_phy_interface((const char *)prop);
}
- /* get speed, or derive from interface */
- prop = of_get_property(np, "max-speed", NULL);
- if (!prop) {
- /* handle interface property present in old trees */
- prop = of_get_property(phy, "interface", NULL);
- if (prop != NULL)
- max_speed = enet_to_speed[*prop];
- } else {
- max_speed = *prop;
- }
- if (!max_speed) {
+ /* get speed, or derive from PHY interface */
+ if (max_speed == 0)
switch (phy_interface) {
case PHY_INTERFACE_MODE_GMII:
case PHY_INTERFACE_MODE_RGMII:
@@ -3854,9 +3846,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
max_speed = SPEED_100;
break;
}
- }
if (max_speed == SPEED_1000) {
+ /* configure muram FIFOs for gigabit operation */
ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT;
ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT;
ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT;
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 27a1ef3..f96966d 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -1,12 +1,13 @@
/*
* drivers/net/ucc_geth_mii.c
*
- * Gianfar Ethernet Driver -- MIIM bus implementation
- * Provides Bus interface for MIIM regs
+ * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
+ * Provides Bus interface for MII Management regs in the UCC register space
*
- * Author: Li Yang
+ * Copyright (C) 2007 Freescale Semiconductor, Inc.
*
- * Copyright (c) 2002-2004 Freescale Semiconductor, Inc.
+ * Authors: Li Yang <leoli@freescale.com>
+ * Kim Phillips <kim.phillips@freescale.com>
*
* 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
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index 98430fe..d834370 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -1,13 +1,13 @@
/*
* drivers/net/ucc_geth_mii.h
*
- * Gianfar Ethernet Driver -- MII Management Bus Implementation
- * Driver for the MDIO bus controller in the Gianfar register space
+ * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
+ * Provides Bus interface for MII Management regs in the UCC register space
*
- * Author: Andy Fleming
- * Maintainer: Kumar Gala
+ * Copyright (C) 2007 Freescale Semiconductor, Inc.
*
- * Copyright (c) 2002-2004 Freescale Semiconductor, Inc.
+ * Authors: Li Yang <leoli@freescale.com>
+ * Kim Phillips <kim.phillips@freescale.com>
*
* 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
--
1.5.0.3
^ permalink raw reply related
* Re: Correct location for ADC/DAC drivers
From: Russell King @ 2007-05-02 19:11 UTC (permalink / raw)
To: Robert Schwebel; +Cc: linuxppc-dev, Guennadi Liakhovetski, linux-kernel
In-Reply-To: <20070502133512.GK22585@pengutronix.de>
On Wed, May 02, 2007 at 03:35:12PM +0200, Robert Schwebel wrote:
> On Wed, May 02, 2007 at 12:25:53PM +0200, Stefan Roese wrote:
> > Is there a maintainer for this "drivers/mfd" directory?
>
> rmk
I wouldn't go that far. There's no real infrastructure there
to maintain, so I'd actually say that the directory was
maintainerless. However, I'll own up to the UCB/MCP drivers
in there.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
^ permalink raw reply
* RE: RFC: new device types in the device tree (RE: [PATCH] powerpc: Add EDAC platform devices for 85xx)
From: Yoder Stuart-B08248 @ 2007-05-02 19:04 UTC (permalink / raw)
To: David Gibson, Segher Boessenkool; +Cc: linuxppc-dev, bluesmoke-devel
In-Reply-To: <20070502011957.GA12876@localhost.localdomain>
=20
> -----Original Message-----
> From: David Gibson [mailto:david@gibson.dropbear.id.au]=20
> Sent: Tuesday, May 01, 2007 8:20 PM
> To: Segher Boessenkool
> Cc: Yoder Stuart-B08248; linuxppc-dev@ozlabs.org;=20
> bluesmoke-devel@lists.sourceforge.net
> Subject: Re: RFC: new device types in the device tree (RE:=20
> [PATCH] powerpc: Add EDAC platform devices for 85xx)
>=20
> On Wed, May 02, 2007 at 02:34:45AM +0200, Segher Boessenkool wrote:
> > >> "name" =3D "memory-controller"
> > >> "compatible" =3D "fsl,85xx-memory-controller"
> > >> (or a more specific 85xx model if the controller
> > >> isn't identical across those chips)
> > >> No "device_type" at all, since there is no binding
> > >> for this kind of device.
> > >
> > > Is "no device_type" really the approach that should be
> > > taken?
> >=20
> > Yes.
> >=20
> > > booting-without-of.txt currently reads:
> > >
> > > Every node which actually represents an actual device
> > > (that is, a node which isn't only a virtual "container"
> > > for more nodes, like "/cpus" is) is also required to
> > > have a "device_type" property indicating the type of
> > > node
> >=20
> > That is wrong, IMNSHO.
>=20
> I tend to agree. Device drivers should generally be searching on the
> "compatible" property, not "device_type". Defining new device_type
> values isn't really of any use to the kernel, so we should just avoid
> it.
Right-- drivers search on "compatible".
But, don't we want to keep standardized sets of properties for
certain classes/types of devices? Defining a standardized,
required set of properties for a "network", "rom", or "i2c"
class of device is helpful. Without a standardized 'template'
of properties, developers may make up whatever properties they
want and things will work fine as long as the device tree and
driver are in sync. It works, but you wind up with a plethora
of properties each describing the same thing.
Stuart
If we do away with device_type,
what is it that defines a particular node to be a certain class
of device.
^ permalink raw reply
* RE: RFC: new device types in the device tree (RE: [PATCH] powerpc: Add EDAC platform devices for 85xx)
From: Yoder Stuart-B08248 @ 2007-05-02 18:50 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, david, bluesmoke-devel
In-Reply-To: <567cddf8855d809f2e0c5b4101c2c15a@kernel.crashing.org>
=20
> -----Original Message-----
> From: Segher Boessenkool [mailto:segher@kernel.crashing.org]=20
> Sent: Tuesday, May 01, 2007 7:35 PM
> To: Yoder Stuart-B08248
> Cc: Dave Jiang; linuxppc-dev@ozlabs.org;=20
> david@gibson.dropbear.id.au; bluesmoke-devel@lists.sourceforge.net
> Subject: Re: RFC: new device types in the device tree (RE:=20
> [PATCH] powerpc: Add EDAC platform devices for 85xx)
>=20
> >> "name" =3D "memory-controller"
> >> "compatible" =3D "fsl,85xx-memory-controller"
> >> (or a more specific 85xx model if the controller
> >> isn't identical across those chips)
> >> No "device_type" at all, since there is no binding
> >> for this kind of device.
> >
> > Is "no device_type" really the approach that should be
> > taken?
>=20
> Yes.
>=20
> > booting-without-of.txt currently reads:
> >
> > Every node which actually represents an actual device
> > (that is, a node which isn't only a virtual "container"
> > for more nodes, like "/cpus" is) is also required to
> > have a "device_type" property indicating the type of
> > node
>=20
> That is wrong, IMNSHO.
>=20
> > The 1275 spec is 'Open Firmware centric' in that it says
> > you don't need a device_type if the node is not used
> > by Open Firmware.
>=20
> It is "Open firmware centric" in every way; it is
> the Open firmware definition after all.
>=20
> "device_type" specifies what firmware interfaces a
> node implements. "name" and "compatible" are for
> the client (i.e., OS, bootloader, etc.) to use for
> matching drivers to device nodes.
The flat device tree standard (i.e. booting-without-of.txt)
certainly inherited stuff from IEEE-1275, but can diverge
if need be.
The document currently defines the device_type property
to specify the class of device. And it's required for
nodes describing a device.
name is always optional (as defined by b-w-of.txt)
There are no interfaces or methods with the device trees
defined in DTS files. Given that, does the the device_type
property have any value at all?
There are a slew of device_types defined in the DTS files
and in booting-without-of.txt. Should all these be
removed?
> It typically makes no sense to create a new "device_type"
> value for anything else than very generic classes of
> device, where you can drive the device without knowing
> anything else than what is defined in the binding for
> that "device_type".
What types devices get a device_type and which don't? Linux
drives the devices based on "compatible".
> > What should the approach be for new device types that
> > keep popping up? If the device type is generally useful
> > I think it makes sense to create a binding and add it to
> > booting-without-of.txt-- essentially documenting the
> > required properties, their values, and what they mean.
>=20
> And the associated methods and anything else that is
> needed. It would be a big mistake to create incompatibilities
> with "real OF" where those can be avoided just as easily.
But there are no methods.
Even if the kernel does not use 'device_type', the property
still seems to have some value in that it specifies a
required set of properties and their values for various
classes of devices.
Take a flash device for instance--
flash@ff000000 {
device_type =3D "rom";
compatible =3D "direct-mapped";
probe-type =3D "CFI";
reg =3D <ff000000 01000000>;
bank-width =3D <4>;
partitions =3D <00000000 00f80000
00f80000 00080001>;
partition-names =3D "fs\0firmware";
};
I suppose we can delete the device_type property and the
kernel will still be happy, but it's nice to have a standard
set of properties that everyone uses when describing a given
class of device. The device_type is just a convenient
identifer to refer to this device class and set of properties.
Stuart
^ permalink raw reply
* Inconsistent ramdisk generation
From: Clint Thomas @ 2007-05-02 18:48 UTC (permalink / raw)
To: linuxppc-embedded
This is a very generic ramdisk question, which I would think somebody
here might have an explanation for.
I wrote a small script that automates the process of creating my
ramdisks. It basically zeros out a block device file, formats it ext2,
drops my root file system into the file, zips it up and runs it through
the U-boot mkimage utility. Here is the gist of the steps it goes
through.
dd if=3D/dev/zero of=3DRAM_RFS bs=3D1k count=3D32768 (zero out device)
mke2fs -F -m0 RAM_RFS (format ext2)
tune2fs -c 0 -i 0 RAM_RFS (tune so it does not check FS)
mount -o loop RAM_RFS tmp_dir (mount block device to temp directory)
find . -depth -print | cpio -VBpdum ../tmp_dir (copy RFS into block
device)
dd if=3DRAM_RFS bs=3D1k | gzip -v9 > RAM_RFS.gz (compress block device)
./mkimage -T ramdisk -C gzip -n 'RFS Ramdisk' -d RAM_RFS.gz RAM_RFS
(make u-boot image)
The problem seems to be that whether this is done in a script, or by
hand, there are inconsistent builds that occur at random. Every couple
of times I build this, what happens is I program it into flash through
u-boot, and when the system boots up, it either boots correctly, or it
hiccups in one way or another. The problems range from either the kernel
trying to access an area of memory outside the 32MB, or the serial
console will stop accepting input, or the programs set to run on startup
will not run at all, etc..
This happens at random intervals, whether I have actually changed
anything in the file system or not, so even if I run through the exact
same process, without modifying anything going into the file system, it
will have this problem. There does not seem to be a clear explanation of
this behaviour. Just to be sure it was not my script, I added time
delays between the commands, just to be sure all the IO was finished
before any of the compression began, but that did not change anything
either. Any suggestions?
=20
Cheers,
Clinton Thomas
^ permalink raw reply
* Re: How do external irq's get mapped?
From: Andy Fleming @ 2007-05-02 18:42 UTC (permalink / raw)
To: Charles Krinke; +Cc: Randy Brown, Chris Carlson, Kevin Smith, linuxppc-embedded
In-Reply-To: <9F3F0A752CAEBE4FA7E906CC2FBFF57C06A1FC@MERCURY.inside.istor.com>
On May 1, 2007, at 18:11, Charles Krinke wrote:
> Please pardon the top post, it is done to help my local compatriots
> read
> more easily.
>
> Andy, our MPC85xx_OPENPIC_IRQ_OFFSET is 80, but the call to
> openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET) occurs after the two calls to
> openpic_set_sources. This leads me to believe that the mapping goes
>
> Internal irqs are 00..31 based on first openpic_set_sources(0, 32, ..)
> External irqs are 48..60 based on second openpic_set_sources(48, 12,
> ...)
>
> Then we have the openpic_init(80) call.
>
> So, I though the external IRQ0 was mapped to 48. But is it really
> mapped
> to 80 + 32 or 112 instead. If that is the case, there is another
> problem.
Yeah, the set_sources functions just initialize the array of
interrupts. The openpic_init() actually gives them numbers and stuff.
>
> The new problem is that if I set the irq to 112, when it is
> insmodded, I
> get an error from open_pic.c of the form:
>
> Open_pic.c:720 invalid irq 112
>
> This seems to be coming from the macro at line 144 in open_pic.c
>
> #define check_arg_irq(irq) \
> if (irq < open_pic_irq_offset || irq >=
> NumSources+open_pic_irq_offset \
> || ISR[irq - open_pic_irq_offset] == 0) { \
> printk("open_pic.c:%d: invalid irq %d\n", __LINE__, irq); \
> dump_stack(); }
Any chance you can identify:
1) Where this macro is being called from when it fails
2) Which of the 3 conditions above are actually true
Andy
^ permalink raw reply
* Re: mpc5200 and spi bus
From: Sascha Hauer @ 2007-05-02 17:36 UTC (permalink / raw)
To: Asier Llano Palacios; +Cc: Txema Lopez, linuxppc-embedded
In-Reply-To: <1178092964.25579.7.camel@a.llano.llano>
Hi,
On Wed, May 02, 2007 at 10:02:44AM +0200, Asier Llano Palacios wrote:
> >
>
> I'll have a look. If don't see anything the code from 2.4.x is good
> starting point to port it.
There was a patch for the PSC in SPI mode for 2.6 posted here:
http://sourceforge.net/mailarchive/forum.php?thread_name=45DD9ABF.9010009%40toptica.com&forum_name=spi-devel-general
I can forward you the patch if you like, because the sourceforge server
only replies with "Insufficient parameters" when I click on the patch
link :(
I myself wrote a driver for the dedicated SPI port which I can post on
spi-devel-general tomorrow (after I looked over it again).
Best regards,
Sascha
^ permalink raw reply
* Re: [PATCH] gianfar: Add I/O barriers when touching buffer descriptor ownership.
From: Segher Boessenkool @ 2007-05-02 18:05 UTC (permalink / raw)
To: Scott Wood; +Cc: netdev, jgarzik, linuxppc-dev
In-Reply-To: <4638B673.4090504@freescale.com>
>> AFAICS you need stronger barriers though; {w,r,}mb(),
>> to prevent _any_ reordering of those memory accesses,
>> not just the compiler-generated ones.
>
> My impression was that the eieio used by iobarrier would be sufficient
> for that, as we're not trying to synchronize between accesses to
> different types of memory. Is sync really required here?
For accesses to main system memory, eieio only orders
writes, not reads, so iobarrier_r() doesn't do what
you want; and iobarrier_w() isn't meant to be used for
main memory access ordering either.
Also, it is better to not use powerpc-specific interfaces
in a device driver if you don't have a strong reason to.
Segher
^ permalink raw reply
* [PATCH] bootwrapper: Only build cuImage if CONFIG_DEVICE_TREE is non-empty.
From: Scott Wood @ 2007-05-02 18:00 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
This allows the zImage target to once again be used to build
all supported image types, rather than requiring an explicit
"make uImage" to avoid failing to create an unneeded cuImage.
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/boot/Makefile | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 326ee92..f2d850c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -129,9 +129,12 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
image-$(CONFIG_PPC_CHRP) += zImage.chrp
image-$(CONFIG_PPC_EFIKA) += zImage.chrp
image-$(CONFIG_PPC_PMAC) += zImage.pmac
+image-$(CONFIG_DEFAULT_UIMAGE) += uImage
+
+ifneq ($(CONFIG_DEVICE_TREE),"")
image-$(CONFIG_PPC_83xx) += cuImage.83xx
image-$(CONFIG_PPC_85xx) += cuImage.85xx
-image-$(CONFIG_DEFAULT_UIMAGE) += uImage
+endif
# For 32-bit powermacs, build the COFF and miboot images
# as well as the ELF images.
--
1.5.0.3
^ permalink raw reply related
* Re: [PATCH] powermac: support G5 CPU hotplug
From: Segher Boessenkool @ 2007-05-02 17:57 UTC (permalink / raw)
To: Johannes Berg; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <1178116438.13233.65.camel@johannes.berg>
>> Ultimately we want to put the disabled cpus in sleep mode, but that
>> will require a suitable cache flush routine.
>
> I don't have any docs for the particular processors the G5s have, do
> they have a sleep mode?
Yes; they have many different power saving modes
(doze, nap, deep nap, sleep), and the clock can
be scaled down, too. The details are different
for each of 970, 970FX, 970MP.
Documentation for 970FX and 970MP is here:
<http://www-306.ibm.com/chips/techlib/techlib.nsf/products/
PowerPC_9XX_Microprocessors>
Segher
^ permalink raw reply
* Re: [PATCH 1/6] powerpc: split out CPU specific options into a new Kconfig file
From: Jon Loeliger @ 2007-05-02 17:51 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev@ozlabs.org, Paul Mackerras, Arnd Bergmann
In-Reply-To: <4638B42B.7040208@freescale.com>
On Wed, 2007-05-02 at 10:54, Timur Tabi wrote:
> Arnd Bergmann wrote:
>
> > +config CLASSIC32
> > + bool "52xx/6xx/7xx/74xx"
> > + select PPC_FPU
> > + select 6xx
> > + help
> > + There are four families of PowerPC chips supported. The more common
> > + types (601, 603, 604, 740, 750, 7400), the Motorola embedded
> > + versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the AMCC
> > + embedded versions (403 and 405) and the high end 64 bit Power
> > + processors (POWER 3, POWER4, and IBM PPC970 also known as G5).
>
> Is this help text still accurate? The bool line says "52xx/6xx/7xx/74xx", but you talk
> about many more processors in the help text. You mention the 83xx, but not the 85xx or
> 86xx, nor do you mention Freescale. Not only that, but the help text implies that 8xx,
> 52xx, 82xx, and 83xx are part of the same family, but the bool text implies that 52xx is
> part of a different family.
Timur,
Please read through the rest of the patch sequence.
This patch was just the "first step", moving things
around without additional changes.
jdl
^ permalink raw reply
* Problem inkluding *.h files when compiling module
From: Robert Staven @ 2007-05-02 17:46 UTC (permalink / raw)
To: linuxppc-embedded
I suspect this is slightly 'off topic' but have seen similar threads in
the lists archive so I go for it.
Testing some code (UDP by sockets example), and it compiles and works
great on both host(i386) and target (mpc8250)
I move the code to a module I'm working on and when I compile (for the
embedded platform) some of the needed header files is not found.
I suspect this is cause I'm missing some basic understanding of how
gcc/makefile/compiling modules works. But can't find any useful info.
Snip from my makefile:
KDIR := /home/mykernel/linuxppc-2.6
SDIR := /home/prog/sdlc
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(SDIR) modules
The KDIR is the problem, header files not found is under this dir (or
sub dirs).
But KDIR is supposed to point to my kernel source, isn't it?
Checking with gcc I find the places to look for my header files:
# powerpc-linux-gcc -print-search-dirs
<snip>
libraries: =
/opt/amltd/powerpc-linux/gcc-3.4.3-glibc-2.3.5/lib/gcc/powerpc-linux/3.4.3/:
/usr/lib/gcc/powerpc-linux/3.4.3/:
/opt/amltd/powerpc-linux/gcc-3.4.3-glibc-2.3.5/lib/gcc/powerpc-linux/3.4.3/../../../../powerpc-linux/lib/powerpc-linux/3.4.3/:
/opt/amltd/powerpc-linux/gcc-3.4.3-glibc-2.3.5/lib/gcc/powerpc-linux/3.4.3/../../../../powerpc-linux/lib/
But these dirs dosn't have my kernel source (as needed by KDIR)?
Any way to give the makefile several paths to search for files needed?
Grateful for any tips, places to find info or more relevant mail-lists!
br
Robert Staven
^ permalink raw reply
* Re: [PATCH 12/13] powerpc: Add bootwrapper support for Motorola PrPMC2800 platform
From: Milton Miller @ 2007-05-01 4:10 UTC (permalink / raw)
To: Mark A. Greer; +Cc: ppcdev
In-Reply-To: <20070430181954.GB7673@mag.az.mvista.com>
On Apr 30, 2007, at 1:19 PM, Mark A. Greer wrote:
> On Mon, Apr 30, 2007 at 11:15:23AM -0500, Milton Miller wrote:
>> On Thu Apr 26 10:02:27 EST 2007, Mark A. Greer wrote:
>>> Add support for Motorola ECC PrPMC280/PrPMC2800 Platform.
>>> The PrPMC280 sits on an F101 baseboard and the PrPMC2800 sits on a
>>> F101e baseboard. Logic has been added to determine which board
>>> (and variant thereof) the code is being run on.
>>> + setprop(devp, "device_type", "mv64362",
>>> strlen("mv64362") + 1);
>> That is not a device_type. It might be a model, Or even a
>> compatable. but not a type.
> How about "host-bridge" or is that too generic?
That would be ok but that could be precompiled, vs set in code.
I was thinking you wanted to expose the vpd determined specific
bridge to the kernel / user.
>>> +/* Following code is put at very beginning of zImage (64KB into ELF
>>> file) */
>>> +asm (" .globl _zimage_start\n\
>>> + _zimage_start:\n\
>>> + mfmsr 10\n\
>>> + rlwinm 10,10,0,~(1<<15) /* Clear MSR_EE */\n\
>>> + sync\n\
>>> + mtmsr 10\n\
>>> + isync\n\
>>> + b _zimage_start_lib\n\
>>> +");
>>>
>
> Yes, its a poorly worded comment.
>
>> Also, the 1<<15 seems magic. I would like to see it as a constant in
>> reg.h,
>
> It probably makes sense to add some MSR definitions to reg.h.
>
>> but to use that you would have to pass it as an i parameter, so
>
> I don't follow. What's wrong with '#define MSR_EE (1<<15)'
> in reg.h and 'rlwinm 10,10,0,~MSR_EE'?
I think you will find that cpp doesn't replace the define inside
the string. And by the time you stop the string, stringify the
define, and restart the string, you might as well pass it as a
parameter. Also, in C we sometimes add things like ULL that
aren't valid in assembler, although that's more of a 64 bit issue.
milton
^ permalink raw reply
* Re: [PATCH 12/13] powerpc: Add bootwrapper support for Motorola PrPMC2800 platform
From: Milton Miller @ 2007-05-01 17:06 UTC (permalink / raw)
To: Mark A. Greer; +Cc: ppcdev
In-Reply-To: <20070430181954.GB7673@mag.az.mvista.com>
On Apr 30, 2007, at 1:19 PM, Mark A. Greer wrote:
> On Mon, Apr 30, 2007 at 11:15:23AM -0500, Milton Miller wrote:
>> On Thu Apr 26 10:02:27 EST 2007, Mark A. Greer wrote:
>>> Add support for Motorola ECC PrPMC280/PrPMC2800 Platform.
>>> The PrPMC280 sits on an F101 baseboard and the PrPMC2800 sits on a
>>> F101e baseboard. Logic has been added to determine which board
>>> (and variant thereof) the code is being run on.
>>> + setprop(devp, "device_type", "mv64362",
>>> strlen("mv64362") + 1);
>> That is not a device_type. It might be a model, Or even a
>> compatable. but not a type.
> How about "host-bridge" or is that too generic?
That would be ok but that could be precompiled, vs set in code.
I was thinking you wanted to expose the vpd determined specific
bridge to the kernel / user.
>>> +/* Following code is put at very beginning of zImage (64KB into ELF
>>> file) */
>>> +asm (" .globl _zimage_start\n\
>>> + _zimage_start:\n\
>>> + mfmsr 10\n\
>>> + rlwinm 10,10,0,~(1<<15) /* Clear MSR_EE */\n\
>>> + sync\n\
>>> + mtmsr 10\n\
>>> + isync\n\
>>> + b _zimage_start_lib\n\
>>> +");
>>>
>
> Yes, its a poorly worded comment.
>
>> Also, the 1<<15 seems magic. I would like to see it as a constant in
>> reg.h,
>
> It probably makes sense to add some MSR definitions to reg.h.
>
>> but to use that you would have to pass it as an i parameter, so
>
> I don't follow. What's wrong with '#define MSR_EE (1<<15)'
> in reg.h and 'rlwinm 10,10,0,~MSR_EE'?
I think you will find that cpp doesn't replace the define inside
the string. And by the time you stop the string, stringify the
define, and restart the string, you might as well pass it as a
parameter. Also, in C we sometimes add things like ULL that
aren't valid in assembler, although that's more of a 64 bit issue.
milton
^ permalink raw reply
* [PATCH] add smp_call_function_map and smp_call_function_single
From: Will Schmidt @ 2007-05-02 17:12 UTC (permalink / raw)
To: linuxppc-dev, paulus, anton
Add a new function named smp_call_function_single(). This matches a generic
prototype from include/linux/smp.h.
Add a function smp_call_function_map(). This is, for the most part, a rename
of smp_call_function, with some added cpumask support. smp_call_function and
smp_call_function_single call into smp_call_function_map.
Lightly tested on 970mp (blade), power4 and power5.
Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
cc: Anton Blanchard <anton@samba.org>
---
arch/powerpc/kernel/smp.c | 73 ++++++++++++++++++++++++++++++++-------------
1 files changed, 52 insertions(+), 21 deletions(-)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 924d692..4878588 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -176,10 +176,10 @@ static struct call_data_struct {
#define SMP_CALL_TIMEOUT 8
/*
- * This function sends a 'generic call function' IPI to all other CPUs
- * in the system.
+ * These functions send a 'generic call function' IPI to other online
+ * CPUS in the system.
*
- * [SUMMARY] Run a function on all other CPUs.
+ * [SUMMARY] Run a function on other CPUs.
* <func> The function to run. This must be fast and non-blocking.
* <info> An arbitrary pointer to pass to the function.
* <nonatomic> currently unused.
@@ -190,18 +190,26 @@ static struct call_data_struct {
* You must not call this function with disabled interrupts or from a
* hardware interrupt handler or from a bottom half handler.
*/
-int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
- int wait)
-{
+int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
+ int wait, cpumask_t map)
+{
struct call_data_struct data;
- int ret = -1, cpus;
+ int ret = -1, num_cpus;
+ int cpu;
u64 timeout;
/* Can deadlock when called with interrupts disabled */
WARN_ON(irqs_disabled());
+ /* remove 'self' from the map */
+ if (cpu_isset(smp_processor_id(), map))
+ cpu_clear(smp_processor_id(), map);
+
+ /* sanity check the map, remove any non-online processors. */
+ cpus_and(map, map, cpu_online_map);
+
if (unlikely(smp_ops == NULL))
- return -1;
+ return ret;
data.func = func;
data.info = info;
@@ -213,40 +221,42 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
spin_lock(&call_lock);
/* Must grab online cpu count with preempt disabled, otherwise
* it can change. */
- cpus = num_online_cpus() - 1;
- if (!cpus) {
+ num_cpus = num_online_cpus() - 1;
+ if (!num_cpus || cpus_empty(map)) {
ret = 0;
goto out;
}
call_data = &data;
smp_wmb();
- /* Send a message to all other CPUs and wait for them to respond */
- smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_CALL_FUNCTION);
+ /* Send a message to all CPUs in the map */
+ for_each_cpu_mask(cpu, map)
+ smp_ops->message_pass(cpu, PPC_MSG_CALL_FUNCTION);
timeout = get_tb() + (u64) SMP_CALL_TIMEOUT * tb_ticks_per_sec;
- /* Wait for response */
- while (atomic_read(&data.started) != cpus) {
+ /* Wait for indication that they have received the message */
+ while (atomic_read(&data.started) != num_cpus) {
HMT_low();
if (get_tb() >= timeout) {
printk("smp_call_function on cpu %d: other cpus not "
- "responding (%d)\n", smp_processor_id(),
- atomic_read(&data.started));
+ "responding (%d)\n", smp_processor_id(),
+ atomic_read(&data.started));
debugger(NULL);
goto out;
}
}
+ /* optionally wait for the CPUs to complete */
if (wait) {
- while (atomic_read(&data.finished) != cpus) {
+ while (atomic_read(&data.finished) != num_cpus) {
HMT_low();
if (get_tb() >= timeout) {
printk("smp_call_function on cpu %d: other "
- "cpus not finishing (%d/%d)\n",
- smp_processor_id(),
- atomic_read(&data.finished),
- atomic_read(&data.started));
+ "cpus not finishing (%d/%d)\n",
+ smp_processor_id(),
+ atomic_read(&data.finished),
+ atomic_read(&data.started));
debugger(NULL);
goto out;
}
@@ -262,8 +272,29 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
return ret;
}
+int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
+ int wait)
+{
+ return smp_call_function_map(func,info,nonatomic,wait,cpu_online_map);
+}
EXPORT_SYMBOL(smp_call_function);
+int smp_call_function_single(int cpu, void (*func) (void *info), void *info, int nonatomic,
+ int wait)
+{
+ cpumask_t map=CPU_MASK_NONE;
+
+ if (!cpu_online(cpu))
+ return -EINVAL;
+
+ if (cpu == smp_processor_id())
+ return -EBUSY;
+
+ cpu_set(cpu, map);
+ return smp_call_function_map(func,info,nonatomic,wait,map);
+}
+EXPORT_SYMBOL(smp_call_function_single);
+
void smp_call_function_interrupt(void)
{
void (*func) (void *info);
^ permalink raw reply related
* [PATCH 2/2] powerpc: change topology_init() to a subsys_initcall
From: Kevin Corry @ 2007-05-02 17:11 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel; +Cc: Stephane Eranian, Carl Love
In-Reply-To: <200705021208.59068.kevcorry@us.ibm.com>
Change the powerpc version of topology_init() from an __initcall to
a subsys_initcall to match all other architectures.
Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Index: linux-2.6.21/arch/powerpc/kernel/sysfs.c
===================================================================
--- linux-2.6.21.orig/arch/powerpc/kernel/sysfs.c
+++ linux-2.6.21/arch/powerpc/kernel/sysfs.c
@@ -498,4 +498,4 @@ static int __init topology_init(void)
return 0;
}
-__initcall(topology_init);
+subsys_initcall(topology_init);
^ permalink raw reply
* [PATCH 1/2] powerpc: add smp_call_function_single()
From: Kevin Corry @ 2007-05-02 17:10 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel; +Cc: Stephane Eranian, Carl Love
In-Reply-To: <200705021208.59068.kevcorry@us.ibm.com>
Add an smp_call_function_single() to the powerpc architecture. Since this
is very similar to the existing smp_call_function() routine, the common
portions have been split out into __smp_call_function(). Since the
spin_lock(&call_lock) was moved to __smp_call_function(),
smp_call_function() now explicitly calls preempt_disable() before getting
the count of online CPUs.
Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Index: linux-2.6.21/arch/powerpc/kernel/smp.c
===================================================================
--- linux-2.6.21.orig/arch/powerpc/kernel/smp.c
+++ linux-2.6.21/arch/powerpc/kernel/smp.c
@@ -175,26 +175,11 @@ static struct call_data_struct {
/* delay of at least 8 seconds */
#define SMP_CALL_TIMEOUT 8
-/*
- * This function sends a 'generic call function' IPI to all other CPUs
- * in the system.
- *
- * [SUMMARY] Run a function on all other CPUs.
- * <func> The function to run. This must be fast and non-blocking.
- * <info> An arbitrary pointer to pass to the function.
- * <nonatomic> currently unused.
- * <wait> If true, wait (atomically) until function has completed on other CPUs.
- * [RETURNS] 0 on success, else a negative status code. Does not return until
- * remote CPUs are nearly ready to execute <<func>> or are or have executed.
- *
- * You must not call this function with disabled interrupts or from a
- * hardware interrupt handler or from a bottom half handler.
- */
-int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
- int wait)
-{
+static int __smp_call_function(void (*func)(void *info), void *info,
+ int wait, int target_cpu, int num_cpus)
+{
struct call_data_struct data;
- int ret = -1, cpus;
+ int ret = -1;
u64 timeout;
/* Can deadlock when called with interrupts disabled */
@@ -211,40 +196,33 @@ int smp_call_function (void (*func) (voi
atomic_set(&data.finished, 0);
spin_lock(&call_lock);
- /* Must grab online cpu count with preempt disabled, otherwise
- * it can change. */
- cpus = num_online_cpus() - 1;
- if (!cpus) {
- ret = 0;
- goto out;
- }
call_data = &data;
smp_wmb();
/* Send a message to all other CPUs and wait for them to respond */
- smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_CALL_FUNCTION);
+ smp_ops->message_pass(target_cpu, PPC_MSG_CALL_FUNCTION);
timeout = get_tb() + (u64) SMP_CALL_TIMEOUT * tb_ticks_per_sec;
/* Wait for response */
- while (atomic_read(&data.started) != cpus) {
+ while (atomic_read(&data.started) != num_cpus) {
HMT_low();
if (get_tb() >= timeout) {
- printk("smp_call_function on cpu %d: other cpus not "
- "responding (%d)\n", smp_processor_id(),
- atomic_read(&data.started));
+ printk("%s on cpu %d: other cpus not "
+ "responding (%d)\n", __FUNCTION__,
+ smp_processor_id(), atomic_read(&data.started));
debugger(NULL);
goto out;
}
}
if (wait) {
- while (atomic_read(&data.finished) != cpus) {
+ while (atomic_read(&data.finished) != num_cpus) {
HMT_low();
if (get_tb() >= timeout) {
- printk("smp_call_function on cpu %d: other "
- "cpus not finishing (%d/%d)\n",
- smp_processor_id(),
+ printk("%s on cpu %d: other cpus "
+ "not finishing (%d/%d)\n",
+ __FUNCTION__, smp_processor_id(),
atomic_read(&data.finished),
atomic_read(&data.started));
debugger(NULL);
@@ -262,8 +240,74 @@ int smp_call_function (void (*func) (voi
return ret;
}
+/*
+ * This function sends a 'generic call function' IPI to all other CPUs
+ * in the system.
+ *
+ * [SUMMARY] Run a function on all other CPUs.
+ * <func> The function to run. This must be fast and non-blocking.
+ * <info> An arbitrary pointer to pass to the function.
+ * <nonatomic> currently unused.
+ * <wait> If true, wait (atomically) until function has completed on other CPUs.
+ * [RETURNS] 0 on success, else a negative status code. Does not return until
+ * remote CPUs are nearly ready to execute <<func>> or are or have executed.
+ *
+ * You must not call this function with disabled interrupts or from a
+ * hardware interrupt handler or from a bottom half handler.
+ */
+int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
+ int wait)
+{
+ int num_cpus, ret = 0;
+
+ /* Must grab online cpu count with preempt disabled, otherwise
+ * it can change. */
+ preempt_disable();
+ num_cpus = num_online_cpus() - 1;
+ if (num_cpus) {
+ ret = __smp_call_function(func, info, wait,
+ MSG_ALL_BUT_SELF, num_cpus);
+ }
+ preempt_enable();
+ return ret;
+}
+
EXPORT_SYMBOL(smp_call_function);
+/*
+ * This function sends a 'generic call function' IPI to the specified CPU.
+ *
+ * [SUMMARY] Run a function on the specified CPUs.
+ * <cpuid> The CPU to run the function on.
+ * <func> The function to run. This must be fast and non-blocking.
+ * <info> An arbitrary pointer to pass to the function.
+ * <nonatomic> currently unused.
+ * <wait> If true, wait (atomically) until function has completed on the
+ * other CPU.
+ * [RETURNS] 0 on success, else a negative status code. Does not return until
+ * remote CPU is nearly ready to execute <<func>> or are or has executed.
+ *
+ * You must not call this function with disabled interrupts or from a
+ * hardware interrupt handler or from a bottom half handler.
+ */
+int smp_call_function_single(int cpuid, void (*func)(void *info), void *info,
+ int nonatomic, int wait)
+{
+ int ret;
+
+ /* Prevent preemption and reschedule on another processor */
+ if (get_cpu() == cpuid) {
+ printk(KERN_INFO "%s: trying to call self\n", __FUNCTION__);
+ ret = -EBUSY;
+ } else
+ ret = __smp_call_function(func, info, wait, cpuid, 1);
+
+ put_cpu();
+ return ret;
+}
+
+EXPORT_SYMBOL(smp_call_function_single);
+
void smp_call_function_interrupt(void)
{
void (*func) (void *info);
^ permalink raw reply
* [PATCH 0/2] powerpc: perfmon2 prereqs
From: Kevin Corry @ 2007-05-02 17:08 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel; +Cc: Stephane Eranian, Carl Love
Hi,
This is a repost of a couple patches I posted about a month ago related to
porting perfmon2 to powerpc. I wanted to see if there were any further
comments on these patches, and also wanted to ask if these should be
submitted separately to the ppc kernel maintainers, or if they should be kept
with the perfmon2 patches until those are submitted.
The first patch adds an smp_call_function_single() routine for powerpc. In
2.6.21, there's a prototype for this routine in include/linux/smp.h, and it
is implemented on i386, ia64, and x86-64. Since this routine is very similar
to the existing smp_call_function() routine, the common portions have been
pulled out into __smp_call_function(). Perfmon2 uses this unload a context
that's loaded on a CPU other than the one that's performing the close-context
routine.
The second patch changes the powerpc version of topology_init() from an
__initcall to a subsys_initcall, which matches the definition of
topology_init() on all other architectures. Perfmon2's initialization is done
as a subsys_initcall, but it fails to set up its sysfs information if
topology_init() has not yet run. Changing perfmon2 to an __initcall() was
discussed, but we came to the conclusion that this would not work because the
perfmon2 core must be initialized before any of its sub-modules. These
sub-modules are located in arch/*/perfmon/, and thus if they are built
statically they would run their module_init routines before the perfmon2 core
ran its __initcall routine.
We have been running tests with these patches for the last few weeks on Cell
and Power5 systems without any problems.
Thanks,
--
Kevin Corry
kevcorry@us.ibm.com
http://www.ibm.com/linux/
^ permalink raw reply
* Re: [RFC] SystemACE driver - abstract register ops
From: Wolfgang Reissnegger @ 2007-05-02 16:50 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linuxppc-embedded
In-Reply-To: <87d51j5ph7.fsf@sleipner.barco.com>
Hi Peter,
thanks for the feedback.
Yes, I agree. Having the code in mainline would be most preferable.
However, there is always a delay between when people submit patches and
when code actually does get into mainline. Also, it's not always
guaranteed that the code is actually accepted into mainline. In the
meantime there are a multitude of patches floating around which IMHO can
be quite confusing.
The purpose of the "Xilinx git tree" is to provide a central place where
those patches can be accumulated, including PPC and MicroBlaze. Also, as
Xilinx is creating new IP cores, drivers for those cores will be
directly added to that tree, eliminating the EDK->Linux horrors.
So, yes, I think it's partly a staging area for code that should make it
into mainline, but it's also a repository for code that is not accepted
into mainline (yet), or new, or otherwise useful to the community.
Wolfgang
Peter Korsgaard wrote:
>>>>>> "WR" == Wolfgang Reissnegger <wolfgang.reissnegger@xilinx.com> writes:
>
> Hi,
>
> WR> The end goal is to have a kernel tree that contains ALL Xilinx
> WR> drivers and the multitude of drivers that are being
> WR> created/updated and contributed here. Having such a kernel
> WR> available will simplify the process of bringing up a new
> WR> system. The hope is that contributors will adopt the idea of
> WR> having a "Xilinx" kernel and will start using that tree as a "base
> WR> reference".
>
> But there already is such a tree - It's called 'mainline'. I can see
> some advantage in having a Xilinx tree as a staging area, but it
> really HAS to be a temporary thing and stuff needs to be pushed to
> mainline.
>
> WR> I will post news here as they unfold. In the meantime it would be
> WR> very interesting to hear ideas and suggestions from you. Concerns
> WR> that people have. Pitfalls to look out for etc.
>
> Hereby my 2 cents.
>
^ permalink raw reply
* Re: [PATCH 1/6] powerpc: split out CPU specific options into a new Kconfig file
From: Arnd Bergmann @ 2007-05-02 16:40 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev, paulus
In-Reply-To: <4638B42B.7040208@freescale.com>
On Wednesday 02 May 2007, Timur Tabi wrote:
> Arnd Bergmann wrote:
>
> > +config CLASSIC32
> > + bool "52xx/6xx/7xx/74xx"
> > + select PPC_FPU
> > + select 6xx
> > + help
> > + There are four families of PowerPC chips supported. The more common
> > + types (601, 603, 604, 740, 750, 7400), the Motorola embedded
> > + versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the AMCC
> > + embedded versions (403 and 405) and the high end 64 bit Power
> > + processors (POWER 3, POWER4, and IBM PPC970 also known as G5).
>
> Is this help text still accurate? The bool line says "52xx/6xx/7xx/74xx", but you talk
> about many more processors in the help text. You mention the 83xx, but not the 85xx or
> 86xx, nor do you mention Freescale. Not only that, but the help text implies that 8xx,
> 52xx, 82xx, and 83xx are part of the same family, but the bool text implies that 52xx is
> part of a different family.
This patch just moves stuff around, one of the later patches fixes the
text.
> > + This option is the catch-all for 6xx types, including some of the
> > + embedded versions. Unless there is see an option for the specific
> > + chip family you are using, you want this option.
>
> So CLASSIC32 is only for 6xx families, not any of the others? Then what's the "select
> 6xx" for? Isn't that redundant?
Currently, CLASSIC32 refers to all Open Firmware based 6xx machines, including
PowerMac, rs6000, CHRP and PReP. 6xx includes those, and also the embedded
platforms based on 6xx cores, like 86xx.
My last patch changes it so that CLASSIC32 and 6xx are actually synonyms,
and we could kill one of them.
> > + You do not want this if you are building a kernel for a 64 bit
> > + IBM RS/6000 or an Apple G5, choose 6xx.
>
> This needs to be reworded, as the English doesn't make sense.
It also gets fixed in a later patch.
Arnd <><
^ permalink raw reply
* Re: [PATCH] Xilinx framebuffer device driver - 2nd version
From: Andrei Konovalov @ 2007-05-02 16:34 UTC (permalink / raw)
To: Grant Likely; +Cc: rick.moleres, arnd, linuxppc-embedded
In-Reply-To: <528646bc0704300201h55a9aa0aw84c24c0c9dfa6600@mail.gmail.com>
Grant Likely wrote:
> On 4/26/07, Andrei Konovalov <akonovalov@ru.mvista.com> wrote:
>> Add support for the video controller IP block included into Xilinx
>> ML300 and
>> ML403 reference designs.
>>
>> Signed-off-by: Andrei Konovalov <akonovalov@ru.mvista.com>
>> ---
>>
>> This patch relies on the "Patchset to establish sanity in Xilinx
>> Virtex support" by Gran Likely to have
>> the frame buffer device registered on the platform bus. Without this
>> patchset one needs to fill in
>> the struct platform_device and make sure platform_device_register() is
>> called elsewhere.
>> The DCR access has been added but not tested - my targets are
>> configured in the "memory mapped IO" way.
>> I would appreciate if those having the video controller registers
>> accessible as DCRs
>> test the DCR mode.
>>
>> This is the 2nd version that addresses what was pointed out by Arnd
>> and Grant.
>> Please find the interdiff against the 1st version below, and the whole
>> patch attached to this message
>> Comments are welcome.
>
> First off; I'm an idiot. The ml403 ref design *does* use the opb2dcr
> bridge; and my design *does not* use DCR instructions; so I haven't
> been able to test direct DCR access. :-) It might just be better to
> drop the DCR stuff for now until it's accepted into mainline; or
> someone is able to test it.
I am inclined to leave the xilinx_fb_out_be32(driverdata, offset, val)
macro in the form of:
/*
* The LCD controller has DCR interface to its registers, but all
* the boards and configurations the driver has been tested with
* use opb2dcr bridge. So the registers are seen as memory mapped.
* This macro is to make it simple to add the direct DCR access
* when it's needed.
*/
#define xilinx_fb_out_be32(driverdata, offset, val) \
out_be32(driverdata->regs + offset, val)
> I've got it running on my custom board. Seems to work well and it's
> more featureful than my driver, so I'll migrate over to using yours.
> The design that I'm using has a different color map from the ml300 ref
> design. blue is at offset 0 and red offset 16 (vs. blue-16 and red-0
> on the ml300 ref design). It's probably worthwhile to add those
> parameters to the xilinxfb_platform_data structure.
I've tested the driver with both ML300 and ML403 reference designs,
and *both* have blue at offset 0 and red at offset 16.
The "PLB TFT LCD Controller" documentation I have doesn't notice
any possibility to make the color map different from that.
>> Would be nice to get this driver into mainline for the 2.6.22.
>
> I certainly support getting it submitted. Have you emailed it to the
> linux-fb-devel list?
Not yet.
Not until we settle down on registers access, color map and other
hardware related stuff.
> Can you split the driver and the platform device registration up into
> 2 patches?
Good idea. Will do.
> It will probably make submission less painful; the device
> registration patch can go through paulus, and the driver itself
> through the linux-fbdev-devel list.
>
>> ===================================================================
>> --- linux-2.6.20.orig/drivers/video/Kconfig
>> +++ linux-2.6.20/drivers/video/Kconfig
>> @@ -1648,6 +1648,16 @@ config FB_XILINX_ROTATE
>> bool "Rotate display"
>> depends on FB_XILINX
>>
>> +config FB_XILINX_SCR_HEIGHT
>> + int "Screen height in mm"
>> + depends on FB_XILINX
>> + default 99
>> +
>> +config FB_XILINX_SCR_WIDTH
>> + int "Screen width in mm"
>> + depends on FB_XILINX
>> + default 132
>> +
>
> I'm not so fond of doing this via KCONFIG options; at least not at the
> driver level. Also, the board I'm using will have 2 of these cores,
> each with different display dimesions. For these parameters, I think
> it makes more sense for the board setup code to override
> virtex_device_fixup() and insert the correct values into the pdata
> structure before virtex_init() registers the device. Individual board
> ports can add Kconfig setting for the dimensions if appropriate for
> the system.
Will remove these KCONFIG options and add virtex_device_fixup()
to arch/ppc/platforms/4xx/xilinx_ml300.c and arch/ppc/platforms/4xx/xilinx_ml403.c
in the new version of the xilinxfb patch (the platform device registration
part).
Thanks,
Andrei
> Cheers,
> g.
>
^ permalink raw reply
* Re: [PATCH 2/2] Rename get_property to of_get_property: drivers/net
From: Kumar Gala @ 2007-05-02 16:14 UTC (permalink / raw)
To: Jeff Garzik; +Cc: sfr, netdev, linuxppc-dev, paulus, akpm, David Miller
In-Reply-To: <4638B597.20604@garzik.org>
On Wed, 2 May 2007, Jeff Garzik wrote:
> Kumar Gala wrote:
> >
> > On May 2, 2007, at 9:17 AM, Jeff Garzik wrote:
> >
> > > Kumar Gala wrote:
> > > > On Apr 28, 2007, at 10:47 PM, David Miller wrote:
> > > > > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > > Date: Sun, 29 Apr 2007 11:44:46 +1000
> > > > >
> > > > > > So can I take this as a future OK for architecture specific network
> > > > > > drivers changes to go through the architecture trees (cc'd to you)?
> > > > >
> > > > > It's been my experience that if I'm just working through some
> > > > > platform or bus specific API changes, people like Jeff tend to
> > > > > not mind if it goes via ARCH trees and the like.
> > > > Is this acceptable? Just want to make sure before I ask Paul to pull
> > > > some changes that touches the following drivers:
> > > > drivers/net/fs_enet/mac-scc.c | 2 +-
> > > > drivers/net/ucc_geth.c | 30 ++++----
> > > > drivers/serial/cpm_uart/cpm_uart_cpm1.c | 4 +-
> > > > drivers/serial/cpm_uart/cpm_uart_cpm2.c | 4 +-
> > >
> > > I don't see a patch, just a diffstat.
> >
> > I haven't sent a patch, just asking the question if I need to break it up or
> > not.
>
> Without seeing the patch, I have no idea...
Here's an older version of the patch (may need to respin for it to apply
cleanly)
>From 2dd748e71cd24641c4c5d2aa6fbf86c72080ed0d Mon Sep 17 00:00:00 2001
From: Timur Tabi <timur@freescale.com>
Date: Thu, 12 Apr 2007 17:44:06 -0500
Subject: [PATCH] [POWERPC] Change rheap functions to use ulongs instead of pointers
The rheap allocation functions return a pointer, but the actual value is based
on how the heap was initialized, and so it can be anything, e.g. an offset
into a buffer. A ulong is a better representation of the value returned by
the allocation functions.
This patch changes all of the relevant rheap functions to use a unsigned long
integers instead of a pointer. In case of an error, the value returned is
a negative error code that has been cast to an unsigned long. The caller can
use the IS_ERR_VALUE() macro to check for this.
All code which calls the rheap functions is updated accordingly. Macros
IS_MURAM_ERR() and IS_DPERR(), have been deleted in favor of IS_ERR_VALUE().
Also added error checking to rh_attach_region().
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
arch/powerpc/lib/rheap.c | 117 ++++++++++++++++++-------------
arch/powerpc/sysdev/commproc.c | 20 +++---
arch/powerpc/sysdev/cpm2_common.c | 21 +++---
arch/powerpc/sysdev/qe_lib/qe.c | 29 ++++----
arch/powerpc/sysdev/qe_lib/ucc_fast.c | 5 +-
arch/powerpc/sysdev/qe_lib/ucc_slow.c | 7 +-
arch/ppc/8xx_io/commproc.c | 22 +++---
arch/ppc/lib/rheap.c | 95 +++++++++++++------------
arch/ppc/syslib/cpm2_common.c | 23 +++---
drivers/net/fs_enet/mac-scc.c | 2 +-
drivers/net/ucc_geth.c | 30 ++++----
drivers/serial/cpm_uart/cpm_uart_cpm1.c | 4 +-
drivers/serial/cpm_uart/cpm_uart_cpm2.c | 4 +-
include/asm-powerpc/qe.h | 13 +---
include/asm-ppc/commproc.h | 13 +---
include/asm-ppc/cpm2.h | 13 +---
include/asm-ppc/rheap.h | 20 +++---
17 files changed, 221 insertions(+), 217 deletions(-)
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 6c5c5dd..b2f6dcc 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -133,7 +133,7 @@ static rh_block_t *get_slot(rh_info_t * info)
info->empty_slots--;
/* Initialize */
- blk->start = NULL;
+ blk->start = 0;
blk->size = 0;
blk->owner = NULL;
@@ -158,7 +158,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
/* We assume that they are aligned properly */
size = blkn->size;
- s = (unsigned long)blkn->start;
+ s = blkn->start;
e = s + size;
/* Find the blocks immediately before and after the given one
@@ -170,7 +170,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
list_for_each(l, &info->free_list) {
blk = list_entry(l, rh_block_t, list);
- bs = (unsigned long)blk->start;
+ bs = blk->start;
be = bs + blk->size;
if (next == NULL && s >= bs)
@@ -188,10 +188,10 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
}
/* Now check if they are really adjacent */
- if (before != NULL && s != (unsigned long)before->start + before->size)
+ if (before && s != (before->start + before->size))
before = NULL;
- if (after != NULL && e != (unsigned long)after->start)
+ if (after && e != after->start)
after = NULL;
/* No coalescing; list insert and return */
@@ -216,7 +216,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
/* Grow the after block backwards */
if (before == NULL && after != NULL) {
- after->start = (int8_t *)after->start - size;
+ after->start -= size;
after->size += size;
return;
}
@@ -321,14 +321,14 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
}
/* Attach a free memory region, coalesces regions if adjuscent */
-int rh_attach_region(rh_info_t * info, void *start, int size)
+int rh_attach_region(rh_info_t * info, unsigned long start, int size)
{
rh_block_t *blk;
unsigned long s, e, m;
int r;
/* The region must be aligned */
- s = (unsigned long)start;
+ s = start;
e = s + size;
m = info->alignment - 1;
@@ -338,9 +338,12 @@ int rh_attach_region(rh_info_t * info, void *start, int size)
/* Round end down */
e = e & ~m;
+ if (IS_ERR_VALUE(e) || (e < s))
+ return -ERANGE;
+
/* Take final values */
- start = (void *)s;
- size = (int)(e - s);
+ start = s;
+ size = e - s;
/* Grow the blocks, if needed */
r = assure_empty(info, 1);
@@ -358,7 +361,7 @@ int rh_attach_region(rh_info_t * info, void *start, int size)
}
/* Detatch given address range, splits free block if needed. */
-void *rh_detach_region(rh_info_t * info, void *start, int size)
+unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
{
struct list_head *l;
rh_block_t *blk, *newblk;
@@ -366,10 +369,10 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
/* Validate size */
if (size <= 0)
- return ERR_PTR(-EINVAL);
+ return (unsigned long) -EINVAL;
/* The region must be aligned */
- s = (unsigned long)start;
+ s = start;
e = s + size;
m = info->alignment - 1;
@@ -380,34 +383,34 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
e = e & ~m;
if (assure_empty(info, 1) < 0)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
blk = NULL;
list_for_each(l, &info->free_list) {
blk = list_entry(l, rh_block_t, list);
/* The range must lie entirely inside one free block */
- bs = (unsigned long)blk->start;
- be = (unsigned long)blk->start + blk->size;
+ bs = blk->start;
+ be = blk->start + blk->size;
if (s >= bs && e <= be)
break;
blk = NULL;
}
if (blk == NULL)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
/* Perfect fit */
if (bs == s && be == e) {
/* Delete from free list, release slot */
list_del(&blk->list);
release_slot(info, blk);
- return (void *)s;
+ return s;
}
/* blk still in free list, with updated start and/or size */
if (bs == s || be == e) {
if (bs == s)
- blk->start = (int8_t *)blk->start + size;
+ blk->start += size;
blk->size -= size;
} else {
@@ -416,25 +419,29 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
/* the back free fragment */
newblk = get_slot(info);
- newblk->start = (void *)e;
+ newblk->start = e;
newblk->size = be - e;
list_add(&newblk->list, &blk->list);
}
- return (void *)s;
+ return s;
}
-void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner)
+/* Allocate a block of memory at the specified alignment. The value returned
+ * is an offset into the buffer initialized by rh_init(), or a negative number
+ * if there is an error.
+ */
+unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner)
{
struct list_head *l;
rh_block_t *blk;
rh_block_t *newblk;
- void *start;
+ unsigned long start;
- /* Validate size, (must be power of two) */
+ /* Validate size, and alignment must be power of two */
if (size <= 0 || (alignment & (alignment - 1)) != 0)
- return ERR_PTR(-EINVAL);
+ return (unsigned long) -EINVAL;
/* given alignment larger that default rheap alignment */
if (alignment > info->alignment)
@@ -444,7 +451,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
size = (size + (info->alignment - 1)) & ~(info->alignment - 1);
if (assure_empty(info, 1) < 0)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
blk = NULL;
list_for_each(l, &info->free_list) {
@@ -455,7 +462,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
}
if (blk == NULL)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
/* Just fits */
if (blk->size == size) {
@@ -475,7 +482,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
newblk->owner = owner;
/* blk still in free list, with updated start, size */
- blk->start = (int8_t *)blk->start + size;
+ blk->start += size;
blk->size -= size;
start = newblk->start;
@@ -486,19 +493,25 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne
/* this is no problem with the deallocator since */
/* we scan for pointers that lie in the blocks */
if (alignment > info->alignment)
- start = (void *)(((unsigned long)start + alignment - 1) &
- ~(alignment - 1));
+ start = (start + alignment - 1) & ~(alignment - 1);
return start;
}
-void *rh_alloc(rh_info_t * info, int size, const char *owner)
+/* Allocate a block of memory at the default alignment. The value returned is
+ * an offset into the buffer initialized by rh_init(), or a negative number if
+ * there is an error.
+ */
+unsigned long rh_alloc(rh_info_t * info, int size, const char *owner)
{
return rh_alloc_align(info, size, info->alignment, owner);
}
-/* allocate at precisely the given address */
-void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
+/* Allocate a block of memory at the given offset, rounded up to the default
+ * alignment. The value returned is an offset into the buffer initialized by
+ * rh_init(), or a negative number if there is an error.
+ */
+unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner)
{
struct list_head *l;
rh_block_t *blk, *newblk1, *newblk2;
@@ -506,10 +519,10 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
/* Validate size */
if (size <= 0)
- return ERR_PTR(-EINVAL);
+ return (unsigned long) -EINVAL;
/* The region must be aligned */
- s = (unsigned long)start;
+ s = start;
e = s + size;
m = info->alignment - 1;
@@ -520,20 +533,20 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
e = e & ~m;
if (assure_empty(info, 2) < 0)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
blk = NULL;
list_for_each(l, &info->free_list) {
blk = list_entry(l, rh_block_t, list);
/* The range must lie entirely inside one free block */
- bs = (unsigned long)blk->start;
- be = (unsigned long)blk->start + blk->size;
+ bs = blk->start;
+ be = blk->start + blk->size;
if (s >= bs && e <= be)
break;
}
if (blk == NULL)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
/* Perfect fit */
if (bs == s && be == e) {
@@ -551,7 +564,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
/* blk still in free list, with updated start and/or size */
if (bs == s || be == e) {
if (bs == s)
- blk->start = (int8_t *)blk->start + size;
+ blk->start += size;
blk->size -= size;
} else {
@@ -560,14 +573,14 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
/* The back free fragment */
newblk2 = get_slot(info);
- newblk2->start = (void *)e;
+ newblk2->start = e;
newblk2->size = be - e;
list_add(&newblk2->list, &blk->list);
}
newblk1 = get_slot(info);
- newblk1->start = (void *)s;
+ newblk1->start = s;
newblk1->size = e - s;
newblk1->owner = owner;
@@ -577,7 +590,11 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
return start;
}
-int rh_free(rh_info_t * info, void *start)
+/* Deallocate the memory previously allocated by one of the rh_alloc functions.
+ * The return value is the size of the deallocated block, or a negative number
+ * if there is an error.
+ */
+int rh_free(rh_info_t * info, unsigned long start)
{
rh_block_t *blk, *blk2;
struct list_head *l;
@@ -642,7 +659,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
return nr;
}
-int rh_set_owner(rh_info_t * info, void *start, const char *owner)
+int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
{
rh_block_t *blk, *blk2;
struct list_head *l;
@@ -684,8 +701,8 @@ void rh_dump(rh_info_t * info)
nr = maxnr;
for (i = 0; i < nr; i++)
printk(KERN_INFO
- " 0x%p-0x%p (%u)\n",
- st[i].start, (int8_t *) st[i].start + st[i].size,
+ " 0x%lx-0x%lx (%u)\n",
+ st[i].start, st[i].start + st[i].size,
st[i].size);
printk(KERN_INFO "\n");
@@ -695,8 +712,8 @@ void rh_dump(rh_info_t * info)
nr = maxnr;
for (i = 0; i < nr; i++)
printk(KERN_INFO
- " 0x%p-0x%p (%u) %s\n",
- st[i].start, (int8_t *) st[i].start + st[i].size,
+ " 0x%lx-0x%lx (%u) %s\n",
+ st[i].start, st[i].start + st[i].size,
st[i].size, st[i].owner != NULL ? st[i].owner : "");
printk(KERN_INFO "\n");
}
@@ -704,6 +721,6 @@ void rh_dump(rh_info_t * info)
void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
{
printk(KERN_INFO
- "blk @0x%p: 0x%p-0x%p (%u)\n",
- blk, blk->start, (int8_t *) blk->start + blk->size, blk->size);
+ "blk @0x%p: 0x%lx-0x%lx (%u)\n",
+ blk, blk->start, blk->start + blk->size, blk->size);
}
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 9b4fafd..4f67b89 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -330,7 +330,7 @@ void m8xx_cpm_dpinit(void)
* with the processor and the microcode patches applied / activated.
* But the following should be at least safe.
*/
- rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
+ rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
}
/*
@@ -338,9 +338,9 @@ void m8xx_cpm_dpinit(void)
* This function returns an offset into the DPRAM area.
* Use cpm_dpram_addr() to get the virtual address of the area.
*/
-uint cpm_dpalloc(uint size, uint align)
+unsigned long cpm_dpalloc(uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -352,30 +352,30 @@ uint cpm_dpalloc(uint size, uint align)
}
EXPORT_SYMBOL(cpm_dpalloc);
-int cpm_dpfree(uint offset)
+int cpm_dpfree(unsigned long offset)
{
int ret;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
- ret = rh_free(&cpm_dpmem_info, (void *)offset);
+ ret = rh_free(&cpm_dpmem_info, offset);
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
return ret;
}
EXPORT_SYMBOL(cpm_dpfree);
-uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
+unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
cpm_dpmem_info.alignment = align;
- start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
+ start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
- return (uint)start;
+ return start;
}
EXPORT_SYMBOL(cpm_dpalloc_fixed);
@@ -385,7 +385,7 @@ void cpm_dpdump(void)
}
EXPORT_SYMBOL(cpm_dpdump);
-void *cpm_dpram_addr(uint offset)
+void *cpm_dpram_addr(unsigned long offset)
{
return (void *)(dpram_vbase + offset);
}
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c
index ec26599..9244129 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -248,15 +248,14 @@ static void cpm2_dpinit(void)
* varies with the processor and the microcode patches activated.
* But the following should be at least safe.
*/
- rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE,
- CPM_DATAONLY_SIZE);
+ rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
}
/* This function returns an index into the DPRAM area.
*/
-uint cpm_dpalloc(uint size, uint align)
+unsigned long cpm_dpalloc(uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -268,13 +267,13 @@ uint cpm_dpalloc(uint size, uint align)
}
EXPORT_SYMBOL(cpm_dpalloc);
-int cpm_dpfree(uint offset)
+int cpm_dpfree(unsigned long offset)
{
int ret;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
- ret = rh_free(&cpm_dpmem_info, (void *)offset);
+ ret = rh_free(&cpm_dpmem_info, offset);
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
return ret;
@@ -282,17 +281,17 @@ int cpm_dpfree(uint offset)
EXPORT_SYMBOL(cpm_dpfree);
/* not sure if this is ever needed */
-uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
+unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
cpm_dpmem_info.alignment = align;
- start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
+ start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
- return (uint)start;
+ return start;
}
EXPORT_SYMBOL(cpm_dpalloc_fixed);
@@ -302,7 +301,7 @@ void cpm_dpdump(void)
}
EXPORT_SYMBOL(cpm_dpdump);
-void *cpm_dpram_addr(uint offset)
+void *cpm_dpram_addr(unsigned long offset)
{
return (void *)(im_dprambase + offset);
}
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index e3d71e0..28dc1aa 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(qe_put_snum);
static int qe_sdma_init(void)
{
struct sdma *sdma = &qe_immr->sdma;
- u32 sdma_buf_offset;
+ unsigned long sdma_buf_offset;
if (!sdma)
return -ENODEV;
@@ -252,10 +252,10 @@ static int qe_sdma_init(void)
/* allocate 2 internal temporary buffers (512 bytes size each) for
* the SDMA */
sdma_buf_offset = qe_muram_alloc(512 * 2, 64);
- if (IS_MURAM_ERR(sdma_buf_offset))
+ if (IS_ERR_VALUE(sdma_buf_offset))
return -ENOMEM;
- out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK);
+ out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);
out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | (0x1 >>
QE_SDMR_CEN_SHIFT)));
@@ -291,33 +291,32 @@ static void qe_muram_init(void)
if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
address = *of_get_address(np, 0, &size, &flags);
of_node_put(np);
- rh_attach_region(&qe_muram_info,
- (void *)address, (int)size);
+ rh_attach_region(&qe_muram_info, address, (int) size);
}
}
/* This function returns an index into the MURAM area.
*/
-u32 qe_muram_alloc(u32 size, u32 align)
+unsigned long qe_muram_alloc(int size, int align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&qe_muram_lock, flags);
start = rh_alloc_align(&qe_muram_info, size, align, "QE");
spin_unlock_irqrestore(&qe_muram_lock, flags);
- return (u32) start;
+ return start;
}
EXPORT_SYMBOL(qe_muram_alloc);
-int qe_muram_free(u32 offset)
+int qe_muram_free(unsigned long offset)
{
int ret;
unsigned long flags;
spin_lock_irqsave(&qe_muram_lock, flags);
- ret = rh_free(&qe_muram_info, (void *)offset);
+ ret = rh_free(&qe_muram_info, offset);
spin_unlock_irqrestore(&qe_muram_lock, flags);
return ret;
@@ -325,16 +324,16 @@ int qe_muram_free(u32 offset)
EXPORT_SYMBOL(qe_muram_free);
/* not sure if this is ever needed */
-u32 qe_muram_alloc_fixed(u32 offset, u32 size)
+unsigned long qe_muram_alloc_fixed(unsigned long offset, int size)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&qe_muram_lock, flags);
- start = rh_alloc_fixed(&qe_muram_info, (void *)offset, size, "commproc");
+ start = rh_alloc_fixed(&qe_muram_info, offset, size, "commproc");
spin_unlock_irqrestore(&qe_muram_lock, flags);
- return (u32) start;
+ return start;
}
EXPORT_SYMBOL(qe_muram_alloc_fixed);
@@ -344,7 +343,7 @@ void qe_muram_dump(void)
}
EXPORT_SYMBOL(qe_muram_dump);
-void *qe_muram_addr(u32 offset)
+void *qe_muram_addr(unsigned long offset)
{
return (void *)&qe_immr->muram[offset];
}
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
index a457ac1..a8e3063 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/stddef.h>
#include <linux/interrupt.h>
+#include <linux/err.h>
#include <asm/io.h>
#include <asm/immap_qe.h>
@@ -265,7 +266,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
/* Allocate memory for Tx Virtual Fifo */
uccf->ucc_fast_tx_virtual_fifo_base_offset =
qe_muram_alloc(uf_info->utfs, UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT);
- if (IS_MURAM_ERR(uccf->ucc_fast_tx_virtual_fifo_base_offset)) {
+ if (IS_ERR_VALUE(uccf->ucc_fast_tx_virtual_fifo_base_offset)) {
printk(KERN_ERR "%s: cannot allocate MURAM for TX FIFO", __FUNCTION__);
uccf->ucc_fast_tx_virtual_fifo_base_offset = 0;
ucc_fast_free(uccf);
@@ -277,7 +278,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc
qe_muram_alloc(uf_info->urfs +
UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR,
UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT);
- if (IS_MURAM_ERR(uccf->ucc_fast_rx_virtual_fifo_base_offset)) {
+ if (IS_ERR_VALUE(uccf->ucc_fast_rx_virtual_fifo_base_offset)) {
printk(KERN_ERR "%s: cannot allocate MURAM for RX FIFO", __FUNCTION__);
uccf->ucc_fast_rx_virtual_fifo_base_offset = 0;
ucc_fast_free(uccf);
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index b930d68..1f65c26 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/stddef.h>
#include <linux/interrupt.h>
+#include <linux/err.h>
#include <asm/io.h>
#include <asm/immap_qe.h>
@@ -175,7 +176,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
/* Get PRAM base */
uccs->us_pram_offset =
qe_muram_alloc(UCC_SLOW_PRAM_SIZE, ALIGNMENT_OF_UCC_SLOW_PRAM);
- if (IS_MURAM_ERR(uccs->us_pram_offset)) {
+ if (IS_ERR_VALUE(uccs->us_pram_offset)) {
printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __FUNCTION__);
ucc_slow_free(uccs);
return -ENOMEM;
@@ -210,7 +211,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
uccs->rx_base_offset =
qe_muram_alloc(us_info->rx_bd_ring_len * sizeof(struct qe_bd),
QE_ALIGNMENT_OF_BD);
- if (IS_MURAM_ERR(uccs->rx_base_offset)) {
+ if (IS_ERR_VALUE(uccs->rx_base_offset)) {
printk(KERN_ERR "%s: cannot allocate RX BDs", __FUNCTION__);
uccs->rx_base_offset = 0;
ucc_slow_free(uccs);
@@ -220,7 +221,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
uccs->tx_base_offset =
qe_muram_alloc(us_info->tx_bd_ring_len * sizeof(struct qe_bd),
QE_ALIGNMENT_OF_BD);
- if (IS_MURAM_ERR(uccs->tx_base_offset)) {
+ if (IS_ERR_VALUE(uccs->tx_base_offset)) {
printk(KERN_ERR "%s: cannot allocate TX BDs", __FUNCTION__);
uccs->tx_base_offset = 0;
ucc_slow_free(uccs);
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 3b23bcb..50cee10 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -382,7 +382,7 @@ void m8xx_cpm_dpinit(void)
* with the processor and the microcode patches applied / activated.
* But the following should be at least safe.
*/
- rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
+ rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
}
/*
@@ -390,9 +390,9 @@ void m8xx_cpm_dpinit(void)
* This function returns an offset into the DPRAM area.
* Use cpm_dpram_addr() to get the virtual address of the area.
*/
-uint cpm_dpalloc(uint size, uint align)
+unsigned long cpm_dpalloc(uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -400,34 +400,34 @@ uint cpm_dpalloc(uint size, uint align)
start = rh_alloc(&cpm_dpmem_info, size, "commproc");
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
- return (uint)start;
+ return start;
}
EXPORT_SYMBOL(cpm_dpalloc);
-int cpm_dpfree(uint offset)
+int cpm_dpfree(unsigned long offset)
{
int ret;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
- ret = rh_free(&cpm_dpmem_info, (void *)offset);
+ ret = rh_free(&cpm_dpmem_info, offset);
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
return ret;
}
EXPORT_SYMBOL(cpm_dpfree);
-uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
+unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
cpm_dpmem_info.alignment = align;
- start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
+ start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
- return (uint)start;
+ return start;
}
EXPORT_SYMBOL(cpm_dpalloc_fixed);
@@ -437,7 +437,7 @@ void cpm_dpdump(void)
}
EXPORT_SYMBOL(cpm_dpdump);
-void *cpm_dpram_addr(uint offset)
+void *cpm_dpram_addr(unsigned long offset)
{
return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
}
diff --git a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c
index d407007..9dc2f34 100644
--- a/arch/ppc/lib/rheap.c
+++ b/arch/ppc/lib/rheap.c
@@ -132,7 +132,7 @@ static rh_block_t *get_slot(rh_info_t * info)
info->empty_slots--;
/* Initialize */
- blk->start = NULL;
+ blk->start = 0;
blk->size = 0;
blk->owner = NULL;
@@ -157,7 +157,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
/* We assume that they are aligned properly */
size = blkn->size;
- s = (unsigned long)blkn->start;
+ s = blkn->start;
e = s + size;
/* Find the blocks immediately before and after the given one
@@ -169,7 +169,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
list_for_each(l, &info->free_list) {
blk = list_entry(l, rh_block_t, list);
- bs = (unsigned long)blk->start;
+ bs = blk->start;
be = bs + blk->size;
if (next == NULL && s >= bs)
@@ -187,10 +187,10 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
}
/* Now check if they are really adjacent */
- if (before != NULL && s != (unsigned long)before->start + before->size)
+ if (before && s != (before->start + before->size))
before = NULL;
- if (after != NULL && e != (unsigned long)after->start)
+ if (after && e != after->start)
after = NULL;
/* No coalescing; list insert and return */
@@ -215,7 +215,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
/* Grow the after block backwards */
if (before == NULL && after != NULL) {
- after->start = (int8_t *)after->start - size;
+ after->start -= size;
after->size += size;
return;
}
@@ -320,14 +320,14 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
}
/* Attach a free memory region, coalesces regions if adjuscent */
-int rh_attach_region(rh_info_t * info, void *start, int size)
+int rh_attach_region(rh_info_t * info, unsigned long start, int size)
{
rh_block_t *blk;
unsigned long s, e, m;
int r;
/* The region must be aligned */
- s = (unsigned long)start;
+ s = start;
e = s + size;
m = info->alignment - 1;
@@ -337,9 +337,12 @@ int rh_attach_region(rh_info_t * info, void *start, int size)
/* Round end down */
e = e & ~m;
+ if (IS_ERR_VALUE(e) || (e < s))
+ return -ERANGE;
+
/* Take final values */
- start = (void *)s;
- size = (int)(e - s);
+ start = s;
+ size = e - s;
/* Grow the blocks, if needed */
r = assure_empty(info, 1);
@@ -357,7 +360,7 @@ int rh_attach_region(rh_info_t * info, void *start, int size)
}
/* Detatch given address range, splits free block if needed. */
-void *rh_detach_region(rh_info_t * info, void *start, int size)
+unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
{
struct list_head *l;
rh_block_t *blk, *newblk;
@@ -365,10 +368,10 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
/* Validate size */
if (size <= 0)
- return ERR_PTR(-EINVAL);
+ return (unsigned long) -EINVAL;
/* The region must be aligned */
- s = (unsigned long)start;
+ s = start;
e = s + size;
m = info->alignment - 1;
@@ -379,34 +382,34 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
e = e & ~m;
if (assure_empty(info, 1) < 0)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
blk = NULL;
list_for_each(l, &info->free_list) {
blk = list_entry(l, rh_block_t, list);
/* The range must lie entirely inside one free block */
- bs = (unsigned long)blk->start;
- be = (unsigned long)blk->start + blk->size;
+ bs = blk->start;
+ be = blk->start + blk->size;
if (s >= bs && e <= be)
break;
blk = NULL;
}
if (blk == NULL)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
/* Perfect fit */
if (bs == s && be == e) {
/* Delete from free list, release slot */
list_del(&blk->list);
release_slot(info, blk);
- return (void *)s;
+ return s;
}
/* blk still in free list, with updated start and/or size */
if (bs == s || be == e) {
if (bs == s)
- blk->start = (int8_t *)blk->start + size;
+ blk->start += size;
blk->size -= size;
} else {
@@ -415,31 +418,31 @@ void *rh_detach_region(rh_info_t * info, void *start, int size)
/* the back free fragment */
newblk = get_slot(info);
- newblk->start = (void *)e;
+ newblk->start = e;
newblk->size = be - e;
list_add(&newblk->list, &blk->list);
}
- return (void *)s;
+ return s;
}
-void *rh_alloc(rh_info_t * info, int size, const char *owner)
+unsigned long rh_alloc(rh_info_t * info, int size, const char *owner)
{
struct list_head *l;
rh_block_t *blk;
rh_block_t *newblk;
- void *start;
+ unsigned long start;
/* Validate size */
if (size <= 0)
- return ERR_PTR(-EINVAL);
+ return (unsigned long) -EINVAL;
/* Align to configured alignment */
size = (size + (info->alignment - 1)) & ~(info->alignment - 1);
if (assure_empty(info, 1) < 0)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
blk = NULL;
list_for_each(l, &info->free_list) {
@@ -450,7 +453,7 @@ void *rh_alloc(rh_info_t * info, int size, const char *owner)
}
if (blk == NULL)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
/* Just fits */
if (blk->size == size) {
@@ -470,7 +473,7 @@ void *rh_alloc(rh_info_t * info, int size, const char *owner)
newblk->owner = owner;
/* blk still in free list, with updated start, size */
- blk->start = (int8_t *)blk->start + size;
+ blk->start += size;
blk->size -= size;
start = newblk->start;
@@ -481,18 +484,18 @@ void *rh_alloc(rh_info_t * info, int size, const char *owner)
}
/* allocate at precisely the given address */
-void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
+unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner)
{
struct list_head *l;
rh_block_t *blk, *newblk1, *newblk2;
- unsigned long s, e, m, bs, be;
+ unsigned long s, e, m, bs=0, be=0;
/* Validate size */
if (size <= 0)
- return ERR_PTR(-EINVAL);
+ return (unsigned long) -EINVAL;
/* The region must be aligned */
- s = (unsigned long)start;
+ s = start;
e = s + size;
m = info->alignment - 1;
@@ -503,20 +506,20 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
e = e & ~m;
if (assure_empty(info, 2) < 0)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
blk = NULL;
list_for_each(l, &info->free_list) {
blk = list_entry(l, rh_block_t, list);
/* The range must lie entirely inside one free block */
- bs = (unsigned long)blk->start;
- be = (unsigned long)blk->start + blk->size;
+ bs = blk->start;
+ be = blk->start + blk->size;
if (s >= bs && e <= be)
break;
}
if (blk == NULL)
- return ERR_PTR(-ENOMEM);
+ return (unsigned long) -ENOMEM;
/* Perfect fit */
if (bs == s && be == e) {
@@ -534,7 +537,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
/* blk still in free list, with updated start and/or size */
if (bs == s || be == e) {
if (bs == s)
- blk->start = (int8_t *)blk->start + size;
+ blk->start += size;
blk->size -= size;
} else {
@@ -543,14 +546,14 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
/* The back free fragment */
newblk2 = get_slot(info);
- newblk2->start = (void *)e;
+ newblk2->start = e;
newblk2->size = be - e;
list_add(&newblk2->list, &blk->list);
}
newblk1 = get_slot(info);
- newblk1->start = (void *)s;
+ newblk1->start = s;
newblk1->size = e - s;
newblk1->owner = owner;
@@ -560,7 +563,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner)
return start;
}
-int rh_free(rh_info_t * info, void *start)
+int rh_free(rh_info_t * info, unsigned long start)
{
rh_block_t *blk, *blk2;
struct list_head *l;
@@ -625,7 +628,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
return nr;
}
-int rh_set_owner(rh_info_t * info, void *start, const char *owner)
+int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
{
rh_block_t *blk, *blk2;
struct list_head *l;
@@ -667,8 +670,8 @@ void rh_dump(rh_info_t * info)
nr = maxnr;
for (i = 0; i < nr; i++)
printk(KERN_INFO
- " 0x%p-0x%p (%u)\n",
- st[i].start, (int8_t *) st[i].start + st[i].size,
+ " 0x%lx-0x%lx (%u)\n",
+ st[i].start, st[i].start + st[i].size,
st[i].size);
printk(KERN_INFO "\n");
@@ -678,8 +681,8 @@ void rh_dump(rh_info_t * info)
nr = maxnr;
for (i = 0; i < nr; i++)
printk(KERN_INFO
- " 0x%p-0x%p (%u) %s\n",
- st[i].start, (int8_t *) st[i].start + st[i].size,
+ " 0x%lx-0x%lx (%u) %s\n",
+ st[i].start, st[i].start + st[i].size,
st[i].size, st[i].owner != NULL ? st[i].owner : "");
printk(KERN_INFO "\n");
}
@@ -687,6 +690,6 @@ void rh_dump(rh_info_t * info)
void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
{
printk(KERN_INFO
- "blk @0x%p: 0x%p-0x%p (%u)\n",
- blk, blk->start, (int8_t *) blk->start + blk->size, blk->size);
+ "blk @0x%p: 0x%lx-0x%lx (%u)\n",
+ blk, blk->start, blk->start + blk->size, blk->size);
}
diff --git a/arch/ppc/syslib/cpm2_common.c b/arch/ppc/syslib/cpm2_common.c
index cbac44b..6cd859d 100644
--- a/arch/ppc/syslib/cpm2_common.c
+++ b/arch/ppc/syslib/cpm2_common.c
@@ -136,15 +136,14 @@ static void cpm2_dpinit(void)
* varies with the processor and the microcode patches activated.
* But the following should be at least safe.
*/
- rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE,
- CPM_DATAONLY_SIZE);
+ rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
}
/* This function returns an index into the DPRAM area.
*/
-uint cpm_dpalloc(uint size, uint align)
+unsigned long cpm_dpalloc(uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
@@ -152,17 +151,17 @@ uint cpm_dpalloc(uint size, uint align)
start = rh_alloc(&cpm_dpmem_info, size, "commproc");
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
- return (uint)start;
+ return start;
}
EXPORT_SYMBOL(cpm_dpalloc);
-int cpm_dpfree(uint offset)
+int cpm_dpfree(unsigned long offset)
{
int ret;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
- ret = rh_free(&cpm_dpmem_info, (void *)offset);
+ ret = rh_free(&cpm_dpmem_info, offset);
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
return ret;
@@ -170,17 +169,17 @@ int cpm_dpfree(uint offset)
EXPORT_SYMBOL(cpm_dpfree);
/* not sure if this is ever needed */
-uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
+unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align)
{
- void *start;
+ unsigned long start;
unsigned long flags;
spin_lock_irqsave(&cpm_dpmem_lock, flags);
cpm_dpmem_info.alignment = align;
- start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
+ start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc");
spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
- return (uint)start;
+ return start;
}
EXPORT_SYMBOL(cpm_dpalloc_fixed);
@@ -190,7 +189,7 @@ void cpm_dpdump(void)
}
EXPORT_SYMBOL(cpm_dpdump);
-void *cpm_dpram_addr(uint offset)
+void *cpm_dpram_addr(unsigned long offset)
{
return (void *)&cpm2_immr->im_dprambase[offset];
}
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 65925b5..c315aa4 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -168,7 +168,7 @@ static int allocate_bd(struct net_device *dev)
fep->ring_mem_addr = cpm_dpalloc((fpi->tx_ring + fpi->rx_ring) *
sizeof(cbd_t), 8);
- if (IS_DPERR(fep->ring_mem_addr))
+ if (IS_ERR_VALUE(fep->ring_mem_addr))
return -ENOMEM;
fep->ring_base = cpm_dpram_addr(fep->ring_mem_addr);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dab88b9..f024bbe 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -364,7 +364,7 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth,
else {
init_enet_offset =
qe_muram_alloc(thread_size, thread_alignment);
- if (IS_MURAM_ERR(init_enet_offset)) {
+ if (IS_ERR_VALUE(init_enet_offset)) {
ugeth_err
("fill_init_enet_entries: Can not allocate DPRAM memory.");
qe_put_snum((u8) snum);
@@ -2814,7 +2814,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth->tx_bd_ring_offset[j] =
qe_muram_alloc(length,
UCC_GETH_TX_BD_RING_ALIGNMENT);
- if (!IS_MURAM_ERR(ugeth->tx_bd_ring_offset[j]))
+ if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j]))
ugeth->p_tx_bd_ring[j] =
(u8 *) qe_muram_addr(ugeth->
tx_bd_ring_offset[j]);
@@ -2849,7 +2849,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth->rx_bd_ring_offset[j] =
qe_muram_alloc(length,
UCC_GETH_RX_BD_RING_ALIGNMENT);
- if (!IS_MURAM_ERR(ugeth->rx_bd_ring_offset[j]))
+ if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j]))
ugeth->p_rx_bd_ring[j] =
(u8 *) qe_muram_addr(ugeth->
rx_bd_ring_offset[j]);
@@ -2933,7 +2933,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth->tx_glbl_pram_offset =
qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram),
UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->tx_glbl_pram_offset)) {
+ if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.",
__FUNCTION__);
@@ -2955,7 +2955,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
sizeof(struct ucc_geth_thread_data_tx) +
32 * (numThreadsTxNumerical == 1),
UCC_GETH_THREAD_DATA_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->thread_dat_tx_offset)) {
+ if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_thread_data_tx.",
__FUNCTION__);
@@ -2983,7 +2983,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(ug_info->numQueuesTx *
sizeof(struct ucc_geth_send_queue_qd),
UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->send_q_mem_reg_offset)) {
+ if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.",
__FUNCTION__);
@@ -3026,7 +3026,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth->scheduler_offset =
qe_muram_alloc(sizeof(struct ucc_geth_scheduler),
UCC_GETH_SCHEDULER_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->scheduler_offset)) {
+ if (IS_ERR_VALUE(ugeth->scheduler_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_scheduler.",
__FUNCTION__);
@@ -3074,7 +3074,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(sizeof
(struct ucc_geth_tx_firmware_statistics_pram),
UCC_GETH_TX_STATISTICS_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->tx_fw_statistics_pram_offset)) {
+ if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for"
" p_tx_fw_statistics_pram.", __FUNCTION__);
@@ -3113,7 +3113,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth->rx_glbl_pram_offset =
qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram),
UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->rx_glbl_pram_offset)) {
+ if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.",
__FUNCTION__);
@@ -3134,7 +3134,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(numThreadsRxNumerical *
sizeof(struct ucc_geth_thread_data_rx),
UCC_GETH_THREAD_DATA_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->thread_dat_rx_offset)) {
+ if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_thread_data_rx.",
__FUNCTION__);
@@ -3157,7 +3157,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(sizeof
(struct ucc_geth_rx_firmware_statistics_pram),
UCC_GETH_RX_STATISTICS_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->rx_fw_statistics_pram_offset)) {
+ if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for"
" p_rx_fw_statistics_pram.", __FUNCTION__);
@@ -3179,7 +3179,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
qe_muram_alloc(ug_info->numQueuesRx *
sizeof(struct ucc_geth_rx_interrupt_coalescing_entry),
UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->rx_irq_coalescing_tbl_offset)) {
+ if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for"
" p_rx_irq_coalescing_tbl.", __FUNCTION__);
@@ -3247,7 +3247,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
(sizeof(struct ucc_geth_rx_bd_queues_entry) +
sizeof(struct ucc_geth_rx_prefetched_bds)),
UCC_GETH_RX_BD_QUEUES_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->rx_bd_qs_tbl_offset)) {
+ if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.",
__FUNCTION__);
@@ -3336,7 +3336,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
ugeth->exf_glbl_param_offset =
qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram),
UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT);
- if (IS_MURAM_ERR(ugeth->exf_glbl_param_offset)) {
+ if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for"
" p_exf_glbl_param.", __FUNCTION__);
@@ -3485,7 +3485,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
/* Allocate InitEnet command parameter structure */
init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4);
- if (IS_MURAM_ERR(init_enet_pram_offset)) {
+ if (IS_ERR_VALUE(init_enet_pram_offset)) {
ugeth_err
("%s: Can not allocate DPRAM memory for p_init_enet_pram.",
__FUNCTION__);
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 925fb60..bb7afe9 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -125,7 +125,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
{
int dpmemsz, memsz;
u8 *dp_mem;
- uint dp_offset;
+ unsigned long dp_offset;
u8 *mem_addr;
dma_addr_t dma_addr = 0;
@@ -133,7 +133,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
dp_offset = cpm_dpalloc(dpmemsz, 8);
- if (IS_DPERR(dp_offset)) {
+ if (IS_ERR_VALUE(dp_offset)) {
printk(KERN_ERR
"cpm_uart_cpm1.c: could not allocate buffer descriptors\n");
return -ENOMEM;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index fa45599..1eeea36 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -222,7 +222,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
{
int dpmemsz, memsz;
u8 *dp_mem;
- uint dp_offset;
+ unsigned long dp_offset;
u8 *mem_addr;
dma_addr_t dma_addr = 0;
@@ -230,7 +230,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con)
dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos);
dp_offset = cpm_dpalloc(dpmemsz, 8);
- if (IS_DPERR(dp_offset)) {
+ if (IS_ERR_VALUE(dp_offset)) {
printk(KERN_ERR
"cpm_uart_cpm.c: could not allocate buffer descriptors\n");
return -ENOMEM;
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index a62168e..9d304b1 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -38,11 +38,11 @@ int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
void qe_setbrg(u32 brg, u32 rate);
int qe_get_snum(void);
void qe_put_snum(u8 snum);
-u32 qe_muram_alloc(u32 size, u32 align);
-int qe_muram_free(u32 offset);
-u32 qe_muram_alloc_fixed(u32 offset, u32 size);
+unsigned long qe_muram_alloc(int size, int align);
+int qe_muram_free(unsigned long offset);
+unsigned long qe_muram_alloc_fixed(unsigned long offset, int size);
void qe_muram_dump(void);
-void *qe_muram_addr(u32 offset);
+void *qe_muram_addr(unsigned long offset);
/* Buffer descriptors */
struct qe_bd {
@@ -448,10 +448,5 @@ struct ucc_slow_pram {
#define UCC_FAST_FUNCTION_CODE_DTB_LCL 0x02
#define UCC_FAST_FUNCTION_CODE_BDB_LCL 0x01
-static inline long IS_MURAM_ERR(const u32 offset)
-{
- return offset > (u32) - 1000L;
-}
-
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_QE_H */
diff --git a/include/asm-ppc/commproc.h b/include/asm-ppc/commproc.h
index 4f99df1..3972487 100644
--- a/include/asm-ppc/commproc.h
+++ b/include/asm-ppc/commproc.h
@@ -63,20 +63,15 @@
#define CPM_DATAONLY_SIZE ((uint)0x0700)
#define CPM_DP_NOSPACE ((uint)0x7fffffff)
-static inline long IS_DPERR(const uint offset)
-{
- return (uint)offset > (uint)-1000L;
-}
-
/* Export the base address of the communication processor registers
* and dual port ram.
*/
extern cpm8xx_t *cpmp; /* Pointer to comm processor */
-extern uint cpm_dpalloc(uint size, uint align);
-extern int cpm_dpfree(uint offset);
-extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align);
+extern unsigned long cpm_dpalloc(uint size, uint align);
+extern int cpm_dpfree(unsigned long offset);
+extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align);
extern void cpm_dpdump(void);
-extern void *cpm_dpram_addr(uint offset);
+extern void *cpm_dpram_addr(unsigned long offset);
extern uint cpm_dpram_phys(u8* addr);
extern void cpm_setbrg(uint brg, uint rate);
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
index 220cc2d..12a2860 100644
--- a/include/asm-ppc/cpm2.h
+++ b/include/asm-ppc/cpm2.h
@@ -104,21 +104,16 @@
*/
#define NUM_CPM_HOST_PAGES 2
-static inline long IS_DPERR(const uint offset)
-{
- return (uint)offset > (uint)-1000L;
-}
-
/* Export the base address of the communication processor registers
* and dual port ram.
*/
extern cpm_cpm2_t *cpmp; /* Pointer to comm processor */
-extern uint cpm_dpalloc(uint size, uint align);
-extern int cpm_dpfree(uint offset);
-extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align);
+extern unsigned long cpm_dpalloc(uint size, uint align);
+extern int cpm_dpfree(unsigned long offset);
+extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align);
extern void cpm_dpdump(void);
-extern void *cpm_dpram_addr(uint offset);
+extern void *cpm_dpram_addr(unsigned long offset);
extern void cpm_setbrg(uint brg, uint rate);
extern void cpm2_fastbrg(uint brg, uint rate, int div16);
extern void cpm2_reset(void);
diff --git a/include/asm-ppc/rheap.h b/include/asm-ppc/rheap.h
index 39a10d8..1723817 100644
--- a/include/asm-ppc/rheap.h
+++ b/include/asm-ppc/rheap.h
@@ -18,7 +18,7 @@
typedef struct _rh_block {
struct list_head list;
- void *start;
+ unsigned long start;
int size;
const char *owner;
} rh_block_t;
@@ -37,8 +37,8 @@ typedef struct _rh_info {
#define RHIF_STATIC_INFO 0x1
#define RHIF_STATIC_BLOCK 0x2
-typedef struct rh_stats_t {
- void *start;
+typedef struct _rh_stats {
+ unsigned long start;
int size;
const char *owner;
} rh_stats_t;
@@ -57,24 +57,24 @@ extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
rh_block_t * block);
/* Attach a free region to manage */
-extern int rh_attach_region(rh_info_t * info, void *start, int size);
+extern int rh_attach_region(rh_info_t * info, unsigned long start, int size);
/* Detach a free region */
-extern void *rh_detach_region(rh_info_t * info, void *start, int size);
+extern unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size);
/* Allocate the given size from the remote heap (with alignment) */
-extern void *rh_alloc_align(rh_info_t * info, int size, int alignment,
+extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment,
const char *owner);
/* Allocate the given size from the remote heap */
-extern void *rh_alloc(rh_info_t * info, int size, const char *owner);
+extern unsigned long rh_alloc(rh_info_t * info, int size, const char *owner);
/* Allocate the given size from the given address */
-extern void *rh_alloc_fixed(rh_info_t * info, void *start, int size,
+extern unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size,
const char *owner);
/* Free the allocated area */
-extern int rh_free(rh_info_t * info, void *start);
+extern int rh_free(rh_info_t * info, unsigned long start);
/* Get stats for debugging purposes */
extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
@@ -84,6 +84,6 @@ extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
extern void rh_dump(rh_info_t * info);
/* Set owner of taken block */
-extern int rh_set_owner(rh_info_t * info, void *start, const char *owner);
+extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);
#endif /* __ASM_PPC_RHEAP_H__ */
--
1.5.0.6
^ permalink raw reply related
* problem to load uImage but not zImage (on virtex-4 base board)
From: Guillaume Berthelom @ 2007-05-02 16:12 UTC (permalink / raw)
To: linuxppc-embedded
hi,
I'm trying to port Linux 2.6 on Avnet FX12 MM board with U-Boot and the help
of xilinx ML403 config.
I have generate my costum xparameters.h file with EDK 8.2i.
I use ELDK 4.1 and Linux 2.6.20.x.
I have modified ml403.h u-boot's config file to adapt it for my board and I
have no problem to boot u-boot.
I use the right board_info structure from <asm/ppcboot.h> and not the one in
xilinx_ml403.h.
When I load the zImage directly with xilinx xmd debugger, the kernel start
without problem (if I don't have KGDB or SERIAL_TEXT_DEBUG option in my
kernel config). But when I try to load the uImage with u-boot, the kernel
start but crach befor I can see something on output.
The kernel start because I debug it and the platform_init is ok, setup_arch
too and it crach after ppc4xx_setup_arch at printk(KERN_INFO "Xilinx ML403
Reference System (Virtex-4 FX)\n") line when the kernel access in printk.c.
I use the opb_uart16550 IP in my Xilinx design and the associat drivers in
u-boot and linux.
I'm new in linux embedded and I'm in internship...I have any idea where and
what is the problem, certanly in the serial int I guest but I'm not sure.
Thanks and sorry for my english I'm fench.
Guillaume Berthelom
--
View this message in context: http://www.nabble.com/problem-to-load-uImage-but-not-zImage-%28on-virtex-4-base-board%29-tf3681533.html#a10289144
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply
* Re: [PATCH] Remove duplicate export of __div64_32.
From: Scott Wood @ 2007-05-02 16:05 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, paulus
In-Reply-To: <E8649267-DE22-4700-BF33-A9EB744B11DC@kernel.crashing.org>
Kumar Gala wrote:
>
> On May 1, 2007, at 11:05 AM, Scott Wood wrote:
>
>> Change 3927f2e8f9afa3424bb51ca81f7abac01ffd0005 moved lib/lib64.c from
>> lib-y to obj-y, preventing the export in ppc_ksyms.c from overriding
>> the one in lib, and thus causing a duplicate-export warning.
>
>
> I assume you mean lib/div64.c?
D'oh... of course. :-P
-Scott
^ permalink raw reply
* Re: [PATCH] gianfar: Add I/O barriers when touching buffer descriptor ownership.
From: Scott Wood @ 2007-05-02 16:04 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: netdev, jgarzik, linuxppc-dev
In-Reply-To: <65f0b79871a670eb595cca7d78e2f4e9@kernel.crashing.org>
Segher Boessenkool wrote:
>> The hardware must not see that is given ownership of a buffer until it is
>> completely written, and when the driver receives ownership of a buffer,
>> it must ensure that any other reads to the buffer reflect its final
>> state. Thus, I/O barriers are added where required.
>>
>> Without this patch, I have observed GCC reordering the setting of
>> bdp->length and bdp->status in gfar_new_skb.
>
>
> The :::"memory" in the barriers you used prevent GCC
> from reordering accesses around the barriers.
Sure... it was just an example to point out that it's actually
happening, rather than a theoretical concern.
> AFAICS you need stronger barriers though; {w,r,}mb(),
> to prevent _any_ reordering of those memory accesses,
> not just the compiler-generated ones.
My impression was that the eieio used by iobarrier would be sufficient
for that, as we're not trying to synchronize between accesses to
different types of memory. Is sync really required here?
-Scott
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox