Skip to contentSkip to conversation

DM9000 interrupt is hardware dependant

PATCH In review Jürgen Schindele 4 participants 4 messages Sep 4, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DM9000 interrupt is hardware dependant

Hi developers,
i made a patch for an PXA270-evalboard with DM9000 ethernet contoller. The Interrupt can be high- or low- active dependant of the wiring of the MDC-(57)pin.

Because of this hardware dependency you shoud be able
to configure this behaviour in "struct resource dm9000_resources[]"

Please comment an review my patch which is attached here

Thanksalot
Jürgen Schindele

drivers/net/dm9000.c +2 -1
index 24996da..0a71f7b 100644
@@ -598,10 +598,11 @@ static int
 dm9000_open(struct net_device *dev)
 {
 	board_info_t *db = (board_info_t *) dev->priv;
+	unsigned long sa_flags = resource_sa_flags(db->irq_res);
 
 	PRINTK2("entering dm9000_open\n");
 
-	if (request_irq(dev->irq, &dm9000_interrupt, SA_SHIRQ, dev->name, dev))
+	if (request_irq(dev->irq, &dm9000_interrupt, SA_SHIRQ | sa_flags, dev->name, dev))
 		return -EAGAIN;
 
 	/* Initialize DM9000 board */
include/linux/ioport.h +6 -0
index cd6bd00..2eebd91 100644
@@ -54,6 +54,12 @@ #define IORESOURCE_IRQ_LOWEDGE		(1<<1)
 #define IORESOURCE_IRQ_HIGHLEVEL	(1<<2)
 #define IORESOURCE_IRQ_LOWLEVEL		(1<<3)
 
+/* this macro gets back SA_TRIGGER_* bits
+ * defined in include/linux/signal.h from
+ * resource->flags which are the same as 
+ * IORESOURCE_IRQ_* bits */
+#define resource_sa_flags(res)		((res)->flags & 0xf)
+
 /* ISA PnP DMA specific bits (IORESOURCE_BITS) */
 #define IORESOURCE_DMA_TYPE_MASK	(3<<0)
 #define IORESOURCE_DMA_8BIT		(0<<0)
#1 lore raw
Quoted 6 lines · Jürgen Schindele

i made a patch for an PXA270-evalboard with DM9000 ethernet contoller. The Interrupt can be high- or low- active dependant of the wiring of the MDC-(57)pin.

Because of this hardware dependency you shoud be able
to configure this behaviour in "struct resource dm9000_resources[]"

Putting it in 'struct dm9000_plat_data' sounds like a much better idea to me...

Overloading the IRQ number in 'struct resource' is just ugly.

cheers,
Lennert

#2 lore raw
Quoted 6 lines · Lennert Buytenhek
Quoted 4 lines · J?rgen Schindele

i made a patch for an PXA270-evalboard with DM9000 ethernet contoller. The Interrupt can be high- or low- active dependant of the wiring of the MDC-(57)pin.

Quoted 7 lines
Quoted 2 lines

Because of this hardware dependency you shoud be able
to configure this behaviour in "struct resource dm9000_resources[]"

Putting it in 'struct dm9000_plat_data' sounds like a much better idea to me...

Overloading the IRQ number in 'struct resource' is just ugly.

My view is that this would be useful to a number of drivers, and is a good use of the resource flags for drivers which do not currently have platform data.

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
#3 lore raw
In reply to Jürgen Schindele

Jürgen Schindele <[email protected]> :
[...]

Quoted 1 line

Please comment an review my patch which is attached here

drivers/net/dm9000.c +2 -1
index 24996da..0a71f7b 100644
@@ -598,10 +598,11 @@ static int
 dm9000_open(struct net_device *dev)
 {
 	board_info_t *db = (board_info_t *) dev->priv;
+	unsigned long sa_flags = resource_sa_flags(db->irq_res);
 
 	PRINTK2("entering dm9000_open\n");
 
-	if (request_irq(dev->irq, &dm9000_interrupt, SA_SHIRQ, dev->name, dev))
+	if (request_irq(dev->irq, &dm9000_interrupt, SA_SHIRQ | sa_flags, dev->name, dev))
 

SA_SHIRQ has been replaced by IRQF_SHARED.

Please check include/linux/interrupt.h in a recent kernel 2.6.18-rc kernel.

Signature · 1 line
Ueimor