mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Lava dual parallel PCI card IRQ problem
       [not found] <20090318143921.22B5B13A4B0@koiott.tartu-labor>
@ 2009-03-19 13:04 ` Meelis Roos
  2009-03-19 13:10   ` Alan Cox
  0 siblings, 1 reply; 10+ messages in thread
From: Meelis Roos @ 2009-03-19 13:04 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

> First cut to try
>
> parport: Use the PCI IRQ if offered
>
> From: Alan Cox <alan@lxorguk.ukuu.org.uk>

Doesn't seem to do anything here on a 1-port Lava PCI parallel card

parport0: PC-style at 0x378 (0x778), irq 7, dma 3 [PCSPP,TRISTATE,COMPAT,ECP,DMA]
ACPI: PCI Interrupt Link [LNKH] enabled at IRQ 11
parport_pc 0000:01:0b.0: PCI INT A -> Link[LNKH] -> GSI 11 (level, low) -> IRQ 11
PCI parallel port detected: 1407:8000, I/O at 0xdff0(0x0), IRQ 11
parport1: PC-style at 0xdff0 [PCSPP,TRISTATE,EPP]
[...]
lp0: using parport0 (interrupt-driven).
lp1: using parport1 (polling).

lspci tells this:
01:0b.0 Parallel controller [0701]: Lava Computer mfg Inc Lava Parallel [1407:8000] (prog-if 01 [BiDir])
         Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
         Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=slow >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
         Interrupt: pin A routed to IRQ 11
         Region 0: I/O ports at dff0 [size=8]
         Kernel driver in use: parport_pc


-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-19 13:04 ` Lava dual parallel PCI card IRQ problem Meelis Roos
@ 2009-03-19 13:10   ` Alan Cox
  2009-03-19 13:33     ` Meelis Roos
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Cox @ 2009-03-19 13:10 UTC (permalink / raw)
  To: Meelis Roos; +Cc: linux-kernel

> PCI parallel port detected: 1407:8000, I/O at 0xdff0(0x0), IRQ 11

Well we are half way there - it has detected the port and IRQ properly.

> parport1: PC-style at 0xdff0 [PCSPP,TRISTATE,EPP]
> [...]
> lp0: using parport0 (interrupt-driven).
> lp1: using parport1 (polling).

You may need to stick a few printks in the port registration path to see
why it made that decision.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-19 13:10   ` Alan Cox
@ 2009-03-19 13:33     ` Meelis Roos
  2009-03-19 13:49       ` Meelis Roos
  0 siblings, 1 reply; 10+ messages in thread
From: Meelis Roos @ 2009-03-19 13:33 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

> You may need to stick a few printks in the port registration path to see
> why it made that decision.

Got it - it's a simple copypaste mistake:

+               irq = dev->irq;
+               if (irq == IRQ_NONE) {
+                       printk (KERN_DEBUG
+       "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx)\n",
+                               parport_pc_pci_tbl[i + last_sio].vendor,
+                               parport_pc_pci_tbl[i + last_sio].device,
+                               io_lo, io_hi);
+                       irq = PARPORT_IRQ_NONE;
+               } else {
+                       printk (KERN_DEBUG
+       "PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n",
+                               parport_pc_pci_tbl[i + last_sio].vendor,
+                               parport_pc_pci_tbl[i + last_sio].device,
+                               io_lo, io_hi, irq);
+                       irq = PARPORT_IRQ_NONE;
+               }

If I remove the second "irq = PARPORT_IRQ_NONE;" it starts to load fine. 
Will test later with a rela printer attached.

