aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sunhme.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sunhme.c')
-rw-r--r--drivers/net/sunhme.c46
1 files changed, 36 insertions, 10 deletions
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 7a72a3112f0a..d4fb4acdbebd 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2543,25 +2543,36 @@ static struct quattro * __devinit quattro_sbus_find(struct of_device *child)
2543} 2543}
2544 2544
2545/* After all quattro cards have been probed, we call these functions 2545/* After all quattro cards have been probed, we call these functions
2546 * to register the IRQ handlers. 2546 * to register the IRQ handlers for the cards that have been
2547 * successfully probed and skip the cards that failed to initialize
2547 */ 2548 */
2548static void __init quattro_sbus_register_irqs(void) 2549static int __init quattro_sbus_register_irqs(void)
2549{ 2550{
2550 struct quattro *qp; 2551 struct quattro *qp;
2551 2552
2552 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { 2553 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) {
2553 struct of_device *op = qp->quattro_dev; 2554 struct of_device *op = qp->quattro_dev;
2554 int err; 2555 int err, qfe_slot, skip = 0;
2556
2557 for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) {
2558 if (!qp->happy_meals[qfe_slot])
2559 skip = 1;
2560 }
2561 if (skip)
2562 continue;
2555 2563
2556 err = request_irq(op->irqs[0], 2564 err = request_irq(op->irqs[0],
2557 quattro_sbus_interrupt, 2565 quattro_sbus_interrupt,
2558 IRQF_SHARED, "Quattro", 2566 IRQF_SHARED, "Quattro",
2559 qp); 2567 qp);
2560 if (err != 0) { 2568 if (err != 0) {
2561 printk(KERN_ERR "Quattro: Fatal IRQ registery error %d.\n", err); 2569 printk(KERN_ERR "Quattro HME: IRQ registration "
2562 panic("QFE request irq"); 2570 "error %d.\n", err);
2571 return err;
2563 } 2572 }
2564 } 2573 }
2574
2575 return 0;
2565} 2576}
2566 2577
2567static void quattro_sbus_free_irqs(void) 2578static void quattro_sbus_free_irqs(void)
@@ -2570,6 +2581,14 @@ static void quattro_sbus_free_irqs(void)
2570 2581
2571 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { 2582 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) {
2572 struct of_device *op = qp->quattro_dev; 2583 struct of_device *op = qp->quattro_dev;
2584 int qfe_slot, skip = 0;
2585
2586 for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) {
2587 if (!qp->happy_meals[qfe_slot])
2588 skip = 1;
2589 }
2590 if (skip)
2591 continue;
2573 2592
2574 free_irq(op->irqs[0], qp); 2593 free_irq(op->irqs[0], qp);
2575 } 2594 }
@@ -2629,6 +2648,14 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
2629 int i, qfe_slot = -1; 2648 int i, qfe_slot = -1;
2630 int err = -ENODEV; 2649 int err = -ENODEV;
2631 2650
2651 sbus_dp = to_of_device(op->dev.parent)->node;
2652 if (is_qfe)
2653 sbus_dp = to_of_device(op->dev.parent->parent)->node;
2654
2655 /* We can match PCI devices too, do not accept those here. */
2656 if (strcmp(sbus_dp->name, "sbus"))
2657 return err;
2658
2632 if (is_qfe) { 2659 if (is_qfe) {
2633 qp = quattro_sbus_find(op); 2660 qp = quattro_sbus_find(op);
2634 if (qp == NULL) 2661 if (qp == NULL)
@@ -2734,10 +2761,6 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
2734 if (qp != NULL) 2761 if (qp != NULL)
2735 hp->happy_flags |= HFLAG_QUATTRO; 2762 hp->happy_flags |= HFLAG_QUATTRO;
2736 2763
2737 sbus_dp = to_of_device(op->dev.parent)->node;
2738 if (is_qfe)
2739 sbus_dp = to_of_device(op->dev.parent->parent)->node;
2740
2741 /* Get the supported DVMA burst sizes from our Happy SBUS. */ 2764 /* Get the supported DVMA burst sizes from our Happy SBUS. */
2742 hp->happy_bursts = of_getintprop_default(sbus_dp, 2765 hp->happy_bursts = of_getintprop_default(sbus_dp,
2743 "burst-sizes", 0x00); 2766 "burst-sizes", 0x00);
@@ -2824,6 +2847,9 @@ err_out_iounmap:
2824 if (hp->tcvregs) 2847 if (hp->tcvregs)
2825 of_iounmap(&op->resource[4], hp->tcvregs, TCVR_REG_SIZE); 2848 of_iounmap(&op->resource[4], hp->tcvregs, TCVR_REG_SIZE);
2826 2849
2850 if (qp)
2851 qp->happy_meals[qfe_slot] = NULL;
2852
2827err_out_free_netdev: 2853err_out_free_netdev:
2828 free_netdev(dev); 2854 free_netdev(dev);
2829 2855
@@ -3281,7 +3307,7 @@ static int __init happy_meal_sbus_init(void)
3281 3307
3282 err = of_register_driver(&hme_sbus_driver, &of_bus_type); 3308 err = of_register_driver(&hme_sbus_driver, &of_bus_type);
3283 if (!err) 3309 if (!err)
3284 quattro_sbus_register_irqs(); 3310 err = quattro_sbus_register_irqs();
3285 3311
3286 return err; 3312 return err;
3287} 3313}