[PATCH] TI IRQ routing - one more time

Pavel Roskin proski at gnu.org
Fri Sep 12 17:19:25 BST 2003


Hello!

The attached patch has been tested with Linux 2.6.0-test5-bk3.  The
difference from the previous patch is that I removed some checks after
reading the documentation for older chips.  This should make this patch
applicable to more cards without taking extra risk of breaking laptops.
Also, the code is slightly more readable now.

Commented out code in ti_override() and ti1250_override() has been
removed.  The new code uses multifunction routing register (irqmux)
existing in ti12xx and above.  If a workaround for older chips is needed,
it will be implemented differently.

I checked the documentation for ti12xx chips older than ti1250.  They also
have irqmux, and what's most important, for all chips I checked, irqmux
being 0 means that no interrupts whatsoever will be delivered to any
multifunction terminals (MFUNC0-6).  And that's the only way ISA
interrupts can be delivered to the host.

This means that irqmux being 0 means that we must set it up or no
interrupts will work at all.  So, if no ISA interrupts are detected and
irqmux is 0, the card is reprogrammed to route INTA to MFUNC0.  Also, the
device control register is programmed to allow PCI interrupts only.

The patch is necessary to support ti1410 cards.  If there are any problems
with my patch, please let me know.

-- 
Regards,
Pavel Roskin-------------- next part --------------
--- linux.orig/drivers/pcmcia/ti113x.h
+++ linux/drivers/pcmcia/ti113x.h
@@ -281,33 +281,6 @@
 
 	ti_set_zv(socket);
 
-#if 0
-	/*
-	 * If ISA interrupts don't work, then fall back to routing card
-	 * interrupts to the PCI interrupt of the socket.
-	 *
-	 * Tweaking this when we are using serial PCI IRQs causes hangs
-	 *   --rmk
-	 */
-	if (!socket->socket.irq_mask) {
-		u8 irqmux, devctl;
-
-		devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
-		if ((devctl & TI113X_DCR_IMODE_MASK) != TI12XX_DCR_IMODE_ALL_SERIAL) {
-			printk (KERN_INFO "ti113x: Routing card interrupts to PCI\n");
-
-			devctl &= ~TI113X_DCR_IMODE_MASK;
-
-			irqmux = config_readl(socket, TI122X_IRQMUX);
-			irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
-			irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
-
-			config_writel(socket, TI122X_IRQMUX, irqmux);
-			config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
-		}
-	}
-#endif
-
 	return 0;
 }
 
@@ -347,6 +320,33 @@
 	printk(KERN_INFO "Yenta: Routing CardBus interrupts to %s\n",
 		(val & TI1250_DIAG_PCI_IREQ) ? "PCI" : "ISA");
 
+	/*
+	 * If ISA interrupts don't work, fall back to routing card
+	 * interrupts to the PCI bus.  Only do it if multifunction
+	 * routing register (irqmux) is in the default state, i.e.
+	 * the card wasn't initialized.
+	 */
+	if (!socket->socket.irq_mask) {
+		u32 irqmux;
+
+		irqmux = config_readl(socket, TI122X_IRQMUX);
+
+		if (irqmux == 0) {
+			u8 devctl;
+
+			printk (KERN_INFO "ti113x: Uninitialized IRQ routing "
+				"detected, enabling PCI interrupts\n");
+
+			/* Route INTA to MFUNC0 */
+			config_writel(socket, TI122X_IRQMUX, 0x02);
+
+			/* Enable parallel PCI interrupts */
+			devctl = config_readb(socket, TI113X_DEVICE_CONTROL);
+			devctl &= ~TI113X_DCR_IMODE_MASK;
+			config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
+		}
+	}
+
 	return ti_override(socket);
 }
 
@@ -366,26 +366,6 @@
 		config_writeb(socket, TI1250_DIAGNOSTIC, diag);
 	}
 
-#if 0
-	/*
-	 * This is highly machine specific, and we should NOT touch
-	 * this register - we have no knowledge how the hardware
-	 * is actually wired.
-	 *
-	 * If we're going to do this, we should probably look into
-	 * using the subsystem IDs.
-	 *
-	 * On ThinkPad 380XD, this changes MFUNC0 from the ISA IRQ3
-	 * output (which it is) to IRQ2.  We also change MFUNC1
-	 * from ISA IRQ4 to IRQ6.
-	 */
-	irqmux = config_readl(socket, TI122X_IRQMUX);
-	irqmux = (irqmux & ~0x0f) | 0x02; /* route INTA */
-	if (!(ti_sysctl(socket) & TI122X_SCR_INTRTIE))
-		irqmux = (irqmux & ~0xf0) | 0x20; /* route INTB */
-	config_writel(socket, TI122X_IRQMUX, irqmux);
-#endif
-
 	return ti12xx_override(socket);
 }
 


More information about the linux-pcmcia mailing list