-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-19 13:33     ` Meelis Roos
@ 2009-03-19 13:49       ` Meelis Roos
  2009-03-20  7:36         ` Meelis Roos
  0 siblings, 1 reply; 10+ messages in thread
From: Meelis Roos @ 2009-03-19 13:49 UTC (permalink / raw)
  To: Alan Cox; +Cc: Linux Kernel list

> If I remove the second "irq = PARPORT_IRQ_NONE;" it starts to load fine. 
> Will test later with a rela printer attached.

Printer prints without the patch.

The whole system hangs hard when trying to print with the patch applied. 
100% repeatable, and with loglevel 9, nothing appears on the console.

IRQ 11 is shared with many other PCI devices.

-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-19 13:49       ` Meelis Roos
@ 2009-03-20  7:36         ` Meelis Roos
  0 siblings, 0 replies; 10+ messages in thread
From: Meelis Roos @ 2009-03-20  7:36 UTC (permalink / raw)
  To: Alan Cox; +Cc: Linux Kernel list

> Printer prints without the patch.
> 
> The whole system hangs hard when trying to print with the patch applied. 
> 100% repeatable, and with loglevel 9, nothing appears on the console.

Recompiled the kernels with most debug options turned on under kernel 
hacking menu, still no messages.

-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-18 11:35     ` Alan Cox
@ 2009-03-19 20:41       ` Gabor Kovacs
  0 siblings, 0 replies; 10+ messages in thread
From: Gabor Kovacs @ 2009-03-19 20:41 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Hi Alan,

Your patch looks good. IRQ detection works on my dual parallel port.

[ 3131.988489] pnp: the driver 'parport_pc' has been registered
[ 3131.988510] parport_pc 00:04: current resources: before 
pnp_assign_resources
[ 3131.988513] parport_pc 00:04:   irq 7 flags 0x401
[ 3131.988516] parport_pc 00:04:   io  0x378-0x37f flags 0x101
[ 3131.988521] parport_pc 00:04: assigning independent options
[ 3131.988524] parport_pc 00:04: assigning dependent option 1
[ 3131.988527] parport_pc 00:04:   io 0 already set to 0x378-0x37f flags 0x101
[ 3131.988530] parport_pc 00:04:   irq 0 already set to 7 flags 0x401
[ 3131.988532] parport_pc 00:04: current resources: after pnp_assign_resources
[ 3131.988535] parport_pc 00:04:   irq 7 flags 0x401
[ 3131.988538] parport_pc 00:04:   io  0x378-0x37f flags 0x101
[ 3131.988542] parport_pc 00:04: current resources: pnp_start_dev
[ 3131.988546] parport_pc 00:04:   irq 7 flags 0x401
[ 3131.988549] parport_pc 00:04:   io  0x378-0x37f flags 0x101
[ 3131.988553] parport_pc 00:04: set resources
[ 3131.989987] parport_pc 00:04: encode 3 resources
[ 3131.989990] parport_pc 00:04:   encode io 0x378-0x37f decode 0x1
[ 3131.989993] parport_pc 00:04:   encode irq 7 edge high exclusive (2-byte 
descriptor)
[ 3131.989996] parport_pc 00:04:   encode dma -1 type 0x0 transfer 0x0 master 
0
[ 3131.990898] parport_pc 00:04: activated
[ 3131.990898] parport_pc 00:04: reported by Plug and Play ACPI
[ 3131.990898] parport0: PC-style at 0x378, irq 7 [PCSPP]
[ 3132.093522] parport_pc 00:04: driver attached
[ 3132.094824] PCI parallel port detected: 1407:8002, I/O at 0xb880(0x0), IRQ 
17
[ 3132.094824] parport1: PC-style at 0xb880 [PCSPP,TRISTATE,EPP]
[ 3132.185524] PCI parallel port detected: 1407:8003, I/O at 0xb800(0x0), IRQ 
17
[ 3132.185547] parport2: PC-style at 0xb800 [PCSPP,TRISTATE,EPP]

======

01:07.0 Parallel controller: Lava Computer mfg Inc Lava Dual Parallel port A 
(rev 03) (prog-if 01 [BiDir])
        Subsystem: Lava Computer mfg Inc Lava Dual Parallel port A                                        
        Flags: medium devsel, IRQ 17                                                                      
        I/O ports at b880 [size=8]                                                                        
        Kernel driver in use: parport_pc                                                                  
        Kernel modules: parport_pc                                                                        

01:07.1 Parallel controller: Lava Computer mfg Inc Lava Dual Parallel port B 
(rev 03) (prog-if 01 [BiDir])
        Subsystem: Lava Computer mfg Inc Lava Dual Parallel port B                                        
        Flags: medium devsel, IRQ 17                                                                      
        I/O ports at b800 [size=8]                                                                        
        Kernel driver in use: parport_pc                                                                  
        Kernel modules: parport_pc                                                                        

......

06:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 
Gigabit Ethernet Adapter (rev 82)
        Subsystem: VIA Technologies, Inc. Device 0110
        Flags: bus master, fast devsel, latency 0, IRQ 17
        I/O ports at e800 [size=256]
        Memory at febffc00 (64-bit, non-prefetchable) [size=256]
        Capabilities: [50] Power Management version 3
        Capabilities: [90] Express Endpoint, MSI 00
        Capabilities: [c0] Message Signalled Interrupts: Mask+ 64bit+ 
Queue=0/0 Enable-
        Kernel driver in use: via-velocity
        Kernel modules: via-velocity

===

I also tried commenting out "irq = PARPORT_IRQ_NONE;" Interrupts are working, 
of course, driver is not yet aware of irq sharing. Each time I have some 
network traffic, I get an interrupt on parport, too. I guess the two ports on 
Lava card cannot be distinguished either.

Looking forward to the next part.

-- Gabor

On Wednesday 18 March 2009 07:35:59 Alan Cox wrote:
> First cut to try
>
> parport: Use the PCI IRQ if offered
>
> From: Alan Cox <alan@lxorguk.ukuu.org.uk>
>
> parport: Use the PCI IRQ if offered
>
> From: Alan Cox <alan@lxorguk.ukuu.org.uk>
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-17 22:52   ` Gabor Kovacs
@ 2009-03-18 11:35     ` Alan Cox
  2009-03-19 20:41       ` Gabor Kovacs
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Cox @ 2009-03-18 11:35 UTC (permalink / raw)
  To: Gabor Kovacs; +Cc: linux-kernel

