LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Configuration-Problem ext-interrupt on mpc52xx
From: David Gibson @ 2007-09-19 23:40 UTC (permalink / raw)
  To: S. Fricke; +Cc: linuxppc-dev
In-Reply-To: <20070919190146.GI5682@sfrouter>

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

On Wed, Sep 19, 2007 at 09:01:46PM +0200, S. Fricke wrote:
> Hello,
> 
> > On 9/19/07, S. Fricke <silvio.fricke@googlemail.com> wrote:
> > > Hi,
> > >
> > > how can i configure an "ext interrupt" to high-level? I want a interruption on
> > > IRQ2, but I checked with an oscilloscope that the pin has a low state and I
> > > needs a high state.
> > >
> > > I have tried, after I got the irq (with irq_of_parse_and_map), set it with
> > >
> > >     set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
> > >
> > > But I think it is a system-configuration (irq_desc) and no
> > > device-configuration.
> > 
> > You shouldn't need to do this.  You set your sense level in the device tree.
> > 
> > From your previous email, your device node looks like this:
> > >             intpin@0 {
> > >                 interrupt-parent = <500>;
> > >                 interrupts = <1 2 2>;
> > >             };
> > 
> > Which is IRQ2, EDGE_FALLING.
> > 
> > If you change your interrupts property to <1 2 0>, then your sense is
> > set to LEVEL_HIGH.  (Seriously, you need to read the interrupts
> > section of Documentation/powerpc/mpc52xx-device-tree-bindings.txt.)
> 
> I have read it! But another driver on Boot-time pulled my interrupt

Erm.. if the interrupt is shared with something else which expects a
different trigger/polarity, you're kind of stuffed....

> to low, I can't do anything except for looking at the oscilloscope
> 
> I'm going to disable all unneeded drivers tomorrow morning.
> 
> TIA:
> Silvio Fricke
> 



> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

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

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

^ permalink raw reply

* Re: Patches for 2.6.24
From: Grant Likely @ 2007-09-19 23:51 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <fa686aa40709120902q28d4d8bcr93020005dcf4f6f7@mail.gmail.com>

Paul,

Here are the links to the patches I need pulled.

Cheers,
g.

On 9/12/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> On 9/12/07, Kumar Gala <galak@kernel.crashing.org> wrote:
> > On Sep 12, 2007, at 10:48 AM, Grant Likely wrote:
> > > http://patchwork.ozlabs.org/linuxppc/patch?id=13235
> > > http://patchwork.ozlabs.org/linuxppc/patch?id=13249
> >
> > bootwrapper patches should be ack'd by david gibson and picked up by
> > paul at this point.
>
> Okay, David has already acked these.  Paulus, can you please pick them up?


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* Re: Cleanups for physmap_of.c
From: David Gibson @ 2007-09-19 23:49 UTC (permalink / raw)
  To: Josh Boyer; +Cc: Vitaly Wool, Paul Mackerras, linuxppc-dev
In-Reply-To: <20070919071433.69daf024@weaponx.rchland.ibm.com>

On Wed, Sep 19, 2007 at 07:14:33AM -0500, Josh Boyer wrote:
> On Wed, 19 Sep 2007 14:16:46 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > This patch includes a whole batch of smallish cleanups for
> > drivers/mtd/physmap_of.c.
> > 
> > 	- A bunch of uneeded #includes are removed
> > 	- We switch to the modern linux/of.h etc. in place of
> > asm/prom.h
> > 	- Use some helper macros to avoid some ugly inline #ifdefs
> > 	- A few lines of unreachable code are removed
> > 	- A number of indentation / line-wrapping fixes
> > 	- More consistent use of kernel idioms such as if (!p) instead
> > of if (p == NULL)
> > 	- Clarify some printk()s and other informative strings.	
> 
> Most of that looks good.  Just a couple issues below.  Mostly it
> doesn't apply cleanly to my tree because you didn't base if off of the
> patch I sent out last week to fix optional partitions.

Ah, oops.  Didn't remember that patch.

> > 	- (the big one) Despite the name, this driver really has
> > nothing to do with drivers/mtd/physmap.c.  The fact that the flash
> > chips must be physically direct mapped is a constrant, but doesn't
> > really say anything about the actual purpose of this driver, which is
> > to instantiate MTD devices based on information from the device tree.
> > Therefore the physmap name is replaced everywhere within the file with
> > "of_flash".  The file itself and the Kconfig option is not renamed for
> > now (so that the diff is actually a diff).  That can come later.
> 
> Later when?  If we're all in agreement, then why don't we just apply
> your patch after you fix it up and I can move the file in my git tree.
> That way we don't forget about it.

Ok by me.  Well, except that it will need Makefile and Kconfig changes
for that, too.  I was going to send another patch with that once this
one was reviewed and merged.

