aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macsonic.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2007-05-01 22:55:56 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 20:59:08 -0400
commitf4d86754f956ab5ea73aa91759a0d89a2f0e3f2a (patch)
tree6afaeefe24fa98385a5f3de6557a31689456071a /drivers/net/macsonic.c
parentd74472f0b2553e59eafb7feee0ff9558136a17e0 (diff)
SONIC interrupt handling
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. Versions 2 and 3 needed some cleanups, as Raylynn Knight and Christoph Hellwig pointed out (thanks). Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net/macsonic.c')
-rw-r--r--drivers/net/macsonic.c46
1 files changed, 42 insertions, 4 deletions
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index c78a7e2e8ba8..e9ecdbf352ae 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -130,6 +130,46 @@ static inline void bit_reverse_addr(unsigned char addr[6])
130 addr[i] = bitrev8(addr[i]); 130 addr[i] = bitrev8(addr[i]);
131} 131}
132 132
133static irqreturn_t macsonic_interrupt(int irq, void *dev_id)
134{
135 irqreturn_t result;
136 unsigned long flags;
137
138 local_irq_save(flags);
139 result = sonic_interrupt(irq, dev_id);
140 local_irq_restore(flags);
141 return result;
142}
143
144static int macsonic_open(struct net_device* dev)
145{
146 if (request_irq(dev->irq, &sonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) {
147 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);
148 return -EAGAIN;
149 }
150 /* Under the A/UX interrupt scheme, the onboard SONIC interrupt comes
151 * in at priority level 3. However, we sometimes get the level 2 inter-
152 * rupt as well, which must prevent re-entrance of the sonic handler.
153 */
154 if (dev->irq == IRQ_AUTO_3)
155 if (request_irq(IRQ_NUBUS_9, &macsonic_interrupt, IRQ_FLG_FAST, "sonic", dev)) {
156 printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, IRQ_NUBUS_9);
157 free_irq(dev->irq, dev);
158 return -EAGAIN;
159 }
160 return sonic_open(dev);
161}
162
163static int macsonic_close(struct net_device* dev)
164{
165 int err;
166 err = sonic_close(dev);
167 free_irq(dev->irq, dev);
168 if (dev->irq == IRQ_AUTO_3)
169 free_irq(IRQ_NUBUS_9, dev);
170 return err;
171}
172
133int __init macsonic_init(struct net_device* dev) 173int __init macsonic_init(struct net_device* dev)
134{ 174{
135 struct sonic_local* lp = netdev_priv(dev); 175 struct sonic_local* lp = netdev_priv(dev);
@@ -160,8 +200,8 @@ int __init macsonic_init(struct net_device* dev)
160 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS 200 lp->rra_laddr = lp->rda_laddr + (SIZEOF_SONIC_RD * SONIC_NUM_RDS
161 * SONIC_BUS_SCALE(lp->dma_bitmode)); 201 * SONIC_BUS_SCALE(lp->dma_bitmode));
162 202
163 dev->open = sonic_open; 203 dev->open = macsonic_open;
164 dev->stop = sonic_close; 204 dev->stop = macsonic_close;
165 dev->hard_start_xmit = sonic_send_packet; 205 dev->hard_start_xmit = sonic_send_packet;
166 dev->get_stats = sonic_get_stats; 206 dev->get_stats = sonic_get_stats;
167 dev->set_multicast_list = &sonic_multicast_list; 207 dev->set_multicast_list = &sonic_multicast_list;
@@ -572,8 +612,6 @@ MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
572module_param(sonic_debug, int, 0); 612module_param(sonic_debug, int, 0);
573MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); 613MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
574 614
575#define SONIC_IRQ_FLAG IRQ_FLG_FAST
576
577#include "sonic.c" 615#include "sonic.c"
578 616
579static int __devexit mac_sonic_device_remove (struct platform_device *pdev) 617static int __devexit mac_sonic_device_remove (struct platform_device *pdev)