First cut to try

parport: Use the PCI IRQ if offered

From: Alan Cox <alan@lxorguk.ukuu.org.uk>

parport: Use the PCI IRQ if offered

From: Alan Cox <alan@lxorguk.ukuu.org.uk>


---

 drivers/parport/parport_cs.c     |    3 +-
 drivers/parport/parport_pc.c     |   58 ++++++++++++++++++++++++--------------
 drivers/parport/parport_serial.c |   20 ++++++++++---
 include/linux/parport_pc.h       |   11 ++++---
 4 files changed, 61 insertions(+), 31 deletions(-)


diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 0cd5fbc..8fdfa4f 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -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,
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 96f3bdf..ff01d01 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2170,10 +2170,11 @@ static int parport_dma_probe (struct parport *p)
 static LIST_HEAD(ports_list);
 static DEFINE_SPINLOCK(ports_lock);
 
-struct parport *parport_pc_probe_port (unsigned long int base,
-				       unsigned long int base_hi,
-				       int irq, int dma,
-				       struct device *dev)
+struct parport *parport_pc_probe_port(unsigned long int base,
+				      unsigned long int base_hi,
+				      int irq, int dma,
+				      struct device *dev,
+				      int irqflags)
 {
 	struct parport_pc_private *priv;
 	struct parport_operations *ops;
@@ -2194,11 +2195,11 @@ struct parport *parport_pc_probe_port (unsigned long int base,
 		dev = &pdev->dev;
 	}
 
-	ops = kmalloc(sizeof (struct parport_operations), GFP_KERNEL);
+	ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL);
 	if (!ops)
 		goto out1;
 
-	priv = kmalloc (sizeof (struct parport_pc_private), GFP_KERNEL);
+	priv = kmalloc(sizeof(struct parport_pc_private), GFP_KERNEL);
 	if (!priv)
 		goto out2;
 
@@ -2325,8 +2326,8 @@ struct parport *parport_pc_probe_port (unsigned long int base,
 		EPP_res = NULL;
 	}
 	if (p->irq != PARPORT_IRQ_NONE) {
-		if (request_irq (p->irq, parport_irq_handler,
-				 0, p->name, p)) {
+		if (request_irq(p->irq, parport_irq_handler,
+				 irqflags, p->name, p)) {
 			printk (KERN_WARNING "%s: irq %d in use, "
 				"resorting to polled operation\n",
 				p->name, p->irq);
@@ -2530,7 +2531,7 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
 	 */
 	release_resource(base_res);
 	if (parport_pc_probe_port (ite8872_lpt, ite8872_lpthi,
-				   irq, PARPORT_DMA_NONE, &pdev->dev)) {
+				   irq, PARPORT_DMA_NONE, &pdev->dev, 0)) {
 		printk (KERN_INFO
 			"parport_pc: ITE 8872 parallel port: io=0x%X",
 			ite8872_lpt);
@@ -2713,7 +2714,7 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
 	}
 
 	/* finally, do the probe with values obtained */
-	if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev)) {
+	if (parport_pc_probe_port (port1, port2, irq, dma, &pdev->dev, 0)) {
 		printk (KERN_INFO
 			"parport_pc: VIA parallel port: io=0x%X", port1);
 		if (irq != PARPORT_IRQ_NONE)
@@ -3018,6 +3019,7 @@ static int parport_pc_pci_probe (struct pci_dev *dev,
 	for (n = 0; n < cards[i].numports; n++) {
 		int lo = cards[i].addr[n].lo;
 		int hi = cards[i].addr[n].hi;
+		int irq;
 		unsigned long io_lo, io_hi;
 		io_lo = pci_resource_start (dev, lo);
 		io_hi = 0;
@@ -3028,13 +3030,26 @@ static int parport_pc_pci_probe (struct pci_dev *dev,
                                         "hi" as an offset (see SYBA
                                         def.) */
 		/* TODO: test if sharing interrupts works */
-		printk (KERN_DEBUG "PCI parallel port detected: %04x:%04x, "
-			"I/O at %#lx(%#lx)\n",
-			parport_pc_pci_tbl[i + last_sio].vendor,
-			parport_pc_pci_tbl[i + last_sio].device, io_lo, io_hi);
+		irq = dev->irq;
+		if (irq == IRQ_NONE) {
+			printk (KERN_DEBUG
+	"PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx)\n",
+				parport_pc_pci_tbl[i + last_sio].vendor,
+				parport_pc_pci_tbl[i + last_sio].device,
+				io_lo, io_hi);
+			irq = PARPORT_IRQ_NONE;
+		} else {
+			printk (KERN_DEBUG
+	"PCI parallel port detected: %04x:%04x, I/O at %#lx(%#lx), IRQ %d\n",
+				parport_pc_pci_tbl[i + last_sio].vendor,
+				parport_pc_pci_tbl[i + last_sio].device,
+				io_lo, io_hi, irq);
+			irq = PARPORT_IRQ_NONE;
+		}
 		data->ports[count] =
-			parport_pc_probe_port (io_lo, io_hi, PARPORT_IRQ_NONE,
-					       PARPORT_DMA_NONE, &dev->dev);
+			parport_pc_probe_port(io_lo, io_hi, irq,
+					       PARPORT_DMA_NONE, &dev->dev, 
+					       IRQF_SHARED);
 		if (data->ports[count])
 			count++;
 	}
@@ -3143,7 +3158,8 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id
 		dma = PARPORT_DMA_NONE;
 
 	dev_info(&dev->dev, "reported by %s\n", dev->protocol->name);
-	if (!(pdata = parport_pc_probe_port (io_lo, io_hi, irq, dma, &dev->dev)))
+	if (!(pdata = parport_pc_probe_port(io_lo, io_hi,
+					irq, dma, &dev->dev, 0)))
 		return -ENODEV;
 
 	pnp_set_drvdata(dev,pdata);
@@ -3192,11 +3208,11 @@ parport_pc_find_isa_ports (int autoirq, int autodma)
 {
 	int count = 0;
 
-	if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL))
+	if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL, 0))
 		count++;
-	if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL))
+	if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL, 0))
 		count++;
