patch-2.4.0-test6 linux/arch/sh/kernel/setup_hd64461.c

Next file: linux/arch/sh/kernel/setup_se.c
Previous file: linux/arch/sh/kernel/setup_cqreek.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/arch/sh/kernel/setup_hd64461.c linux/arch/sh/kernel/setup_hd64461.c
@@ -92,6 +92,20 @@
 	       inw(HD64461_NIRR), inw(HD64461_NIMR));
 }
 
+int hd64461_irq_demux(int irq)
+{
+	if (irq == CONFIG_HD64461_IRQ) {
+		unsigned short bit;
+		unsigned short nirr = inw(HD64461_NIRR);
+		unsigned short nimr = inw(HD64461_NIMR);
+		nirr &= ~nimr;
+		for (bit = 1, irq = 0; irq < 16; bit <<= 1, irq++)
+			if (nirr & bit) break;
+		if (irq == 16) irq = CONFIG_HD64461_IRQ;
+		else irq += HD64461_IRQBASE;
+	}
+	return irq;
+}
 
 static struct irqaction irq0  = { hd64461_interrupt, SA_INTERRUPT, 0, "HD64461", NULL, NULL};
 
@@ -100,10 +114,13 @@
 {
 	int i;
 
+	if (!MACH_HD64461)
+		return 0;
+
 	printk(KERN_INFO "HD64461 configured at 0x%x on irq %d(mapped into %d to %d)\n",
 	       CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ,
 	       HD64461_IRQBASE, HD64461_IRQBASE+15);
-#if 1
+#ifdef CONFIG_CPU_SUBTYPE_SH7709
 	/* IRQ line for HD64461 should be set level trigger mode("10"). */
 	/* And this should be done earlier than the kernel starts. */
 	ctrl_outw(0x0200, INTC_ICR1); /* when connected to IRQ4. */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)