aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-ebsa110/core.c26
-rw-r--r--drivers/net/arm/am79c961a.c41
-rw-r--r--drivers/net/arm/am79c961a.h2
3 files changed, 57 insertions, 12 deletions
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 15261646dcdd..ed4614983adb 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -251,9 +251,33 @@ static struct platform_device serial_device = {
251 }, 251 },
252}; 252};
253 253
254static struct resource am79c961_resources[] = {
255 {
256 .start = 0x220,
257 .end = 0x238,
258 .flags = IORESOURCE_IO,
259 }, {
260 .start = IRQ_EBSA110_ETHERNET,
261 .end = IRQ_EBSA110_ETHERNET,
262 .flags = IORESOURCE_IRQ,
263 },
264};
265
266static struct platform_device am79c961_device = {
267 .name = "am79c961",
268 .id = -1,
269 .num_resources = ARRAY_SIZE(am79c961_resources),
270 .resource = am79c961_resources,
271};
272
273static struct platform_device *ebsa110_devices[] = {
274 &serial_device,
275 &am79c961_device,
276};
277
254static int __init ebsa110_init(void) 278static int __init ebsa110_init(void)
255{ 279{
256 return platform_device_register(&serial_device); 280 return platform_add_devices(ebsa110_devices, ARRAY_SIZE(ebsa110_devices));
257} 281}
258 282
259arch_initcall(ebsa110_init); 283arch_initcall(ebsa110_init);
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 3d50e953faaa..877891a29aaa 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -26,11 +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/irq.h>
32#include <asm/hardware.h> 31#include <asm/hardware.h>
33#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/system.h>
34 34
35#define TX_BUFFERS 15 35#define TX_BUFFERS 15
36#define RX_BUFFERS 25 36#define RX_BUFFERS 25
@@ -280,10 +280,13 @@ static void am79c961_timer(unsigned long data)
280 lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; 280 lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST;
281 carrier = netif_carrier_ok(dev); 281 carrier = netif_carrier_ok(dev);
282 282
283 if (lnkstat && !carrier) 283 if (lnkstat && !carrier) {
284 netif_carrier_on(dev); 284 netif_carrier_on(dev);
285 else if (!lnkstat && carrier) 285 printk("%s: link up\n", dev->name);
286 } else if (!lnkstat && carrier) {
286 netif_carrier_off(dev); 287 netif_carrier_off(dev);
288 printk("%s: link down\n", dev->name);
289 }
287 290
288 mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); 291 mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500));
289} 292}
@@ -665,17 +668,25 @@ static void __init am79c961_banner(void)
665 printk(KERN_INFO "%s", version); 668 printk(KERN_INFO "%s", version);
666} 669}
667 670
668static int __init am79c961_init(void) 671static int __init am79c961_probe(struct device *_dev)
669{ 672{
673 struct platform_device *pdev = to_platform_device(_dev);
674 struct resource *res;
670 struct net_device *dev; 675 struct net_device *dev;
671 struct dev_priv *priv; 676 struct dev_priv *priv;
672 int i, ret; 677 int i, ret;
673 678
679 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
680 if (!res)
681 return -ENODEV;
682
674 dev = alloc_etherdev(sizeof(struct dev_priv)); 683 dev = alloc_etherdev(sizeof(struct dev_priv));
675 ret = -ENOMEM; 684 ret = -ENOMEM;
676 if (!dev) 685 if (!dev)
677 goto out; 686 goto out;
678 687
688 SET_NETDEV_DEV(dev, &pdev->dev);
689
679 priv = netdev_priv(dev); 690 priv = netdev_priv(dev);
680 691
681 /* 692 /*
@@ -683,8 +694,8 @@ static int __init am79c961_init(void)
683 * The PNP initialisation should have been 694 * The PNP initialisation should have been
684 * done by the ether bootp loader. 695 * done by the ether bootp loader.
685 */ 696 */
686 dev->base_addr = 0x220; 697 dev->base_addr = res->start;
687 dev->irq = IRQ_EBSA110_ETHERNET; 698 dev->irq = platform_get_irq(pdev, 0);
688 699
689 ret = -ENODEV; 700 ret = -ENODEV;
690 if (!request_region(dev->base_addr, 0x18, dev->name)) 701 if (!request_region(dev->base_addr, 0x18, dev->name))
@@ -705,11 +716,11 @@ static int __init am79c961_init(void)
705 inb(dev->base_addr + 4) != 0x2b) 716 inb(dev->base_addr + 4) != 0x2b)
706 goto release; 717 goto release;
707 718
708 am79c961_banner();
709
710 for (i = 0; i < 6; i++) 719 for (i = 0; i < 6; i++)
711 dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; 720 dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff;
712 721
722 am79c961_banner();
723
713 spin_lock_init(&priv->chip_lock); 724 spin_lock_init(&priv->chip_lock);
714 init_timer(&priv->timer); 725 init_timer(&priv->timer);
715 priv->timer.data = (unsigned long)dev; 726 priv->timer.data = (unsigned long)dev;
@@ -732,6 +743,7 @@ static int __init am79c961_init(void)
732 if (ret == 0) { 743 if (ret == 0) {
733 printk(KERN_INFO "%s: ether address ", dev->name); 744 printk(KERN_INFO "%s: ether address ", dev->name);
734 745
746 /* Retrive and print the ethernet address. */
735 for (i = 0; i < 6; i++) 747 for (i = 0; i < 6; i++)
736 printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); 748 printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]);
737 749
@@ -746,4 +758,15 @@ out:
746 return ret; 758 return ret;
747} 759}
748 760
761static struct device_driver am79c961_driver = {
762 .name = "am79c961",
763 .bus = &platform_bus_type,
764 .probe = am79c961_probe,
765};
766
767static int __init am79c961_init(void)
768{
769 return driver_register(&am79c961_driver);
770}
771
749__initcall(am79c961_init); 772__initcall(am79c961_init);
diff --git a/drivers/net/arm/am79c961a.h b/drivers/net/arm/am79c961a.h
index 1e9b05050cbe..6a49ac7f6d46 100644
--- a/drivers/net/arm/am79c961a.h
+++ b/drivers/net/arm/am79c961a.h
@@ -143,6 +143,4 @@ struct dev_priv {
143 struct timer_list timer; 143 struct timer_list timer;
144}; 144};
145 145
146extern int am79c961_probe (struct net_device *dev);
147
148#endif 146#endif