[snip]
> > @@ -56,11 +53,9 @@ static int parse_obsolete_partitions(str
> > 
> >  	nr_parts = plen / sizeof(part[0]);
> > 
> > -	info->parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL);
> > -	if (!info->parts) {
> > -		printk(KERN_ERR "Can't allocate the flash partition data!\n");
> > +	info->parts = kzalloc(nr_parts * sizeof(*info->parts), GFP_KERNEL);
> > +	if (!info->parts)
> >  		return -ENOMEM;
> 
> You dropped the printk here.  Any particular reason why?

I thought the the -ENOMEM was specific enough; we don't give
explanatory messages for other ENOMEM conditions in the driver.

> > 
> >  	names = of_get_property(dp, "partition-names", &plen);
> > 
> > @@ -86,8 +81,8 @@ static int parse_obsolete_partitions(str
> >  	return nr_parts;
> >  }
> > 
> > -static int __devinit process_partitions(struct physmap_flash_info *info,
> > -					struct of_device *dev)
> > +static int __devinit parse_partitions(struct of_flash *info,
> > +				      struct of_device *dev)
> >  {
> >  	const char *partname;
> >  	static const char *part_probe_types[]
> > @@ -109,87 +104,68 @@ static int __devinit process_partitions(
> >  	for (pp = dp->child; pp; pp = pp->sibling)
> >  		nr_parts++;
> > 
> > -	if (nr_parts) {
> > -		info->parts = kzalloc(nr_parts * sizeof(struct mtd_partition),
> > -				      GFP_KERNEL);
> > -		if (!info->parts) {
> > -			printk(KERN_ERR "Can't allocate the flash partition data!\n");
> > -			return -ENOMEM;
> > -		}
> > +	if (nr_parts == 0)
> > +		return parse_obsolete_partitions(dev, info, dp);
> 
> You reintroduced the optional partitions bug I fixed with:
> 
> http://git.infradead.org/?p=users/jwboyer/powerpc.git;a=commit;h=7cafc8f8c89d1f49039b7c345ca832fbd2d1e639

Ah yes.  Actually on consideration, your patch seems a roundabout way
of fixing it.  I'm inclined instead to change
parse_obsolete_partitions() to return 0 instead of -ENOENT.

I guess I'll fold that fix in.

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

^ permalink raw reply

* Re: [PATCH 10/25] spusched: fix null pointer dereference in find_victim
From: Jeremy Kerr @ 2007-09-20  0:13 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Christoph Hellwig
In-Reply-To: <20070914074424.GD18011@lst.de>

Christoph,

> Didn't we want to try to get this into 2.6.23?

Done! it's in -rc7 :)


Jeremy

^ permalink raw reply

* Re: [PATCH 2/3] usb: ehci-ppc-of dts bindings.
From: David Gibson @ 2007-09-20  0:52 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, linux-usb-devel
In-Reply-To: <d0e5786123822b4d178932d9048f6a22@kernel.crashing.org>

On Wed, Sep 19, 2007 at 06:50:02PM +0200, Segher Boessenkool wrote:
> >>> +  Required properties:
> >>> +  - device_type : should be "usb".
> >> No device_type please.  The published USB binding doesn't define
> >> one on purpose.
> >
> > Could you please, explain why?
> > Sorry, I don't think I get the concept of device description here.
> 
> "device_type" is meant to be used only by OF for determining the OF
> programming model for a device.  No such thing has been defined for
> USB busses, so the USB binding does not define a "device_type" either.
> 
> Nothing in a flat device tree should ever define a device_type, except
> perhaps for compatibility with legacy kernel code.

This is not necessarily true.  As Segher says, device_type originally
indicated the OF programming model for a device.  However, we've
extended the notion for the flat device tree to allow device_type to
cover "device classes" which could have certain common properties and
semantics.  However, in this case, a meaningful class binding must
already be defined: it might make sense for usb to have a defined
device_type, but it's not been defined so far, so for now you must
omit device_type (if a device_type is defined in future, it's easier
to add legacy hooks that will include devices which are missing the
relevant device_type marker than to work around devices which *do*
have the marker, but pre-date and don't follow the defined class
binding).

> >>> +  - compatible : should be "ehci".
> >> Just "ehci" isn't enough -- compare to OHCI, which is the name for
> >> a kind of USB host controller as well as for a kind of Firewire
> >> host controller.
> >
> > Actually, I though device type="usb" + compatible="ehci" would be 
> > enough.
> 
> "compatible" values are their own namespace, you should in principle
> be able to find a driver for a device with them without having to look
> at other properties.

Yes.  Regardless of the state of any class / device_type binding, the
compatible property *alone* should be sufficient to select a driver.

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

^ permalink raw reply

* Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.
From: Paul Mackerras @ 2007-09-20  0:52 UTC (permalink / raw)
  To: Daniel Walker; +Cc: linuxppc-dev, Thomas Gleixner, johnstul, Realtime Kernel
In-Reply-To: <1190216594.11899.3.camel@imap.mvista.com>

Daniel Walker writes:

> If you switch to the rtc do the shift and mult need to change?

You can't switch; any given CPU chip will have either the RTC or the
timebase but not both.

> > +       /* XXX this assumes clock->shift == 22 */
> > +       /* 4611686018 ~= 2^(20+64-22) / 1e9 */
> > +       t2x = (u64) clock->mult * 4611686018ULL;
> 
> It might make the code more readable if you put that constant into a
> macro that gives it a name.

The comment already gives more information than some arbitrary name
would.

Paul.

^ permalink raw reply

* Re: [PATCH v2] [POWERPC] Fix build errors when BLOCK=n
From: Paul Mackerras @ 2007-09-20  0:58 UTC (permalink / raw)
  To: Emil Medve
  Cc: linux-ide, linuxppc-dev, kumar.gala, bzolnier, linuxppc-embedded
In-Reply-To: <1190227172-593-1-git-send-email-Emilian.Medve@Freescale.com>

Emil Medve writes:

> --- a/arch/powerpc/kernel/ppc_ksyms.c
> +++ b/arch/powerpc/kernel/ppc_ksyms.c
> @@ -12,12 +12,15 @@
>  #include <linux/irq.h>
>  #include <linux/pci.h>
>  #include <linux/delay.h>
> +#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
>  #include <linux/ide.h>
> +#endif

Why are we still including linux/ide.h at all here?

>  #include <linux/bitops.h>
>  
>  #include <asm/page.h>
>  #include <asm/semaphore.h>
>  #include <asm/processor.h>
> +#include <asm/cacheflush.h>

What's the point of adding this?

Paul.

^ permalink raw reply

* Cleanups for physmap_of.c (v2)
From: David Gibson @ 2007-09-20  1:22 UTC (permalink / raw)
  To: Vitaly Wool, David Woodhouse; +Cc: Paul Mackerras, linuxppc-dev

This patch includes a whole batch of smallish cleanups for
drivers/mtd/physmap_of.c.

	- A bunch of uneeded #includes are removed
	- We switch to the modern linux/of.h etc. in place of
asm/prom.h
	- Use some helper macros to avoid some ugly inline #ifdefs
	- A few lines of unreachable code are removed
	- A number of indentation / line-wrapping fixes
	- More consistent use of kernel idioms such as if (!p) instead
of if (p == NULL)
	- Clarify some printk()s and other informative strings.
	- parse_obsolete_partitions() now returns 0 if no partition
information is found, instead of returning -ENOENT which the caller
had to handle specially.
	- (the big one) Despite the name, this driver really has
nothing to do with drivers/mtd/physmap.c.  The fact that the flash
chips must be physically direct mapped is a constrant, but doesn't
really say anything about the actual purpose of this driver, which is
to instantiate MTD devices based on information from the device tree.
Therefore the physmap name is replaced everywhere within the file with
"of_flash".  The file itself and the Kconfig option is not renamed for
now (so that the diff is actually a diff).  That can come later.

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

Reworked to apply on top of jwb's bugfix for not correctly handling
parse_obsolete_partitions() -ENOENT return value.

Index: working-2.6/drivers/mtd/maps/physmap_of.c
===================================================================
--- working-2.6.orig/drivers/mtd/maps/physmap_of.c	2007-09-20 11:16:37.000000000 +1000
+++ working-2.6/drivers/mtd/maps/physmap_of.c	2007-09-20 11:18:22.000000000 +1000
@@ -1,5 +1,5 @@
 /*
- * Normal mappings of chips in physical memory for OF devices
+ * Flash mappings described by the OF (or flattened) device tree
  *
  * Copyright (C) 2006 MontaVista Software Inc.
  * Author: Vitaly Wool <vwool@ru.mvista.com>
@@ -15,20 +15,15 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/slab.h>
 #include <linux/device.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
-#include <asm/io.h>
-#include <asm/prom.h>
-#include <asm/of_device.h>
-#include <asm/of_platform.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 
-struct physmap_flash_info {
+struct of_flash {
 	struct mtd_info		*mtd;
 	struct map_info		map;
 	struct resource		*res;
@@ -38,8 +33,10 @@ struct physmap_flash_info {
 };
 
 #ifdef CONFIG_MTD_PARTITIONS
+#define OF_FLASH_PARTS(info)	((info)->parts)
+
 static int parse_obsolete_partitions(struct of_device *dev,
-				     struct physmap_flash_info *info,
+				     struct of_flash *info,
 				     struct device_node *dp)
 {
 	int i, plen, nr_parts;
@@ -50,17 +47,15 @@ static int parse_obsolete_partitions(str
 
 	part = of_get_property(dp, "partitions", &plen);
 	if (!part)
-		return -ENOENT;
+		return 0; /* No partitions found */
 
 	dev_warn(&dev->dev, "Device tree uses obsolete partition map binding\n");
 
 	nr_parts = plen / sizeof(part[0]);
 
-	info->parts = kzalloc(nr_parts * sizeof(struct mtd_partition), GFP_KERNEL);
-	if (!info->parts) {
-		printk(KERN_ERR "Can't allocate the flash partition data!\n");
+	info->parts = kzalloc(nr_parts * sizeof(*info->parts), GFP_KERNEL);
+	if (!info->parts)
 		return -ENOMEM;
-	}
 
 	names = of_get_property(dp, "partition-names", &plen);
 
@@ -86,8 +81,8 @@ static int parse_obsolete_partitions(str
 	return nr_parts;
 }
 
-static int __devinit process_partitions(struct physmap_flash_info *info,
-					struct of_device *dev)
+static int __devinit parse_partitions(struct of_flash *info,
+				      struct of_device *dev)
 {
 	const char *partname;
 	static const char *part_probe_types[]
@@ -109,89 +104,68 @@ static int __devinit process_partitions(
 	for (pp = dp->child; pp; pp = pp->sibling)
 		nr_parts++;
 
-	if (nr_parts) {
-		info->parts = kzalloc(nr_parts * sizeof(struct mtd_partition),
-				      GFP_KERNEL);
-		if (!info->parts) {
-			printk(KERN_ERR "Can't allocate the flash partition data!\n");
-			return -ENOMEM;
-		}
+	if (nr_parts == 0)
+		return parse_obsolete_partitions(dev, info, dp);
 
-		for (pp = dp->child, i = 0 ; pp; pp = pp->sibling, i++) {
-			const u32 *reg;
-			int len;
-
-			reg = of_get_property(pp, "reg", &len);
-			if (!reg || (len != 2*sizeof(u32))) {
-				dev_err(&dev->dev, "Invalid 'reg' on %s\n",
-					dp->full_name);
-				kfree(info->parts);
-				info->parts = NULL;
-				return -EINVAL;
-			}
-			info->parts[i].offset = reg[0];
-			info->parts[i].size = reg[1];
-
-			partname = of_get_property(pp, "label", &len);
-			if (!partname)
-				partname = of_get_property(pp, "name", &len);
-			info->parts[i].name = (char *)partname;
+	info->parts = kzalloc(nr_parts * sizeof(*info->parts),
+			      GFP_KERNEL);
+	if (!info->parts)
+		return -ENOMEM;
 
-			if (of_get_property(pp, "read-only", &len))
-				info->parts[i].mask_flags = MTD_WRITEABLE;
+	for (pp = dp->child, i = 0; pp; pp = pp->sibling, i++) {
+		const u32 *reg;
+		int len;
+
+		reg = of_get_property(pp, "reg", &len);
+		if (!reg || (len != 2*sizeof(u32))) {
+			dev_err(&dev->dev, "Invalid 'reg' on %s\n",
+				dp->full_name);
+			kfree(info->parts);
+			info->parts = NULL;
+			return -EINVAL;
 		}
-	} else {
-		nr_parts = parse_obsolete_partitions(dev, info, dp);
-		if (nr_parts == -ENOENT)
-			nr_parts = 0;
-	}
+		info->parts[i].offset = reg[0];
+		info->parts[i].size = reg[1];
 
-	if (nr_parts < 0)
-		return nr_parts;
+		partname = of_get_property(pp, "label", &len);
+		if (!partname)
+			partname = of_get_property(pp, "name", &len);
+		info->parts[i].name = (char *)partname;
 
-	if (nr_parts > 0)
-		add_mtd_partitions(info->mtd, info->parts, nr_parts);
-	else
-		add_mtd_device(info->mtd);
+		if (of_get_property(pp, "read-only", &len))
+			info->parts[i].mask_flags = MTD_WRITEABLE;
+	}
 
-	return 0;
+	return nr_parts;
 }
 #else /* MTD_PARTITIONS */
-static int __devinit process_partitions(struct physmap_flash_info *info,
-					struct device_node *dev)
-{
-	add_mtd_device(info->mtd);
-	return 0;
-}
+#define	OF_FLASH_PARTS(info)		(0)
+#define parse_partitions(info, dev)	(0)
 #endif /* MTD_PARTITIONS */
 
-static int of_physmap_remove(struct of_device *dev)
+static int of_flash_remove(struct of_device *dev)
 {
-	struct physmap_flash_info *info;
+	struct of_flash *info;
 
 	info = dev_get_drvdata(&dev->dev);
-	if (info == NULL)
+	if (!info)
 		return 0;
 	dev_set_drvdata(&dev->dev, NULL);
 
-	if (info->mtd != NULL) {
-#ifdef CONFIG_MTD_PARTITIONS
-		if (info->parts) {
+	if (info->mtd) {
+		if (OF_FLASH_PARTS(info)) {
 			del_mtd_partitions(info->mtd);
-			kfree(info->parts);
+			kfree(OF_FLASH_PARTS(info));
 		} else {
 			del_mtd_device(info->mtd);
 		}
-#else
-		del_mtd_device(info->mtd);
-#endif
 		map_destroy(info->mtd);
 	}
 
-	if (info->map.virt != NULL)
+	if (info->map.virt)
 		iounmap(info->map.virt);
 
-	if (info->res != NULL) {
+	if (info->res) {
 		release_resource(info->res);
 		kfree(info->res);
 	}
@@ -229,52 +203,49 @@ static struct mtd_info * __devinit obsol
 		return do_map_probe("jedec_probe", map);
 	} else {
 		if (strcmp(of_probe, "ROM") != 0)
-			dev_dbg(&dev->dev, "obsolete_probe: don't know probe type "
-				"'%s', mapping as rom\n", of_probe);
+			dev_warn(&dev->dev, "obsolete_probe: don't know probe "
+				 "type '%s', mapping as rom\n", of_probe);
 		return do_map_probe("mtd_rom", map);
 	}
 }
 
-static int __devinit of_physmap_probe(struct of_device *dev, const struct of_device_id *match)
+static int __devinit of_flash_probe(struct of_device *dev,
+				    const struct of_device_id *match)
 {
 	struct device_node *dp = dev->node;
 	struct resource res;
-	struct physmap_flash_info *info;
-	const char *probe_type = (const char *)match->data;
+	struct of_flash *info;
+	const char *probe_type = match->data;
 	const u32 *width;
 	int err;
 
+	err = -ENXIO;
 	if (of_address_to_resource(dp, 0, &res)) {
-		dev_err(&dev->dev, "Can't get the flash mapping!\n");
-		err = -EINVAL;
+		dev_err(&dev->dev, "Can't get IO address from device tree\n");
 		goto err_out;
 	}
 
-       	dev_dbg(&dev->dev, "physmap flash device: %.8llx at %.8llx\n",
-	    (unsigned long long)res.end - res.start + 1,
-	    (unsigned long long)res.start);
-
-	info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL);
-	if (info == NULL) {
-		err = -ENOMEM;
+       	dev_dbg(&dev->dev, "of_flash device: %.8llx-%.8llx\n",
+		(unsigned long long)res.start, (unsigned long long)res.end);
+
+	err = -ENOMEM;
+	info = kzalloc(sizeof(*info), GFP_KERNEL);
+	if (!info)
 		goto err_out;
-	}
 	memset(info, 0, sizeof(*info));
 
 	dev_set_drvdata(&dev->dev, info);
 
+	err = -EBUSY;
 	info->res = request_mem_region(res.start, res.end - res.start + 1,
-			dev->dev.bus_id);
-	if (info->res == NULL) {
-		dev_err(&dev->dev, "Could not reserve memory region\n");
-		err = -ENOMEM;
+				       dev->dev.bus_id);
+	if (!info->res)
 		goto err_out;
-	}
 
+	err = -ENXIO;
 	width = of_get_property(dp, "bank-width", NULL);
-	if (width == NULL) {
-		dev_err(&dev->dev, "Can't get the flash bank width!\n");
-		err = -EINVAL;
+	if (!width) {
+		dev_err(&dev->dev, "Can't get bank width from device tree\n");
 		goto err_out;
 	}
 
@@ -283,10 +254,10 @@ static int __devinit of_physmap_probe(st
 	info->map.size = res.end - res.start + 1;
 	info->map.bankwidth = *width;
 
+	err = -ENOMEM;
 	info->map.virt = ioremap(info->map.phys, info->map.size);
-	if (info->map.virt == NULL) {
-		dev_err(&dev->dev, "Failed to ioremap flash region\n");
-		err = EIO;
+	if (!info->map.virt) {
+		dev_err(&dev->dev, "Failed to ioremap() flash region\n");
 		goto err_out;
 	}
 
@@ -297,25 +268,30 @@ static int __devinit of_physmap_probe(st
 	else
 		info->mtd = obsolete_probe(dev, &info->map);
 
-	if (info->mtd == NULL) {
-		dev_err(&dev->dev, "map_probe failed\n");
-		err = -ENXIO;
+	err = -ENXIO;
+	if (!info->mtd) {
+		dev_err(&dev->dev, "do_map_probe() failed\n");
 		goto err_out;
 	}
 	info->mtd->owner = THIS_MODULE;
 
-	return process_partitions(info, dev);
+	err = parse_partitions(info, dev);
+	if (err < 0)
+		goto err_out;
 
-err_out:
-	of_physmap_remove(dev);
-	return err;
+	if (err > 0)
+		add_mtd_partitions(info->mtd, OF_FLASH_PARTS(info), err);
+	else
+		add_mtd_device(info->mtd);
 
 	return 0;
 
-
+err_out:
+	of_flash_remove(dev);
+	return err;
 }
 
-static struct of_device_id of_physmap_match[] = {
+static struct of_device_id of_flash_match[] = {
 	{
 		.compatible	= "cfi-flash",
 		.data		= (void *)"cfi_probe",
@@ -337,30 +313,28 @@ static struct of_device_id of_physmap_ma
 	},
 	{ },
 };
+MODULE_DEVICE_TABLE(of, of_flash_match);
 
-MODULE_DEVICE_TABLE(of, of_physmap_match);
-
-
-static struct of_platform_driver of_physmap_flash_driver = {
-	.name		= "physmap-flash",
-	.match_table	= of_physmap_match,
-	.probe		= of_physmap_probe,
-	.remove		= of_physmap_remove,
+static struct of_platform_driver of_flash_driver = {
+	.name		= "of-flash",
+	.match_table	= of_flash_match,
+	.probe		= of_flash_probe,
+	.remove		= of_flash_remove,
 };
 
-static int __init of_physmap_init(void)
+static int __init of_flash_init(void)
 {
-	return of_register_platform_driver(&of_physmap_flash_driver);
+	return of_register_platform_driver(&of_flash_driver);
 }
 
-static void __exit of_physmap_exit(void)
+static void __exit of_flash_exit(void)
 {
-	of_unregister_platform_driver(&of_physmap_flash_driver);
+	of_unregister_platform_driver(&of_flash_driver);
 }
 
-module_init(of_physmap_init);
-module_exit(of_physmap_exit);
+module_init(of_flash_init);
+module_exit(of_flash_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Vitaly Wool <vwool@ru.mvista.com>");
-MODULE_DESCRIPTION("Configurable MTD map driver for OF");
+MODULE_DESCRIPTION("Device tree based MTD map driver");

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

^ permalink raw reply

* Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.
From: Daniel Walker @ 2007-09-20  1:35 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Thomas Gleixner, johnstul, Realtime Kernel
In-Reply-To: <18161.50240.599267.768383@cargo.ozlabs.ibm.com>

On Thu, 2007-09-20 at 10:52 +1000, Paul Mackerras wrote:
> Daniel Walker writes:
> 
> > If you switch to the rtc do the shift and mult need to change?
> 
> You can't switch; any given CPU chip will have either the RTC or the
> timebase but not both.

The code is switching between to clock read functions .. If they are
running at different frequencies then the time isn't going to be
converted to nanosecond properly.

So is the rtc running at the same frequency as the timebase? I'd guess
no..

> > > +       /* XXX this assumes clock->shift == 22 */
> > > +       /* 4611686018 ~= 2^(20+64-22) / 1e9 */
> > > +       t2x = (u64) clock->mult * 4611686018ULL;
> > 
> > It might make the code more readable if you put that constant into a
> > macro that gives it a name.
> 
> The comment already gives more information than some arbitrary name
> would.

I'm not a powerpc expect, but I have no idea what that constant is..

Daniel

^ permalink raw reply

* Patches added to powerpc.git for-2.6.24 branch
From: Paul Mackerras @ 2007-09-20  1:42 UTC (permalink / raw)
  To: linuxppc-dev

Adrian Bunk (1):
      [POWERPC] Remove APUS support from arch/ppc

Andre Detsch (1):
      [POWERPC] spufs: Fix race condition on gang->aff_ref_spu

Anton Vorontsov (3):
      [POWERPC] QE: extern par_io_config_pin and par_io_data_set funcs
      [POWERPC] fsl_soc: add support for fsl_spi
      [POWERPC] MPC832x_RDB: Update dts to use SPI1 in QE, register mmc_spi stub

Domen Puncer (1):
      [POWERPC] MPC5200 low power mode

Guennadi Liakhovetski (1):
      [POWERPC] linkstation updates

Jeremy Kerr (6):
      [POWERPC] spufs: Remove asmlinkage from do_spu_create
      [POWERPC] spufs: Remove spu_harvest
      [POWERPC] cell: Unify spufs syscall path
      [POWERPC] spufs: Remove asmlinkage from spufs_calls
      [POWERPC] spufs: Fix restore_decr_wrapped() to match CBE Handbook
      [POWERPC] cell: Remove DEBUG for SPU callbacks

Jesper Juhl (1):
      [POWERPC] Don't cast kmalloc return value in ibmebus.c

John Rigby (1):
      [POWERPC] 52xx: Fix mpc52xx_uart_of_assign to use correct index

Jon Loeliger (2):
      [POWERPC] 86xx: Remove unnecessary loops_per_jiffy initialization code.
      [POWERPC] 85xx: Remove unnecessary loops_per_jiffy initialization code.

Kumar Gala (10):
      ucc_geth: kill unused include
      [POWERPC] 85xx: Renamed mpc8544_ds.c to mpc85xx_ds.c
      [POWERPC] 85xx: Clean up from 85xx_ds rename
      [POWERPC] Handle alignment faults on SPE load/store instructions
      [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port
      [POWERPC] DTS cleanup
      [POWERPC] Move PCI nodes to be sibilings with SOC nodes
      [POWERPC] 83xx: Removed PCI exclude of PHB
      [POWERPC] Add cpu feature for SPE handling
      [POWERPC] Fix modpost warnings from head*.S on ppc32

Michael Ellerman (15):
      [POWERPC] spufs: Extract the file descriptor search logic in SPU coredump code
      [POWERPC] spufs: Remove ctx_info and ctx_info_list
      [POWERPC] spufs: Call spu_acquire_saved() before calculating the SPU note sizes
      [POWERPC] spufs: Use computed sizes/#defines rather than literals in SPU coredump code
      [POWERPC] spufs: Write some SPU coredump values as ASCII
      [POWERPC] spufs: Correctly calculate the size of the local-store to dump
      [POWERPC] spufs: Don't return -ENOSYS as extra notes size if spufs is not loaded
      [POWERPC] spufs: Get rid of spufs_coredump_num_notes, it's not needed if we NULL terminate
      [POWERPC] spufs: Internal __spufs_get_foo() routines should take a spu_context *
      [POWERPC] spufs: Add contents of npc file to SPU coredumps
      [POWERPC] spufs: Combine spufs_coredump_calls with spufs_calls
      [POWERPC] spufs: Cleanup ELF coredump extra notes logic
      [POWERPC] spufs: Handle errors in SPU coredump code, and support coredump to a pipe
      [POWERPC] spufs: Respect RLIMIT_CORE in spu coredump code
      [POWERPC] spufs: Add DEFINE_SPUFS_ATTRIBUTE()

Michael Neuling (1):
      [POWERPC] Remove barriers from the SLB shadow buffer update

Olaf Hering (1):
      [POWERPC] Fix pmac_zilog debug arg

Scott Wood (2):
      [POWERPC] fsl_soc.c cleanup
      [PPC] Add clrbits8 and setbits8.

Sebastian Siewior (2):
      [POWERPC] spufs: Make file-internal functions & variables static
      [POWERPC] spufs: Make isolated loader properly aligned

Stephen Rothwell (4):
      [POWERPC] Fix section mismatch in PCI code
      [POWERPC] Remove cmd_line from head*.S
      [POWERPC] Size swapper_pg_dir correctly
      [POWERPC] FWNMI is only used on pSeries

Timur Tabi (2):
      [POWERPC] add clrsetbits macros
      [POWERPC] 86xx: Fix definition of global-utilites structure

^ permalink raw reply

* Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.
From: Paul Mackerras @ 2007-09-20  1:46 UTC (permalink / raw)
  To: Daniel Walker; +Cc: linuxppc-dev, Thomas Gleixner, johnstul, Realtime Kernel
In-Reply-To: <1190252151.11899.66.camel@imap.mvista.com>

Daniel Walker writes:

> On Thu, 2007-09-20 at 10:52 +1000, Paul Mackerras wrote:
> > Daniel Walker writes:
> > 
> > > If you switch to the rtc do the shift and mult need to change?
> > 
> > You can't switch; any given CPU chip will have either the RTC or the
> > timebase but not both.
> 
> The code is switching between to clock read functions .. If they are

What part of "you can't switch" wasn't clear?  __USE_RTC() is a
constant on any given machine.

Paul.

^ permalink raw reply

* Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.
From: Daniel Walker @ 2007-09-20  1:54 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Thomas Gleixner, johnstul, Realtime Kernel
In-Reply-To: <18161.53509.342082.588911@cargo.ozlabs.ibm.com>

On Thu, 2007-09-20 at 11:46 +1000, Paul Mackerras wrote:
> Daniel Walker writes:
> 
> > On Thu, 2007-09-20 at 10:52 +1000, Paul Mackerras wrote:
> > > Daniel Walker writes:
> > > 
> > > > If you switch to the rtc do the shift and mult need to change?
> > > 
> > > You can't switch; any given CPU chip will have either the RTC or the
> > > timebase but not both.
> > 
> > The code is switching between to clock read functions .. If they are
> 
> What part of "you can't switch" wasn't clear?  __USE_RTC() is a
> constant on any given machine.

Maybe say "It a constant" up front .. The value that is output from the
clocksource read is converted to nanoseconds .. This clocksource is only
designed to work with the timebase, so it doesn't make sense to output
an rtc value.

Daniel

^ permalink raw reply

* [PATCH v3] [POWERPC] Fix build errors when BLOCK=n
From: Emil Medve @ 2007-09-20  2:25 UTC (permalink / raw)
  To: paulus, kumar.gala, linuxppc-dev, linuxppc-embedded, bzolnier,
	linux-ide
  Cc: Emil Medve

These are the symptom error messages:

  CC      arch/powerpc/kernel/setup_32.o
In file included from include/linux/blkdev.h:17,
                 from include/linux/ide.h:13,
                 from arch/powerpc/kernel/setup_32.c:13:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list
In file included from arch/powerpc/kernel/setup_32.c:13:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

  CC      arch/powerpc/kernel/ppc_ksyms.o
In file included from include/linux/blkdev.h:17,
                 from include/linux/ide.h:13,
                 from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list
In file included from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

The fix tries to use the smallest scope CONFIG_* symbols that will fix the build
problem. In this case <linux/ide.h> needs to be included only if IDE=y or
IDE=m were selected. Also, ppc_ide_md is needed only if BLK_DEV_IDE=y or
BLK_DEV_IDE=m

Moved the EXPORT_SYMBOL(ppc_ide_md) from ppc_ksysms.c next to its declaration
in setup_32.c which made <linux/ide.h> not needed. With <linux/ide.h> gone from
ppc_ksyms.c, <asm/cacheflush.h> is needed to address the following warnings and
errors:

  CC      arch/powerpc/kernel/ppc_ksyms.o
arch/powerpc/kernel/ppc_ksyms.c:122: error: '__flush_icache_range' undeclared here (not in a function)
arch/powerpc/kernel/ppc_ksyms.c:122: warning: type defaults to 'int' in declaration of '__flush_icache_range'
arch/powerpc/kernel/ppc_ksyms.c:123: error: 'flush_dcache_range' undeclared here (not in a function)
arch/powerpc/kernel/ppc_ksyms.c:123: warning: type defaults to 'int' in declaration of 'flush_dcache_range'

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---

I tested that the code builds with this patch in various combinations of
configuration options: all the combinations involving BLOCK, IDE and BLK_DEV_IDE

A patch for the warnings above has been already commited here: http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commitdiff;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a

This patch is against Paul's tree (75cdff9242c4e048cb830d359920719d29b9ee7c)

powerpc> scripts/checkpatch.pl 0001-POWERPC-Fix-build-errors-when-BLOCK-n.patch
Your patch has no obvious style problems and is ready for submission.

 arch/powerpc/kernel/ppc_ksyms.c |    6 +-----
 arch/powerpc/kernel/setup_32.c  |    5 +++++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 430c502..c6b1aa3 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -12,12 +12,12 @@
 #include <linux/irq.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
-#include <linux/ide.h>
 #include <linux/bitops.h>
 
 #include <asm/page.h>
 #include <asm/semaphore.h>
 #include <asm/processor.h>
+#include <asm/cacheflush.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/atomic.h>
@@ -95,10 +95,6 @@ EXPORT_SYMBOL(__strnlen_user);
 EXPORT_SYMBOL(copy_4K_page);
 #endif
 
-#if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE))
-EXPORT_SYMBOL(ppc_ide_md);
-#endif
-
 #if defined(CONFIG_PCI) && defined(CONFIG_PPC32)
 EXPORT_SYMBOL(isa_io_base);
 EXPORT_SYMBOL(isa_mem_base);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index a288a5f..7474502 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -10,7 +10,9 @@
 #include <linux/reboot.h>
 #include <linux/delay.h>
 #include <linux/initrd.h>
+#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE)
 #include <linux/ide.h>
+#endif
 #include <linux/tty.h>
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
@@ -49,7 +51,10 @@
 
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
 struct ide_machdep_calls ppc_ide_md;
+EXPORT_SYMBOL(ppc_ide_md);
+#endif
 
 int boot_cpuid;
 EXPORT_SYMBOL_GPL(boot_cpuid);
-- 
1.5.3.GIT

^ permalink raw reply related

* Re: Patches added to powerpc.git for-2.6.24 branch
From: Jeremy Kerr @ 2007-09-20  2:52 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras
In-Reply-To: <18161.53259.540174.870980@cargo.ozlabs.ibm.com>


A couple more, if these are acceptable:

[PATCH 1/2] cell: don't cast the result of of_get_property()
[PATCH 2/2] fsl/embedded6xx: don't cast the result of of_get_property

Cheers,


Jeremy

^ permalink raw reply

* Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.
From: David Gibson @ 2007-09-20  3:29 UTC (permalink / raw)
  To: Daniel Walker
  Cc: linuxppc-dev, Thomas Gleixner, Paul Mackerras, Realtime Kernel,
	johnstul
In-Reply-To: <1190253281.11899.74.camel@imap.mvista.com>

On Wed, Sep 19, 2007 at 06:54:41PM -0700, Daniel Walker wrote:
> On Thu, 2007-09-20 at 11:46 +1000, Paul Mackerras wrote:
> > Daniel Walker writes:
> > 
> > > On Thu, 2007-09-20 at 10:52 +1000, Paul Mackerras wrote:
> > > > Daniel Walker writes:
> > > > 
> > > > > If you switch to the rtc do the shift and mult need to change?
> > > > 
> > > > You can't switch; any given CPU chip will have either the RTC or the
> > > > timebase but not both.
> > > 
> > > The code is switching between to clock read functions .. If they are
> > 
> > What part of "you can't switch" wasn't clear?  __USE_RTC() is a
> > constant on any given machine.
> 
> Maybe say "It a constant" up front .. The value that is output from the
> clocksource read is converted to nanoseconds .. This clocksource is only
> designed to work with the timebase, so it doesn't make sense to output
> an rtc value.

I believe "rtc" in a 601 context means something different to "rtc" in
a general context...

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

^ permalink raw reply

* Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.
From: Daniel Walker @ 2007-09-20  3:38 UTC (permalink / raw)
  To: David Gibson
  Cc: linuxppc-dev, Thomas Gleixner, Paul Mackerras, Realtime Kernel,
	johnstul
In-Reply-To: <20070920032935.GC18991@localhost.localdomain>

On Thu, 2007-09-20 at 13:29 +1000, David Gibson wrote:

> > Maybe say "It a constant" up front .. The value that is output from the
> > clocksource read is converted to nanoseconds .. This clocksource is only
> > designed to work with the timebase, so it doesn't make sense to output
> > an rtc value.
> 
> I believe "rtc" in a 601 context means something different to "rtc" in
> a general context...

What's a 601 context?

Daniel

^ permalink raw reply

* Re: [PATCH 1/2] [FS_ENET] TX stuff should use fep->tx_lock, instead of fep->lock.
From: Jeff Garzik @ 2007-09-20  4:18 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev, linux-kernel, netdev
In-Reply-To: <20070918160527.13525.80935.stgit@localhost.localdomain>

Vitaly Bordug wrote:
> Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
> 
> ---
> 
>  drivers/net/fs_enet/fs_enet-main.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)

applied 1-2, after hand-editing the subject line to remove brackets from 
around "[FS_ENET]"

everything within [ and ] is removed, before copying to changelog, so 
please be careful

See http://linux.yyz.us/patch-format.html for more info.

	Jeff

^ permalink raw reply

* Re: [PATCH 1/3] powerpc clk.h interface for platforms
From: Paul Mackerras @ 2007-09-20  5:07 UTC (permalink / raw)
  To: Domen Puncer; +Cc: David Brownell, linuxppc-dev, Sylvain Munaut
In-Reply-To: <20070919051157.GH32628@nd47.coderock.org>

Domen Puncer writes:

> 52xx
> Reason for adding it to all was that EXPORT_SYMBOL's would clash if
> one were to add clk support for another platform.

What I meant was, why aren't you using a config symbol so that we
don't build it on platforms that don't need any "clk" support at all?

Paul.

^ permalink raw reply

* a problem of scsi(lsi 53c1020) driver
From: yuan tian @ 2007-09-20  5:51 UTC (permalink / raw)
  To: linuxppc-embedded

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

hi:
  Now there is a scsi controller(LSI 53c1020) on the pci slot of
ocotea(ppc440gx).
  I don't know if there is a driver of LSI53c1020 in Linux kernel(2.6.21).

 In kernel configuration ,my options are:
 Device Drivers  --->
         Fusion MPT device support  --->
          <*> Fusion MPT ScsiHost drivers for SPI

 Device Drivers  --->
         SCSI device support  --->
        <*> SCSI device support
        <*> SCSI disk support
 When the kernel was executed, some error information come from the console.

 copyright (c) 1999-2007 LSI Logic Corporation
 Fusion MPT SPI Host driver 3.04.04
 mptbase: Initiating ioc0 bringup
 ioc0: 53C1030: Capabilities={Initiator}
 scsi0 : ioc0: LSI53C1030, FwRev=01000300h, Ports=1, MaxQ=255, IRQ=25
 mptbase: ioc0: LogInfo(0x11010100): F/W: bug! MID not found
 mptbase: ioc0: LogInfo(0x11010100): F/W: bug! MID not found

 I don't know if there is something wrong in my kernel configuration .
 Any help will be appreciated!

 Regards,
 Tom

[-- Attachment #2: Type: text/html, Size: 1444 bytes --]

^ permalink raw reply

* Re: [PATCH] [POWERPC] Support setting affinity for U3/U4 MSI sources
From: Michael Ellerman @ 2007-09-20  6:36 UTC (permalink / raw)
  To: Olof Johansson; +Cc: linuxppc-dev, paulus
In-Reply-To: <20070917201229.GA17302@lixom.net>

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

On Mon, 2007-09-17 at 15:12 -0500, Olof Johansson wrote:
> Hook up affinity-setting for U3/U4 MSI interrupt sources.
> 
> Tested on Quad G5 with myri10ge.

And a JS21 blade:

# echo 1 > /proc/irq/21/smp_affinity 
# cat /proc/interrupts 
           CPU0       CPU1       
 21:        126        375  MPIC-U3MSI Edge      eth1
# ping -c 1000 -f cradle
1000 packets transmitted, 1000 received, 0% packet loss, time 135ms
# cat /proc/interrupts 
           CPU0       CPU1       
 21:       2153        375  MPIC-U3MSI Edge      eth1
# echo 2 > /proc/irq/21/smp_affinity 
# cat /proc/interrupts 
           CPU0       CPU1       
 21:       2174        379  MPIC-U3MSI Edge      eth1
# ping -c 1000 -f cradle
1000 packets transmitted, 1000 received, 0% packet loss, time 138ms
# cat /proc/interrupts 
           CPU0       CPU1       
 21:       2174       2389  MPIC-U3MSI Edge      eth1


Acked-by: Michael Ellerman <michael@ellerman.id.au>

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] phy: export phy_mii_ioctl
From: Jeff Garzik @ 2007-09-20  6:36 UTC (permalink / raw)
  To: Domen Puncer; +Cc: netdev, linuxppc-embedded
In-Reply-To: <20070917202140.GB2642@nd47.coderock.org>

Domen Puncer wrote:
> Export phy_mii_ioctl, so network drivers can use it when built
> as modules too.
> 
> Signed-off-by: Domen Puncer <domen@coderock.org>

applied

^ permalink raw reply

* [PATCH 1/4] Simplify error logic in u3msi_setup_msi_irqs()
From: Michael Ellerman @ 2007-09-20  6:36 UTC (permalink / raw)
  To: linuxppc-dev

u3msi_setup_msi_irqs() doesn't need to call teardown() itself,
the generic code will do this for us as long as we return a non
zero value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/sysdev/mpic_u3msi.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 305b864..4e50d1c 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -124,7 +124,6 @@ static void u3msi_compose_msi_msg(struct pci_dev *pdev, int virq,
 static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 {
 	irq_hw_number_t hwirq;
-	int rc;
 	unsigned int virq;
 	struct msi_desc *entry;
 	struct msi_msg msg;
@@ -132,17 +131,15 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	list_for_each_entry(entry, &pdev->msi_list, list) {
 		hwirq = mpic_msi_alloc_hwirqs(msi_mpic, 1);
 		if (hwirq < 0) {
-			rc = hwirq;
 			pr_debug("u3msi: failed allocating hwirq\n");
-			goto out_free;
+			return hwirq;
 		}
 
 		virq = irq_create_mapping(msi_mpic->irqhost, hwirq);
 		if (virq == NO_IRQ) {
 			pr_debug("u3msi: failed mapping hwirq 0x%lx\n", hwirq);
 			mpic_msi_free_hwirqs(msi_mpic, hwirq, 1);
-			rc = -ENOSPC;
-			goto out_free;
+			return -ENOSPC;
 		}
 
 		set_irq_msi(virq, entry);
@@ -156,10 +153,6 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	}
 
 	return 0;
-
- out_free:
-	u3msi_teardown_msi_irqs(pdev);
-	return rc;
 }
 
 int mpic_u3msi_init(struct mpic *mpic)
-- 
1.5.1.3.g7a33b

^ permalink raw reply related

* [PATCH 2/4] Simplify error logic in rtas_setup_msi_irqs()
From: Michael Ellerman @ 2007-09-20  6:36 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <3034ec8fd939bd5cfcdb7ac65206ae2771dc9b2c.1190270165.git.michael@ellerman.id.au>

rtas_setup_msi_irqs() doesn't need to call teardown() itself,
the generic code will do this for us as long as we return a non
zero value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/msi.c |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 6063ea2..9c3bcfe 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -189,29 +189,22 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 
 	if (rc != nvec) {
 		pr_debug("rtas_msi: rtas_change_msi() failed\n");
-
-		/*
-		 * In case of an error it's not clear whether the device is
-		 * left with MSI enabled or not, so we explicitly disable.
-		 */
-		goto out_free;
+		return rc;
 	}
 
 	i = 0;
 	list_for_each_entry(entry, &pdev->msi_list, list) {
 		hwirq = rtas_query_irq_number(pdn, i);
 		if (hwirq < 0) {
-			rc = hwirq;
 			pr_debug("rtas_msi: error (%d) getting hwirq\n", rc);
-			goto out_free;
+			return hwirq;
 		}
 
 		virq = irq_create_mapping(NULL, hwirq);
 
 		if (virq == NO_IRQ) {
 			pr_debug("rtas_msi: Failed mapping hwirq %d\n", hwirq);
-			rc = -ENOSPC;
-			goto out_free;
+			return -ENOSPC;
 		}
 
 		dev_dbg(&pdev->dev, "rtas_msi: allocated virq %d\n", virq);
@@ -220,10 +213,6 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	}
 
 	return 0;
-
- out_free:
-	rtas_teardown_msi_irqs(pdev);
-	return rc;
 }
 
 static void rtas_msi_pci_irq_fixup(struct pci_dev *pdev)
-- 
1.5.1.3.g7a33b

^ permalink raw reply related

* [PATCH 3/4] Simplify rtas_change_msi() error semantics
From: Michael Ellerman @ 2007-09-20  6:36 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <3034ec8fd939bd5cfcdb7ac65206ae2771dc9b2c.1190270165.git.michael@ellerman.id.au>

Currently rtas_change_msi() returns either the error code from RTAS, or if
the RTAS call succeeded the number of irqs that were configured by RTAS.
This makes checking the return value more complicated than it needs to be.

Instead, have rtas_change_msi() check that the number of irqs configured by
RTAS is equal to what we requested - and return an error otherwise. This makes
the return semantics match the usual 0 for success, something else for error.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/msi.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 9c3bcfe..2793a1b 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -70,11 +70,15 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs)
 		seq_num = rtas_ret[1];
 	} while (rtas_busy_delay(rc));
 
-	if (rc == 0) /* Success */
-		rc = rtas_ret[0];
+	/*
+	 * If the RTAS call succeeded, check the number of irqs is actually
+	 * what we asked for. If not, return an error.
+	 */
+	if (rc == 0 && rtas_ret[0] != num_irqs)
+		rc = -ENOSPC;
 
-	pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d) = (%d)\n",
-		 func, num_irqs, rc);
+	pr_debug("rtas_msi: ibm,change_msi(func=%d,num=%d), got %d rc = %d\n",
+		 func, num_irqs, rtas_ret[0], rc);
 
 	return rc;
 }
@@ -87,7 +91,7 @@ static void rtas_disable_msi(struct pci_dev *pdev)
 	if (!pdn)
 		return;
 
-	if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0) != 0)
+	if (rtas_change_msi(pdn, RTAS_CHANGE_FN, 0))
 		pr_debug("rtas_msi: Setting MSIs to 0 failed!\n");
 }
 
@@ -180,14 +184,14 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 	if (type == PCI_CAP_ID_MSI) {
 		rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec);
 
-		if (rc != nvec) {
+		if (rc) {
 			pr_debug("rtas_msi: trying the old firmware call.\n");
 			rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec);
 		}
 	} else
 		rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
 
-	if (rc != nvec) {
+	if (rc) {
 		pr_debug("rtas_msi: rtas_change_msi() failed\n");
 		return rc;
 	}
-- 
1.5.1.3.g7a33b

^ permalink raw reply related

* [PATCH 4/4] Inline u3msi_compose_msi_msg()
From: Michael Ellerman @ 2007-09-20  6:36 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <3034ec8fd939bd5cfcdb7ac65206ae2771dc9b2c.1190270165.git.michael@ellerman.id.au>

In the MPIC U3 MSI code, we call u3msi_compose_msi_msg() once for each MSI.
This is overkill, as the address is per pci device, not per MSI. So setup
the address once, and just set the data per MSI.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/sysdev/mpic_u3msi.c |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 4e50d1c..027fe01 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -107,26 +107,17 @@ static void u3msi_teardown_msi_irqs(struct pci_dev *pdev)
 	return;
 }
 
-static void u3msi_compose_msi_msg(struct pci_dev *pdev, int virq,
-				  struct msi_msg *msg)
-{
-	u64 addr;
-
-	addr = find_ht_magic_addr(pdev);
-	msg->address_lo = addr & 0xFFFFFFFF;
-	msg->address_hi = addr >> 32;
-	msg->data = virq_to_hw(virq);
-
-	pr_debug("u3msi: allocated virq 0x%x (hw 0x%lx) at address 0x%lx\n",
-		 virq, virq_to_hw(virq), addr);
-}
-
 static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 {
 	irq_hw_number_t hwirq;
 	unsigned int virq;
 	struct msi_desc *entry;
 	struct msi_msg msg;
+	u64 addr;
+
+	addr = find_ht_magic_addr(pdev);
+	msg.address_lo = addr & 0xFFFFFFFF;
+	msg.address_hi = addr >> 32;
 
 	list_for_each_entry(entry, &pdev->msi_list, list) {
 		hwirq = mpic_msi_alloc_hwirqs(msi_mpic, 1);
@@ -146,7 +137,10 @@ static int u3msi_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
 		set_irq_chip(virq, &mpic_u3msi_chip);
 		set_irq_type(virq, IRQ_TYPE_EDGE_RISING);
 
-		u3msi_compose_msi_msg(pdev, virq, &msg);
+		pr_debug("u3msi: allocated virq 0x%x (hw 0x%lx) addr 0x%lx\n",
+			  virq, hwirq, addr);
+
+		msg.data = hwirq;
 		write_msi_msg(virq, &msg);
 
 		hwirq++;
-- 
1.5.1.3.g7a33b

^ permalink raw reply related


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