-	if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL))
+	if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL, 0))
 		count++;
 
 	return count;
@@ -3481,7 +3497,7 @@ static int __init parport_pc_init(void)
 			if ((io_hi[i]) == PARPORT_IOHI_AUTO)
 			       io_hi[i] = 0x400 + io[i];
 			parport_pc_probe_port(io[i], io_hi[i],
-						  irqval[i], dmaval[i], NULL);
+					  irqval[i], dmaval[i], NULL, 0);
 		}
 	} else
 		parport_pc_find_ports (irqval[0], dmaval[0]);
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 032db81..030f5a6 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -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;
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index ea8c6d8..cc1767f 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-16 10:57 ` Alan Cox
@ 2009-03-17 22:52   ` Gabor Kovacs
  2009-03-18 11:35     ` Alan Cox
  0 siblings, 1 reply; 10+ messages in thread
From: Gabor Kovacs @ 2009-03-17 22:52 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On Monday 16 March 2009 06:57:28 Alan Cox wrote:
> On Fri, 13 Mar 2009 00:51:18 -0400
>
> Gabor Kovacs <kgabor@bolyai.elte.hu> wrote:
> > Hi All,
> >
> > I have problems in setting up IRQ mode operation of parallel ports using
> > onboard port and a LAVA dual parallel PCI card. IRQ is needed to catch
> > events of an external instrument.
>
> The current driver never tries to initialise IRQ support for parallel PCI
> ports and never has. I am not sure why this should be the case but I can
> send you a patch to see what happens if we enable it.

Thanks, that would be great. Indeed, I also looked a bit into parport_pc.c and 
found that there is no autodetection. There is some irq detection code in 
irq_probe_EPP (disabled by ADVANCED_DETECT macro), but enabling it gives 
compile error.

Gabor

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lava dual parallel PCI card IRQ problem
  2009-03-13  4:51 Gabor Kovacs
@ 2009-03-16 10:57 ` Alan Cox
  2009-03-17 22:52   ` Gabor Kovacs
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Cox @ 2009-03-16 10:57 UTC (permalink / raw)
  To: Gabor Kovacs; +Cc: linux-kernel

On Fri, 13 Mar 2009 00:51:18 -0400
Gabor Kovacs <kgabor@bolyai.elte.hu> wrote:

> Hi All,
> 
> I have problems in setting up IRQ mode operation of parallel ports using 
> onboard port and a LAVA dual parallel PCI card. IRQ is needed to catch events 
> of an external instrument.

The current driver never tries to initialise IRQ support for parallel PCI
ports and never has. I am not sure why this should be the case but I can
send you a patch to see what happens if we enable it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Lava dual parallel PCI card IRQ problem
@ 2009-03-13  4:51 Gabor Kovacs
  2009-03-16 10:57 ` Alan Cox
  0 siblings, 1 reply; 10+ messages in thread
