diff options
Diffstat (limited to 'drivers/net/arm/am79c961a.c')
-rw-r--r-- | drivers/net/arm/am79c961a.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c index c56d86d371a9..877891a29aaa 100644 --- a/drivers/net/arm/am79c961a.c +++ b/drivers/net/arm/am79c961a.c | |||
@@ -26,10 +26,11 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/crc32.h> | 27 | #include <linux/crc32.h> |
28 | #include <linux/bitops.h> | 28 | #include <linux/bitops.h> |
29 | #include <linux/platform_device.h> | ||
29 | 30 | ||
30 | #include <asm/system.h> | 31 | #include <asm/hardware.h> |
31 | #include <asm/irq.h> | ||
32 | #include <asm/io.h> | 32 | #include <asm/io.h> |
33 | #include <asm/system.h> | ||
33 | 34 | ||
34 | #define TX_BUFFERS 15 | 35 | #define TX_BUFFERS 15 |
35 | #define RX_BUFFERS 25 | 36 | #define RX_BUFFERS 25 |
@@ -279,10 +280,13 @@ static void am79c961_timer(unsigned long data) | |||
279 | lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; | 280 | lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; |
280 | carrier = netif_carrier_ok(dev); | 281 | carrier = netif_carrier_ok(dev); |
281 | 282 | ||
282 | if (lnkstat && !carrier) | 283 | if (lnkstat && !carrier) { |
283 | netif_carrier_on(dev); | 284 | netif_carrier_on(dev); |
284 | else if (!lnkstat && carrier) | 285 | printk("%s: link up\n", dev->name); |
286 | } else if (!lnkstat && carrier) { | ||
285 | netif_carrier_off(dev); | 287 | netif_carrier_off(dev); |
288 | printk("%s: link down\n", dev->name); | ||
289 | } | ||
286 | 290 | ||
287 | mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); | 291 | mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); |
288 | } | 292 | } |
@@ -664,17 +668,25 @@ static void __init am79c961_banner(void) | |||
664 | printk(KERN_INFO "%s", version); | 668 | printk(KERN_INFO "%s", version); |
665 | } | 669 | } |
666 | 670 | ||
667 | static int __init am79c961_init(void) | 671 | static int __init am79c961_probe(struct device *_dev) |
668 | { | 672 | { |
673 | struct platform_device *pdev = to_platform_device(_dev); | ||
674 | struct resource *res; | ||
669 | struct net_device *dev; | 675 | struct net_device *dev; |
670 | struct dev_priv *priv; | 676 | struct dev_priv *priv; |
671 | int i, ret; | 677 | int i, ret; |
672 | 678 | ||
679 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
680 | if (!res) | ||
681 | return -ENODEV; | ||
682 | |||
673 | dev = alloc_etherdev(sizeof(struct dev_priv)); | 683 | dev = alloc_etherdev(sizeof(struct dev_priv)); |
674 | ret = -ENOMEM; | 684 | ret = -ENOMEM; |
675 | if (!dev) | 685 | if (!dev) |
676 | goto out; | 686 | goto out; |
677 | 687 | ||
688 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
689 | |||
678 | priv = netdev_priv(dev); | 690 | priv = netdev_priv(dev); |
679 | 691 | ||
680 | /* | 692 | /* |
@@ -682,8 +694,8 @@ static int __init am79c961_init(void) | |||
682 | * The PNP initialisation should have been | 694 | * The PNP initialisation should have been |
683 | * done by the ether bootp loader. | 695 | * done by the ether bootp loader. |
684 | */ | 696 | */ |
685 | dev->base_addr = 0x220; | 697 | dev->base_addr = res->start; |
686 | dev->irq = IRQ_EBSA110_ETHERNET; | 698 | dev->irq = platform_get_irq(pdev, 0); |
687 | 699 | ||
688 | ret = -ENODEV; | 700 | ret = -ENODEV; |
689 | if (!request_region(dev->base_addr, 0x18, dev->name)) | 701 | if (!request_region(dev->base_addr, 0x18, dev->name)) |
@@ -704,11 +716,11 @@ static int __init am79c961_init(void) | |||
704 | inb(dev->base_addr + 4) != 0x2b) | 716 | inb(dev->base_addr + 4) != 0x2b) |
705 | goto release; | 717 | goto release; |
706 | 718 | ||
707 | am79c961_banner(); | ||
708 | |||
709 | for (i = 0; i < 6; i++) | 719 | for (i = 0; i < 6; i++) |
710 | dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; | 720 | dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; |
711 | 721 | ||
722 | am79c961_banner(); | ||
723 | |||
712 | spin_lock_init(&priv->chip_lock); | 724 | spin_lock_init(&priv->chip_lock); |
713 | init_timer(&priv->timer); | 725 | init_timer(&priv->timer); |
714 | priv->timer.data = (unsigned long)dev; | 726 | priv->timer.data = (unsigned long)dev; |
@@ -731,6 +743,7 @@ static int __init am79c961_init(void) | |||
731 | if (ret == 0) { | 743 | if (ret == 0) { |
732 | printk(KERN_INFO "%s: ether address ", dev->name); | 744 | printk(KERN_INFO "%s: ether address ", dev->name); |
733 | 745 | ||
746 | /* Retrive and print the ethernet address. */ | ||
734 | for (i = 0; i < 6; i++) | 747 | for (i = 0; i < 6; i++) |
735 | printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); | 748 | printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); |
736 | 749 | ||
@@ -745,4 +758,15 @@ out: | |||
745 | return ret; | 758 | return ret; |
746 | } | 759 | } |
747 | 760 | ||
761 | static struct device_driver am79c961_driver = { | ||
762 | .name = "am79c961", | ||
763 | .bus = &platform_bus_type, | ||
764 | .probe = am79c961_probe, | ||
765 | }; | ||
766 | |||
767 | static int __init am79c961_init(void) | ||
768 | { | ||
769 | return driver_register(&am79c961_driver); | ||
770 | } | ||
771 | |||
748 | __initcall(am79c961_init); | 772 | __initcall(am79c961_init); |