aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macsonic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/macsonic.c')
-rw-r--r--drivers/net/macsonic.c65
1 files changed, 51 insertions, 14 deletions
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 8ca57a0a4c11..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;
@@ -402,7 +442,7 @@ int __init macsonic_ident(struct nubus_dev* ndev)
402 ndev->dr_sw == NUBUS_DRSW_DAYNA) 442 ndev->dr_sw == NUBUS_DRSW_DAYNA)
403 return MACSONIC_DAYNA; 443 return MACSONIC_DAYNA;
404 444
405 if (ndev->dr_hw == NUBUS_DRHW_SONIC_LC && 445 if (ndev->dr_hw == NUBUS_DRHW_APPLE_SONIC_LC &&
406 ndev->dr_sw == 0) { /* huh? */ 446 ndev->dr_sw == 0) { /* huh? */
407 return MACSONIC_APPLE16; 447 return MACSONIC_APPLE16;
408 } 448 }
@@ -522,7 +562,7 @@ int __init mac_nubus_sonic_probe(struct net_device* dev)
522 return macsonic_init(dev); 562 return macsonic_init(dev);
523} 563}
524 564
525static int __init mac_sonic_probe(struct platform_device *device) 565static int __init mac_sonic_probe(struct platform_device *pdev)
526{ 566{
527 struct net_device *dev; 567 struct net_device *dev;
528 struct sonic_local *lp; 568 struct sonic_local *lp;
@@ -534,8 +574,8 @@ static int __init mac_sonic_probe(struct platform_device *device)
534 return -ENOMEM; 574 return -ENOMEM;
535 575
536 lp = netdev_priv(dev); 576 lp = netdev_priv(dev);
537 lp->device = &device->dev; 577 lp->device = &pdev->dev;
538 SET_NETDEV_DEV(dev, &device->dev); 578 SET_NETDEV_DEV(dev, &pdev->dev);
539 SET_MODULE_OWNER(dev); 579 SET_MODULE_OWNER(dev);
540 580
541 /* This will catch fatal stuff like -ENOMEM as well as success */ 581 /* This will catch fatal stuff like -ENOMEM as well as success */
@@ -572,19 +612,17 @@ 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 *device) 617static int __devexit mac_sonic_device_remove (struct platform_device *pdev)
580{ 618{
581 struct net_device *dev = platform_get_drvdata(device); 619 struct net_device *dev = platform_get_drvdata(pdev);
582 struct sonic_local* lp = netdev_priv(dev); 620 struct sonic_local* lp = netdev_priv(dev);
583 621
584 unregister_netdev (dev); 622 unregister_netdev(dev);
585 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode), 623 dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
586 lp->descriptors, lp->descriptors_laddr); 624 lp->descriptors, lp->descriptors_laddr);
587 free_netdev (dev); 625 free_netdev(dev);
588 626
589 return 0; 627 return 0;
590} 628}
@@ -607,9 +645,8 @@ static int __init mac_sonic_init_module(void)
607 } 645 }
608 646
609 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0); 647 mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
610 if (!mac_sonic_device) { 648 if (!mac_sonic_device)
611 goto out_unregister; 649 goto out_unregister;
612 }
613 650
614 if (platform_device_add(mac_sonic_device)) { 651 if (platform_device_add(mac_sonic_device)) {
615 platform_device_put(mac_sonic_device); 652 platform_device_put(mac_sonic_device);