From: Gabor Kovacs @ 2009-03-13  4:51 UTC (permalink / raw)
  To: linux-kernel

Hi All,

I have problems in setting up IRQ mode operation of parallel ports using 
onboard port and a LAVA dual parallel PCI card. IRQ is needed to catch events 
of an external instrument.

Motherboard is a K9N2G-Neo (MS-7511) with one onboard parallel port, x86_64 
Debian lenny, kernel custom compiled 2.6.26.5.

In the example below, parport_pc is loaded without any arguments, onboard port 
works OK in IRQ mode. LAVA card ports are detected but do not have IRQs, work 
in polled operation:

modprobe parport_pc
===
parport_pc 00:04: reported by Plug and Play ACPI
parport0: PC-style at 0x378, irq 7 [PCSPP]
ACPI: Power Button (CM) [PWRB]
parport_pc 00:04: driver attached
ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 16
ACPI: PCI Interrupt 0000:01:06.0[A] -> Link [LNKC] -> GSI 16 (level, low) -> 
IRQ 16
PCI parallel port detected: 1407:8002, I/O at 0xb400(0x0)
parport1: PC-style at 0xb400 [PCSPP,TRISTATE,EPP]
ACPI: PCI Interrupt 0000:01:06.1[A] -> Link [LNKC] -> GSI 16 (level, low) -> 
IRQ 16
PCI parallel port detected: 1407:8003, I/O at 0xb080(0x0)
parport2: PC-style at 0xb080 [PCSPP,TRISTATE,EPP]

If "io" and "irq" options are specified, parport_pc falls back to some "dumb" 
mode. Onboard port does not work at all (lack of PNP/ACPI initialization ?), 
LAVA card may work if proper IRQ and IO address are specified (reported by 
lspci -v). In most cases, however, this IRQ is already used by an NEC USB 
card in my box. Actually, I could not find any way to control IRQ assignment 
for cards. The only way is to remove some cards or playing with card order  
in slots.

- Is there a way to autodetect and activate LAVA card in IRQ mode? 
- What kind of PnP/ACPI initialization steps are omitted if IO/IRQ parameters 
are passed to parport_pc?
- Why can't parport_pc share IRQ? (Other devices apparently share IRQs in the 
box. See irq 17 below) 

Thanks
Gabor Kovacs

===========
Scenarios:

Lava card works in polled operation, onboard port does not work at all:

modprobe parport_pc io=0x378,0xb400,0xb080 irq=auto,auto,auto
===
parport 0x378 (WARNING): CTR: wrote 0x0c, read 0xff
parport 0x378 (WARNING): DATA: wrote 0xaa, read 0xff
parport 0x378: You gave this address, but there is probably no parallel port 
there!
parport0: PC-style at 0x378 [PCSPP,TRISTATE]
parport1: PC-style at 0xb400 [PCSPP,TRISTATE,EPP]
parport2: PC-style at 0xb080 [PCSPP,TRISTATE,EPP]

=========

IRQ conflict is reported by parport_pc:
modprobe parport_pc io=0xb400,0xb080 irq=auto,16
===
parport0: PC-style at 0xb400 [PCSPP,TRISTATE,EPP]
parport1: PC-style at 0xb080, irq 16 [PCSPP,TRISTATE,EPP]
parport1: irq 16 in use, resorting to polled operation

cat /proc/interrupts:

           CPU0       CPU1       CPU2       CPU3
  0:         37          0          0          0   IO-APIC-edge      timer
  1:          0          0          0        676   IO-APIC-edge      i8042
  7:          2          0          0          0   IO-APIC-edge
  9:          0          0          0          0   IO-APIC-fasteoi   acpi
 12:          0          0          8       5194   IO-APIC-edge      i8042
 14:          0          0          0          0   IO-APIC-edge      pata_amd
 15:          0          0          0          0   IO-APIC-edge      pata_amd
 16:          0          0          0          0   IO-APIC-fasteoi   
ohci_hcd:usb1
 17:          0          0          0          4   IO-APIC-fasteoi
 18:          0          0          0          0   IO-APIC-fasteoi   
ehci_hcd:usb3
 19:          0          0          0          0   IO-APIC-fasteoi   
ohci_hcd:usb2
507:          0          0        238    2024744   PCI-MSI-edge      eth0
508:          0          0         60     176614   PCI-MSI-edge      ahci
NMI:          0          0          0          0   Non-maskable interrupts
LOC:    4898793    4898779    4898752    4898724   Local timer interrupts
RES:      20033      12217      15650      29497   Rescheduling interrupts
CAL:        517        602        607        137   function call interrupts
TLB:       1200        992        869        796   TLB shootdowns
TRM:          0          0          0          0   Thermal event interrupts
THR:          0          0          0          0   Threshold APIC interrupts
SPU:          0          0          0          0   Spurious interrupts
ERR:          1

