parport: Use the PCI IRQ if offered
PATCH 1/1 parport: Use the PCI IRQ if offered
---
drivers/parport/parport_cs.c | 3 +- drivers/parport/parport_pc.c | 57 ++++++++++++++++++++++++-------------- drivers/parport/parport_serial.c | 20 +++++++++++-- include/linux/parport_pc.h | 11 ++++--- 4 files changed, 60 insertions(+), 31 deletions(-)
drivers/parport/parport_cs.c +2 -1
@@ -43,6 +43,7 @@#include <linux/timer.h> #include <linux/ioport.h> #include <linux/major.h> +#include <linux/interrupt.h> #include <linux/parport.h> #include <linux/parport_pc.h>
@@ -192,7 +193,7 @@ static int parport_config(struct pcmcia_device *link) p =parport_pc_probe_port (link->io.BasePort1, link->io.BasePort2, link->irq.AssignedIRQ,PARPORT_DMA_NONE , - &link->dev); + &link->dev,IRQF_SHARED );if (p ==NULL ) { printk(KERN_NOTICE "parport_cs: parport_pc_probe_port() at " "0x%3x, irq %u failed\n", link->io.BasePort1,
drivers/parport/parport_pc.c +36 -21
123 lines not on this page · raw message
drivers/parport/parport_serial.c +16 -4
@@ -21,6 +21,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> +#include <linux/interrupt.h> #include <linux/parport.h> #include <linux/parport_pc.h> #include <linux/8250_pci.h>
@@ -291,6 +292,7 @@ static int __devinit parport_register (struct pci_dev *dev,int lo = card->addr[n].lo;int hi = card->addr[n].hi;unsigned long io_lo, io_hi; +int irq;if (priv->num_par ==ARRAY_SIZE (priv->port)) { printk (KERN_WARNING
@@ -309,10 +311,20 @@ static int __devinit parport_register (struct pci_dev *dev,"hi" as an offset (see SYBA def.) */ /* TODO: test if sharing interrupts works */ -dev_dbg (&dev->dev,"PCI parallel port detected: I/O at " -"%#lx(%#lx)\n" , io_lo, io_hi); - port =parport_pc_probe_port (io_lo, io_hi,PARPORT_IRQ_NONE , -PARPORT_DMA_NONE , &dev->dev); + irq = dev->irq; +if (irq ==IRQ_NONE ) { +dev_dbg (&dev->dev, +"PCI parallel port detected: I/O at %#lx(%#lx)\n" , + io_lo, io_hi); + irq =PARPORT_IRQ_NONE ; + }else { +dev_dbg (&dev->dev, +"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n" , + io_lo, io_hi, irq); + irq =PARPORT_IRQ_NONE ; + } + port =parport_pc_probe_port (io_lo, io_hi, irq, +PARPORT_DMA_NONE , &dev->dev,IRQF_SHARED );if (port) { priv->port[priv->num_par++] = port; success =1 ;
include/linux/parport_pc.h +6 -5
@@ -228,10 +228,11 @@ extern void parport_pc_release_resources(struct parport *p);extern int parport_pc_claim_resources (struct parport *p);/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */ -extern struct parport *parport_pc_probe_port (unsigned long base, -unsigned long base_hi, -int irq,int dma, -struct device *dev); -extern void parport_pc_unregister_port (struct parport *p); +extern struct parport *parport_pc_probe_port (unsigned long base, +unsigned long base_hi, +int irq,int dma, +struct device *dev, +int irqflags); +extern void parport_pc_unregister_port (struct parport *p);#endif
Quoted 1 line · Alan Cox
Signed-off-by Alan Cox <[email protected]>
A long, long time ago I poked at introducing some PCI-ish probing to parport_pc, reading the port mode, I/O port, and possibly irq from motherboard-specific magic locations.
This is a helpful extension of that [years-old] work... good stuff.
Jeff
Hi Alan,
just to confirm, IRQ detection works fine on my Lava parallel card.
The instrument driver module that registers an irq handler via parport_register_device gets false events when parport irq is shared e.g. with an ethernet controller. Should irq sharing awareness go to our handler function or parport_irq_handler/parport_generic_irq still needs some additional patch? (Or have I just missed this second patch?)
Thanks
Gabor Kovacs
Quoted 15 lines · On Thursday 26 March 2009 18:40:42 Jeff Garzik wrote:
Quoted 1 line · Alan Cox
Signed-off-by Alan Cox <[email protected]>Reviewed-by Jeff Garzik <[email protected]>A long, long time ago I poked at introducing some PCI-ish probing to
parport_pc, reading the port mode, I/O port, and possibly irq from motherboard-specific magic locations.This is a helpful extension of that [years-old] work... good stuff.
Jeff
Quoted 9 lines · On Tue, 31 Mar 2009 15:31:56 -0400 Gabor Kovacs <[email protected]> wrote:
Hi Alan,
just to confirm, IRQ detection works fine on my Lava parallel card.
The instrument driver module that registers an irq handler via
parport_register_devicegets false events when parport irq is shared e.g. with an ethernet controller. Should irq sharing awareness go to our handler function or parport_irq_handler/parport_generic_irq still needs some additional patch? (Or have I just missed this second patch?)
I suspect it may have to go in the handler functions to avoid the risk of losing any state reading the registers to see an IRQ is pending. The ideal case would be to keep it in the common code path however.
I've not looked at that so far as a lot of hardware is just fine without the checks. I guess try it and see with your actual hardware