Resent-Date: Tue, 15 Sep 1998 20:13:25 +0200 (MET DST)
Date: Tue, 15 Sep 1998 20:14:58 +0200
From: Juergen Orschiedt <orschied@rumms.uni-mannheim.de>
To: linux-m68k@phil.uni-sb.de
Subject: patch: atari_request_irq
Mail-Followup-To: linux-m68k@phil.uni-sb.de
Resent-From: linux-m68k@phil.uni-sb.de

Hi,

While working with the Panther/2 and NE2000, I found a little problem in request_irq.
The (usually) unused IRQ_MFP_GPU and IRQ_MFP_MMD triggers on H->L transition.
If you connect an ISA-IRQ to this pin, it isn't detected (L->H). This little patch
takes the state during request_irq and sets the transition-sensitivity as required,
assuming that the calling driver did already reset the hardware.

Other problem is with drivers like aha152x - they do a request_irq(..., SA_INTERRUPT, ..).
For the moment, I translate these into an "IRQ_TYPE_SLOW" to have at least a minimum chance.

So the NE2000 works well (only one little bytesex-patch necessary).
I got a peak ftp throughput of 735kB/s against an iNtel linux host...


--- jes-2.1.120/arch/m68k/atari/ataints.c	Fri May  1 19:05:53 1998
+++ linux/arch/m68k/atari/ataints.c	Mon Sep 14 00:36:02 1998
@@ -419,6 +419,7 @@
                       unsigned long flags, const char *devname, void *dev_id)
 {
 	int vector;
+	unsigned long oflags = flags;
 
 	/*
 	 * The following is a hack to make some PCI card drivers work,
@@ -427,9 +428,14 @@
 
 	flags &= ~SA_SHIRQ;
 
+	if (flags == SA_INTERRUPT) {
+		printk ("%s: SA_INTERRUPT changed to IRQ_TYPE_SLOW for %s\n",
+			__FUNCTION__, devname);
+		flags = IRQ_TYPE_SLOW;
+	}
 	if (flags < IRQ_TYPE_SLOW || flags > IRQ_TYPE_PRIO) {
-		printk ("%s: Bad irq type %ld requested from %s\n",
-		        __FUNCTION__, flags, devname);
+		printk ("%s: Bad irq type 0x%lx <0x%lx> requested from %s\n",
+		        __FUNCTION__, flags, oflags, devname);
 		return -EINVAL;
 	}
 	if (!IS_VALID_INTNO(irq)) {
@@ -460,6 +466,18 @@
 			(flags == IRQ_TYPE_SLOW) ? slow_handlers[irq-STMFP_SOURCE_BASE] :
 			(flags == IRQ_TYPE_FAST) ? atari_fast_irq_handler :
 			                          atari_prio_irq_handler;
+		/* if IRQ_MFP_GPU or IRQ_MFP_MMD (special purpose), we set the active edge
+		 * to the transition to the complement of current value
+		 */
+		if ((irq == IRQ_MFP_GPU) || irq == IRQ_MFP_MMD) {
+		    unsigned char  mask = (irq == IRQ_MFP_GPU) ? (1 << 3) : (1 << 7);
+		    if (mfp.par_dt_reg & mask)
+			mfp.active_edge &= ~mask;
+		    else
+			mfp.active_edge |= mask;
+		    printk("%s: irq %d: active_edge for %s set to 0x%02x\n", __FUNCTION__, irq, devname, mfp.active_edge);
+		}
+
 		/* If MFP int, also enable and umask it */
 		atari_turnon_irq(irq);
 		atari_enable_irq(irq);

