Skip to contentSkip to conversation

IRQ and resource for platform_device

PATCH In review Russell King 3 participants 7 messages May 15, 2003 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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?

include/linux/device.h +3 -0
@@ -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 *);
Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#1 lore raw
Quoted 6 lines · Russell King

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,

Signature · 2 lines
Matt Porter
[email protected]
#2 lore raw
Quoted 6 lines · Matt Porter
Quoted 5 lines · Russell King

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.

Quoted 6 lines
Quoted 1 line

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?

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#3 lore raw
Quoted 9 lines · Russell King
Quoted 8 lines · Matt Porter
Quoted 6 lines · Russell King

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?

Quoted 7 lines
Quoted 4 lines

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,

Signature · 2 lines
Matt Porter
[email protected]
#4 lore raw
Quoted 8 lines · Matt Porter
Quoted 2 lines · Russell King

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.

Quoted 5 lines

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.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#5 lore raw
Quoted 7 lines · Russell King
Quoted 5 lines · Matt Porter

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.

Quoted 7 lines

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

#6 lore raw
Quoted 11 lines
Quoted 9 lines

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