linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Finn Thain <fthain@telegraphics.com.au>
Subject: [patch 29/33] SONIC interrupt handling
Date: Tue, 01 May 2007 22:33:03 +0200	[thread overview]
Message-ID: <20070501203337.746958387@mail.of.borg> (raw)
In-Reply-To: 20070501203234.252205858@mail.of.borg

[-- Attachment #1: mac68k-macsonic-via-alt-mapping.diff --]
[-- Type: text/plain, Size: 6576 bytes --]

From: Finn Thain <fthain@telegraphics.com.au>

Install the built-in macsonic interrupt handler on both IRQs when using
via_alt_mapping. Otherwise the rare interrupt that still comes from the nubus
slot will wedge the nubus.

$ cat /proc/interrupts
auto       2:      89176 via2
auto       3:     744367 sonic
auto       4:          0 scc
auto       6:     318363 via1
auto       7:          0 NMI
mac        9:     119413 framebuffer vbl
mac       10:       1971 ADB
mac       14:     198517 timer
mac       17:      89104 nubus
mac       19:         72 Mac ESP SCSI
mac       56:        629 sonic
mac       62:    1142593 ide0

Version 1 of this patch had a bug where a nubus sonic card would register two
interrupt handlers. Only a built-in sonic needs both.
  
Version 2 needed some cleanups, as Raylynn Knight pointed out (thanks).

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/net/jazzsonic.c |   21 +++++++++++++++++----
 drivers/net/macsonic.c  |   43 +++++++++++++++++++++++++++++++++++++++----
 drivers/net/sonic.c     |   25 -------------------------
 3 files changed, 56 insertions(+), 33 deletions(-)

--- linux-m68k-2.6.21.orig/drivers/net/jazzsonic.c
+++ linux-m68k-2.6.21/drivers/net/jazzsonic.c
@@ -88,6 +88,21 @@ static unsigned short known_revisions[] 
 	0xffff			/* end of list */
 };
 