lspci -v:
========
00:00.0 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller 
(rev a2)
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: bus master, 66MHz, fast devsel, latency 0
        Capabilities: [94] HyperTransport: #1a
        Capabilities: [60] HyperTransport: Retry Mode
        Capabilities: [44] HyperTransport: Slave or Primary Interface
        Capabilities: [d0] HyperTransport: #1c

00:01.0 ISA bridge: nVidia Corporation MCP78S [GeForce 8200] LPC Bridge (rev 
a2)
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: bus master, 66MHz, fast devsel, latency 0
        I/O ports at 2f00 [size=256]

00:01.1 SMBus: nVidia Corporation MCP78S [GeForce 8200] SMBus (rev a1)
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: 66MHz, fast devsel, IRQ 11
        I/O ports at 2900 [size=64]
        I/O ports at 2d00 [size=64]
        I/O ports at 2e00 [size=64]
        Capabilities: [44] Power Management version 2

00:01.2 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller 
(rev a1)
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: 66MHz, fast devsel

00:01.3 Co-processor: nVidia Corporation MCP78S [GeForce 8200] Co-Processor 
(rev a2)
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 15
        Memory at fcf80000 (32-bit, non-prefetchable) [size=512K]

00:01.4 RAM memory: nVidia Corporation MCP78S [GeForce 8200] Memory Controller 
(rev a1)
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: 66MHz, fast devsel

