2003-05-15 13:46:36

by Russell King

[permalink] [raw]
Subject: [PATCH] IRQ and resource for platform_device

The location and interrupt of some platform devices are only known by
platform specific code. In order to avoid putting platform specific
parameters into drivers, place resource and irq members into struct
platform_device.

Discussion point: is one resource and one irq enough?

--- orig/include/linux/device.h Mon May 5 17:40:10 2003
+++ linux/include/linux/device.h Wed May 14 15:35:40 2003
@@ -29,6 +29,7 @@
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/types.h>
+#include <linux/ioport.h>
#include <asm/semaphore.h>
#include <asm/atomic.h>

@@ -388,6 +389,8 @@
char * name;
u32 id;
struct device dev;
+ struct resource res;
+ unsigned int irq;
};

extern int platform_device_register(struct platform_device *);

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html


2003-05-15 15:51:06

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH] IRQ and resource for platform_device

On Thu, May 15, 2003 at 02:59:20PM +0100, Russell King wrote:
> The location and interrupt of some platform devices are only known by
> platform specific code. In order to avoid putting platform specific
> parameters into drivers, place resource and irq members into struct
> platform_device.
>
> Discussion point: is one resource and one irq enough?

No.

We have the same need for PPC SoC and system controller on-chip
devices. Some devices have multiple interrupts and/or resources.

Regards,
--
Matt Porter
[email protected]

2003-05-15 16:18:06

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] IRQ and resource for platform_device

On Thu, May 15, 2003 at 09:03:50AM -0700, Matt Porter wrote:
> On Thu, May 15, 2003 at 02:59:20PM +0100, Russell King wrote:
> > The location and interrupt of some platform devices are only known by
> > platform specific code. In order to avoid putting platform specific
> > parameters into drivers, place resource and irq members into struct
> > platform_device.
> >
> > Discussion point: is one resource and one irq enough?
>
> No.
>
> We have the same need for PPC SoC and system controller on-chip
> devices. Some devices have multiple interrupts and/or resources.

Is there a sane limit on the number of interrupts and resources for one
device?

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-05-15 17:22:31

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH] IRQ and resource for platform_device

On Thu, May 15, 2003 at 05:30:52PM +0100, Russell King wrote:
> On Thu, May 15, 2003 at 09:03:50AM -0700, Matt Porter wrote:
> > On Thu, May 15, 2003 at 02:59:20PM +0100, Russell King wrote:
> > > The location and interrupt of some platform devices are only known by
> > > platform specific code. In order to avoid putting platform specific
> > > parameters into drivers, place resource and irq members into struct
> > > platform_device.
> > >
> > > Discussion point: is one resource and one irq enough?
> >
> > No.
> >
> > We have the same need for PPC SoC and system controller on-chip
> > devices. Some devices have multiple interrupts and/or resources.
>
> Is there a sane limit on the number of interrupts and resources for one
> device?

As of today, I know of a device that has 5 interrupts and another
with 2 interrupts. I believe two resources is the most I've seen
so far on a "dumb" on-chip device.

I think having an array of irqs and resources of max count 8 should
do it for now.

No matter what we choose, the hardware designers will screw it up
eventually.

Regards,
--
Matt Porter
[email protected]

2003-05-15 18:00:50

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] IRQ and resource for platform_device

On Thu, May 15, 2003 at 10:35:13AM -0700, Matt Porter wrote:
> On Thu, May 15, 2003 at 05:30:52PM +0100, Russell King wrote:
> > Is there a sane limit on the number of interrupts and resources for one
> > device?
>
> As of today, I know of a device that has 5 interrupts and another
> with 2 interrupts. I believe two resources is the most I've seen
> so far on a "dumb" on-chip device.
>
> I think having an array of irqs and resources of max count 8 should
> do it for now.
>
> No matter what we choose, the hardware designers will screw it up
> eventually.

Hmm, how would people feel if I suggested just:

int num_resources;
struct resource *resources;

We have an IORESOURCE_IRQ, which can be used to indicate IRQ
resources.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2003-05-15 18:19:43

by Matt Porter

[permalink] [raw]
Subject: Re: [PATCH] IRQ and resource for platform_device

On Thu, May 15, 2003 at 07:13:36PM +0100, Russell King wrote:
> On Thu, May 15, 2003 at 10:35:13AM -0700, Matt Porter wrote:
> > I think having an array of irqs and resources of max count 8 should
> > do it for now.
> >
> > No matter what we choose, the hardware designers will screw it up
> > eventually.
>
> Hmm, how would people feel if I suggested just:
>
> int num_resources;
> struct resource *resources;
>
> We have an IORESOURCE_IRQ, which can be used to indicate IRQ
> resources.

I like that approach...simple and flexible.

-Matt

2003-05-15 19:41:21

by Patrick Mochel

[permalink] [raw]
Subject: Re: [PATCH] IRQ and resource for platform_device



> > Hmm, how would people feel if I suggested just:
> >
> > int num_resources;
> > struct resource *resources;
> >
> > We have an IORESOURCE_IRQ, which can be used to indicate IRQ
> > resources.
>
> I like that approach...simple and flexible.

Ditto. I've already added the original patch, but I'll gladly fix it up to
this way..

Thanks,

-pat