+static int jazzsonic_open(struct net_device* dev) {
+	if (request_irq(dev->irq, &sonic_interrupt, IRQF_DISABLED, "sonic", dev)) {
+		printk(KERN_ERR "\n%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+		return -EAGAIN;
+	}
+	return sonic_open(dev);
+}
+
+static int jazzsonic_close(struct net_device* dev) {
+	int err;
+	err = sonic_close(dev);
+	free_irq(dev->irq, dev);
+	return err;
+}
+
 static int __init sonic_probe1(struct net_device *dev)
 {
 	static unsigned version_printed;
@@ -169,8 +184,8 @@ static int __init sonic_probe1(struct ne
 	lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
 	                     * SONIC_BUS_SCALE(lp->dma_bitmode));
 
-	dev->open = sonic_open;
-	dev->stop = sonic_close;
+	dev->open = jazzsonic_open;
+	dev->stop = jazzsonic_close;
 	dev->hard_start_xmit = sonic_send_packet;
 	dev->get_stats = sonic_get_stats;
 	dev->set_multicast_list = &sonic_multicast_list;
@@ -260,8 +275,6 @@ MODULE_DESCRIPTION("Jazz SONIC ethernet 
 module_param(sonic_debug, int, 0);
 MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
 
-#define SONIC_IRQ_FLAG IRQF_DISABLED
-
 #include "sonic.c"
 
 static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
--- linux-m68k-2.6.21.orig/drivers/net/macsonic.c
+++ linux-m68k-2.6.21/drivers/net/macsonic.c
@@ -130,6 +130,43 @@ static inline void bit_reverse_addr(unsi
 		addr[i] = bitrev8(addr[i]);
 }
 
+static irqreturn_t macsonic_interrupt(int irq, void *dev_id) {
+	irqreturn_t result;
+	unsigned long flags;
+
+	local_irq_save(flags);
+	result = sonic_interrupt(irq, dev_id);
+	local_irq_restore(flags);
+	return result;
+}
+
+static int macsonic_open(struct net_device* dev) {
+	if (request_irq(dev->irq, &sonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) {
+		printk(KERN_ERR "\n%s: unable to get IRQ %d.\n", dev->name, dev->irq);
+		return -EAGAIN;
+	}
+	/* Under the A/UX interrupt scheme, the onboard SONIC interrupt comes
+	 * in at priority level 3. However, we sometimes get the level 2 inter-
+	 * rupt as well, which must prevent re-entrance of the sonic handler.
+	 */
+	if (dev->irq == IRQ_AUTO_3)
+		if (request_irq(IRQ_NUBUS_9, &macsonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) {
+			printk(KERN_ERR "\n%s: unable to get IRQ %d.\n", dev->name, IRQ_NUBUS_9);
+			free_irq(dev->irq, dev);
+			return -EAGAIN;
+		}
+	return sonic_open(dev);
+}
+
+static int macsonic_close(struct net_device* dev) {
+	int err;
+	err = sonic_close(dev);
+	free_irq(dev->irq, dev);
+	if (dev->irq == IRQ_AUTO_3)
+		free_irq(IRQ_NUBUS_9, dev);
+	return err;
+}
+
 int __init macsonic_init(struct net_device* dev)
 {
 	struct sonic_local* lp = netdev_priv(dev);
@@ -160,8 +197,8 @@ int __init macsonic_init(struct net_devi
 	lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
 	                     * SONIC_BUS_SCALE(lp->dma_bitmode));
 
-	dev->open = sonic_open;
-	dev->stop = sonic_close;
+	dev->open = macsonic_open;
+	dev->stop = macsonic_close;
 	dev->hard_start_xmit = sonic_send_packet;
 	dev->get_stats = sonic_get_stats;
 	dev->set_multicast_list = &sonic_multicast_list;
@@ -572,8 +609,6 @@ MODULE_DESCRIPTION("Macintosh SONIC ethe
 module_param(sonic_debug, int, 0);
 MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
 
-#define SONIC_IRQ_FLAG IRQ_FLG_FAST
-
 #include "sonic.c"
 
 static int __devexit mac_sonic_device_remove (struct platform_device *pdev)
--- linux-m68k-2.6.21.orig/drivers/net/sonic.c
+++ linux-m68k-2.6.21/drivers/net/sonic.c
@@ -50,29 +50,6 @@ static int sonic_open(struct net_device 
 	if (sonic_debug > 2)
 		printk("sonic_open: initializing sonic driver.\n");
 
-	/*
-	 * We don't need to deal with auto-irq stuff since we
-	 * hardwire the sonic interrupt.
-	 */
-/*
- * XXX Horrible work around:  We install sonic_interrupt as fast interrupt.
- * This means that during execution of the handler interrupt are disabled
- * covering another bug otherwise corrupting data.  This doesn't mean
- * this glue works ok under all situations.
- *
- * Note (dhd): this also appears to prevent lockups on the Macintrash
- * when more than one Ethernet card is installed (knock on wood)
- *
- * Note (fthain): whether the above is still true is anyones guess. Certainly
- * the buffer handling algorithms will not tolerate re-entrance without some
- * mutual exclusion added. Anyway, the memcpy has now been eliminated from the
- * rx code to make this a faster "fast interrupt".
- */
-	if (request_irq(dev->irq, &sonic_interrupt, SONIC_IRQ_FLAG, "sonic", dev)) {
-		printk(KERN_ERR "\n%s: unable to get IRQ %d .\n", dev->name, dev->irq);
-		return -EAGAIN;
-	}
-
 	for (i = 0; i < SONIC_NUM_RRS; i++) {
 		struct sk_buff *skb = dev_alloc_skb(SONIC_RBSIZE + 2);
 		if (skb == NULL) {
@@ -169,8 +146,6 @@ static int sonic_close(struct net_device
 		}
 	}
 
-	free_irq(dev->irq, dev);	/* release the IRQ */
-
 	return 0;
 }
 

--
Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds


  parent reply	other threads:[~2007-05-01 20:35 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-01 20:32 [patch 00/33] m68k patches for 2.6.22 Geert Uytterhoeven
2007-05-01 20:32 ` [patch 01/33] m68k: Atari SCSI revival Geert Uytterhoeven
2007-05-01 20:46   ` Christoph Hellwig
2007-05-01 20:32 ` [patch 02/33] m68k: Reformat the Atari SCSI driver Geert Uytterhoeven
2007-05-01 20:32 ` [patch 03/33] m68k: Atari SCSI driver compile fixes Geert Uytterhoeven
2007-05-01 20:32 ` [patch 04/33] m68k: Atari keyboard and mouse support Geert Uytterhoeven
2007-05-01 20:57   ` Christoph Hellwig
2007-05-01 21:09     ` Dmitry Torokhov
2007-05-03 10:34       ` Michael Schmitz
2007-05-03 10:47     ` Michael Schmitz
2007-05-03 10:50       ` Christoph Hellwig
2007-05-03 10:54         ` Michael Schmitz
2007-05-01 20:32 ` [patch 05/33] m68k: Atari fb revival Geert Uytterhoeven
2007-05-01 21:50   ` Antonino A. Daplas
2007-05-02 20:01     ` James Simmons
2007-05-03 10:33       ` Michael Schmitz
2007-05-01 20:32 ` [patch 06/33] m68k: CROSS_COMPILE = m68k-linux-gnu- Geert Uytterhoeven
2007-05-01 22:56   ` Ville Syrjälä
2007-05-06 11:26     ` Geert Uytterhoeven
2007-05-06 12:55       ` Ville Syrjälä
2007-05-01 20:32 ` [patch 07/33] m68k: Mac89x0 Ethernet netif updates Geert Uytterhoeven
2007-05-01 20:57   ` Jeff Garzik
2007-05-01 20:32 ` [patch 08/33] lockdep: Add missing disable/enable irq variant Geert Uytterhoeven
2007-05-01 20:32 ` [patch 09/33] m68k: reformat various m68k files Geert Uytterhoeven
2007-05-01 20:32 ` [patch 10/33] hilkbd: Kill compiler warning and fix comment dyslexia Geert Uytterhoeven
2007-05-01 20:32 ` [patch 11/33] m68k: early parameter support Geert Uytterhoeven
2007-05-01 20:32 ` [patch 12/33] m68k: make Atari IDE lock reentrant Geert Uytterhoeven
2007-05-01 20:32 ` [patch 13/33] m68k: Correct number of interrupts for Sun3 Geert Uytterhoeven
2007-05-01 20:32 ` [patch 14/33] m68k: Atari SCSI workqueue updates Geert Uytterhoeven
2007-05-01 20:32 ` [patch 15/33] m68k: pmu_queue_request() declaration conflict Geert Uytterhoeven
2007-05-01 20:32 ` [patch 16/33] m68k: Amiga A2065 and Ariadne TX statistics Geert Uytterhoeven
2007-05-01 20:32 ` [patch 17/33] m68k: remove unused adb.h Geert Uytterhoeven
2007-05-01 20:32 ` [patch 18/33] m68k: Mac interrupt priorities Geert Uytterhoeven
2007-05-01 20:32 ` [patch 19/33] NuBus header update Geert Uytterhoeven
2007-05-02 19:47   ` James Simmons
2007-05-03  2:14     ` Brad Boyer
2007-05-01 20:32 ` [patch 20/33] m68k: Mac DP8390 update Geert Uytterhoeven
2007-05-01 20:32 ` [patch 21/33] m68k: reverse Mac IRQ damage Geert Uytterhoeven
2007-05-01 20:32 ` [patch 22/33] m68k: Mac IRQ prep Geert Uytterhoeven
2007-05-01 20:32 ` [patch 23/33] m68k: Mac nubus IRQ fixes (plan E) Geert Uytterhoeven
2007-05-01 20:32 ` [patch 24/33] m68k: Mac IRQ cleanup Geert Uytterhoeven
2007-05-01 20:32 ` [patch 25/33] m68k: Mac II ADB fixes Geert Uytterhoeven
2007-05-01 20:33 ` [patch 26/33] CUDA " Geert Uytterhoeven
2007-05-01 20:33 ` [patch 27/33] m68k: macmace fixes Geert Uytterhoeven
2007-05-01 20:33 ` [patch 28/33] SONIC: small fix and cleanup Geert Uytterhoeven
2007-05-01 20:33 ` Geert Uytterhoeven [this message]
2007-05-01 21:12   ` [patch 29/33] SONIC interrupt handling Christoph Hellwig
2007-05-02  2:55     ` [patch 29/33] SONIC interrupt handling, v4 Finn Thain
2007-05-01 20:33 ` [patch 30/33] Amiga Zorro bus: kill resource_size_t warnings Geert Uytterhoeven
2007-05-01 20:33 ` [patch 31/33] m68k: kill skb_copy_from_linear_data compiler warnings Geert Uytterhoeven
2007-05-01 20:33 ` [patch 32/33] m68k: export csum_partial_copy_from_user Geert Uytterhoeven
2007-05-01 20:33 ` [patch 33/33] Convert non-highmem kmap_atomic() to static inline function Geert Uytterhoeven
2007-05-01 20:49 ` [patch 00/33] m68k patches for 2.6.22 Christoph Hellwig
2007-05-03  1:27   ` Roman Zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070501203337.746958387@mail.of.borg \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=fthain@telegraphics.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).