00:06.0 IDE interface: nVidia Corporation MCP78S [GeForce 8200] IDE (rev a1) 
(prog-if 8a [Master SecP PriP])
        Subsystem: Device f462:7511
        Flags: bus master, 66MHz, fast devsel, latency 0
        [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [disabled] 
[size=8]
        [virtual] Memory at 000003f0 (type 3, non-prefetchable) [disabled] 
[size=1]
        [virtual] Memory at 00000170 (32-bit, non-prefetchable) [disabled] 
[size=8]
        [virtual] Memory at 00000370 (type 3, non-prefetchable) [disabled] 
[size=1]
        I/O ports at ffa0 [size=16]
        Capabilities: [44] Power Management version 2
        Kernel driver in use: pata_amd
        Kernel modules: pata_amd, ide-pci-generic

00:08.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Bridge (rev 
a1) (prog-if 01 [Subtractive decode])
        Flags: bus master, 66MHz, fast devsel, latency 0
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=64
        I/O behind bridge: 0000b000-0000bfff
        Capabilities: [b8] Subsystem: Micro-Star International Co., Ltd. 
Device 7511
        Capabilities: [8c] HyperTransport: MSI Mapping Enable+ Fixed-

00:09.0 SATA controller: nVidia Corporation MCP78S [GeForce 8200] AHCI 
Controller (rev a2) (prog-if 01 [AHCI 1.0])
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 508
        I/O ports at a480 [size=8]
        I/O ports at a400 [size=4]
        I/O ports at a080 [size=8]
        I/O ports at a000 [size=4]
        I/O ports at 9c00 [size=16]
        Memory at fcf7e000 (32-bit, non-prefetchable) [size=8K]
        Capabilities: [44] Power Management version 2
        Capabilities: [8c] SATA HBA <?>
        Capabilities: [b0] Message Signalled Interrupts: Mask- 64bit+ 
Queue=0/3 Enable+
        Capabilities: [ec] HyperTransport: MSI Mapping Enable+ Fixed+
        Kernel driver in use: ahci
        Kernel modules: ahci

00:0a.0 Ethernet controller: nVidia Corporation MCP78S [GeForce 8200] Ethernet 
(rev a2)
        Subsystem: Micro-Star International Co., Ltd. Device 511c
        Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 507
        Memory at fcf7d000 (32-bit, non-prefetchable) [size=4K]
        I/O ports at 9880 [size=8]
        Memory at fcf7cc00 (32-bit, non-prefetchable) [size=256]
        Memory at fcf7c800 (32-bit, non-prefetchable) [size=16]
        Capabilities: [44] Power Management version 2
        Capabilities: [50] Message Signalled Interrupts: Mask+ 64bit+ 
Queue=0/4 Enable+
        Capabilities: [6c] HyperTransport: MSI Mapping Enable+ Fixed+
        Kernel driver in use: forcedeth
        Kernel modules: forcedeth

00:0b.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express 
Bridge (rev a1) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=02, subordinate=02, sec-latency=0
        I/O behind bridge: 0000c000-0000cfff
        Memory behind bridge: fd000000-fe8fffff
        Prefetchable memory behind bridge: 00000000ce000000-00000000dfffffff
        Capabilities: [40] Subsystem: Micro-Star International Co., Ltd. 
Device 7511
        Capabilities: [48] Power Management version 2
        Capabilities: [60] HyperTransport: MSI Mapping Enable+ Fixed-

00:10.0 PCI bridge: nVidia Corporation MCP78S [GeForce 8200] PCI Express 
Bridge (rev a1) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=03, subordinate=04, sec-latency=0
        Memory behind bridge: fe900000-fe9fffff
        Capabilities: [40] Subsystem: Micro-Star International Co., Ltd. 
Device 7511
        Capabilities: [48] Power Management version 3
        Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ 
Queue=0/1 Enable+
        Capabilities: [60] HyperTransport: MSI Mapping Enable+ Fixed-
        Capabilities: [80] Express Root Port (Slot+), MSI 00
        Kernel driver in use: pcieport-driver

00:13.0 PCI bridge: nVidia Corporation Device 077a (rev a1) (prog-if 00 
[Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=05, subordinate=05, sec-latency=0
        I/O behind bridge: 0000d000-0000dfff
        Memory behind bridge: fea00000-feafffff
        Capabilities: [40] Subsystem: Micro-Star International Co., Ltd. 
Device 7511
        Capabilities: [48] Power Management version 3
        Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ 
Queue=0/1 Enable+
        Capabilities: [60] HyperTransport: MSI Mapping Enable+ Fixed-
        Capabilities: [80] Express Root Port (Slot+), MSI 00
        Kernel driver in use: pcieport-driver

00:14.0 PCI bridge: nVidia Corporation Device 077a (rev a1) (prog-if 00 
[Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=06, subordinate=06, sec-latency=0
        I/O behind bridge: 0000e000-0000efff
        Memory behind bridge: feb00000-febfffff
        Capabilities: [40] Subsystem: Micro-Star International Co., Ltd. 
Device 7511
        Capabilities: [48] Power Management version 3
        Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ 
Queue=0/1 Enable+
        Capabilities: [60] HyperTransport: MSI Mapping Enable+ Fixed-
        Capabilities: [80] Express Root Port (Slot+), MSI 00
        Kernel driver in use: pcieport-driver

00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 10h [Opteron, 
Athlon64, Sempron] HyperTransport Configuration
        Flags: fast devsel
        Capabilities: [80] HyperTransport: Host or Secondary Interface

00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 10h [Opteron, 
Athlon64, Sempron] Address Map
        Flags: fast devsel

00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 10h [Opteron, 
Athlon64, Sempron] DRAM Controller
        Flags: fast devsel

00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 10h [Opteron, 
Athlon64, Sempron] Miscellaneous Control
        Flags: fast devsel
        Capabilities: [f0] Secure device <?>

00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h [Opteron, 
Athlon64, Sempron] Link Control
        Flags: fast devsel

01:05.0 Serial controller: Lava Computer mfg Inc Quattro-PCI A (rev 03) 
(prog-if 02 [16550])
        Subsystem: Lava Computer mfg Inc Quattro-PCI A
        Flags: medium devsel, IRQ 17
        I/O ports at bc00 [size=8]
        I/O ports at b880 [size=8]
        Kernel driver in use: serial
        Kernel modules: 8250_pci

01:05.1 Serial controller: Lava Computer mfg Inc Quattro-PCI B (rev 03) 
(prog-if 02 [16550])
        Subsystem: Lava Computer mfg Inc Quattro-PCI B
        Flags: medium devsel, IRQ 17
        I/O ports at b800 [size=8]
        I/O ports at b480 [size=8]
        Kernel driver in use: serial
        Kernel modules: 8250_pci

01:06.0 Parallel controller: Lava Computer mfg Inc Lava Dual Parallel port A 
(rev 03) (prog-if 01 [BiDir])
        Subsystem: Lava Computer mfg Inc Lava Dual Parallel port A
        Flags: medium devsel, IRQ 16
        I/O ports at b400 [size=8]
        Kernel modules: parport_pc

01:06.1 Parallel controller: Lava Computer mfg Inc Lava Dual Parallel port B 
(rev 03) (prog-if 01 [BiDir])
        Subsystem: Lava Computer mfg Inc Lava Dual Parallel port B
        Flags: medium devsel, IRQ 16
        I/O ports at b080 [size=8]
        Kernel modules: parport_pc

01:07.0 DPIO module: Quicklogic Corporation PC Watchdog (rev 01)
        Subsystem: Device 161c:046a
        Flags: medium devsel
        I/O ports at b000 [size=8]
        Kernel driver in use: pcwd_pci
        Kernel modules: pcwd_pci

02:00.0 VGA compatible controller: nVidia Corporation GeForce 8200 (rev a2) 
(prog-if 00 [VGA controller])
        Subsystem: Micro-Star International Co., Ltd. Device 7511
        Flags: bus master, fast devsel, latency 0, IRQ 10
        Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
        Memory at d0000000 (64-bit, prefetchable) [size=256M]
        Memory at ce000000 (64-bit, prefetchable) [size=32M]
        I/O ports at cc00 [size=128]
        Expansion ROM at fe8e0000 [disabled] [size=128K]
        Capabilities: [60] Power Management version 2
        Capabilities: [68] Message Signalled Interrupts: Mask- 64bit+ 
Queue=0/0 Enable-
        Kernel modules: nvidiafb, nvidia

03:00.0 PCI bridge: Texas Instruments XIO2000(A)/XIO2200(A) PCI Express-to-PCI 
Bridge (rev 03) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=03, secondary=04, subordinate=04, sec-latency=64
        Memory behind bridge: fe900000-fe9fffff
        Capabilities: [50] Power Management version 2
        Capabilities: [60] Message Signalled Interrupts: Mask- 64bit+ 
Queue=0/4 Enable-
        Capabilities: [80] Subsystem: Gammagraphx, Inc. Device 0000
        Capabilities: [90] Express PCI/PCI-X Bridge, MSI 00

04:01.0 USB Controller: NEC Corporation USB (rev 43) (prog-if 10 [OHCI])
        Subsystem: NEC Corporation Hama USB 2.0 CardBus
        Flags: bus master, medium devsel, latency 64, IRQ 16
        Memory at fe9ff000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] Power Management version 2
        Kernel driver in use: ohci_hcd
        Kernel modules: ohci-hcd

04:01.1 USB Controller: NEC Corporation USB (rev 43) (prog-if 10 [OHCI])
        Subsystem: NEC Corporation Hama USB 2.0 CardBus
        Flags: bus master, medium devsel, latency 64, IRQ 19
        Memory at fe9fe000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] Power Management version 2
        Kernel driver in use: ohci_hcd
        Kernel modules: ohci-hcd

04:01.2 USB Controller: NEC Corporation USB 2.0 (rev 04) (prog-if 20 [EHCI])
        Subsystem: Device 1838:1074
        Flags: bus master, medium devsel, latency 64, IRQ 18
        Memory at fe9fdc00 (32-bit, non-prefetchable) [size=256]
        Capabilities: [40] Power Management version 2
        Kernel driver in use: ehci_hcd
        Kernel modules: ehci-hcd

05:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 
Gigabit Ethernet Adapter (rev 81)
        Subsystem: VIA Technologies, Inc. Device 0110
        Flags: fast devsel, IRQ 18
        I/O ports at d800 [size=256]
        Memory at feaffc00 (64-bit, non-prefetchable) [size=256]
        Capabilities: [50] Power Management version 3
        Capabilities: [90] Express Endpoint, MSI 00
        Capabilities: [c0] Message Signalled Interrupts: Mask+ 64bit+ 
Queue=0/0 Enable-
        Kernel driver in use: via-velocity
        Kernel modules: via-velocity

06:00.0 Ethernet controller: VIA Technologies, Inc. VT6120/VT6121/VT6122 
Gigabit Ethernet Adapter (rev 82)
        Subsystem: VIA Technologies, Inc. Device 0110
        Flags: fast devsel, IRQ 17
        I/O ports at e800 [size=256]
        Memory at febffc00 (64-bit, non-prefetchable) [size=256]
        Capabilities: [50] Power Management version 3
        Capabilities: [90] Express Endpoint, MSI 00
        Capabilities: [c0] Message Signalled Interrupts: Mask+ 64bit+ 
Queue=0/0 Enable-
        Kernel driver in use: via-velocity
        Kernel modules: via-velocity

=========

When the conflicting USB card is removed, Lava card  works with IRQ if proper 
IO and IRQ are specified:

modprobe parport_pc io=0xcc00,0xc880 irq=none,16
===
parport0: PC-style at 0xcc00 [PCSPP,TRISTATE,EPP]
parport1: PC-style at 0xc880, irq 16 [PCSPP,TRISTATE,EPP]



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-03-20  7:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090318143921.22B5B13A4B0@koiott.tartu-labor>
2009-03-19 13:04 ` Lava dual parallel PCI card IRQ problem Meelis Roos
2009-03-19 13:10   ` Alan Cox
2009-03-19 13:33     ` Meelis Roos
2009-03-19 13:49       ` Meelis Roos
2009-03-20  7:36         ` Meelis Roos
2009-03-13  4:51 Gabor Kovacs
2009-03-16 10:57 ` Alan Cox
2009-03-17 22:52   ` Gabor Kovacs
2009-03-18 11:35     ` Alan Cox
2009-03-19 20:41       ` Gabor Kovacs

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

all inboxes | Powered by JetHome®