diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-10-31 17:14:57 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-31 17:14:57 +0000 |
commit | 37bb30e86bc2e48d9affb25f6ce9eb3d8e65b2ac (patch) | |
tree | d1419f0393effa0f4fd175cf0c65080e1f4626c6 /drivers/net/arm | |
parent | 1be7228da280252167150346dcec4e7c50a79eb4 (diff) |
[ARM] Convert EBSA110 network driver to a platform driver
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/net/arm')
-rw-r--r-- | drivers/net/arm/am79c961a.c | 41 | ||||
-rw-r--r-- | drivers/net/arm/am79c961a.h | 2 |
2 files changed, 32 insertions, 11 deletions
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 @@ #include <linux/init.h> #include <linux/crc32.h> #include <linux/bitops.h> +#include <linux/platform_device.h> -#include <asm/system.h> -#include <asm/irq.h> #include <asm/hardware.h> #include <asm/io.h> +#include <asm/system.h> #define TX_BUFFERS 15 #define RX_BUFFERS 25 @@ -280,10 +280,13 @@ static void am79c961_timer(unsigned long data) lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST; carrier = netif_carrier_ok(dev); - if (lnkstat && !carrier) + if (lnkstat && !carrier) { netif_carrier_on(dev); - else if (!lnkstat && carrier) + printk("%s: link up\n", dev->name); + } else if (!lnkstat && carrier) { netif_carrier_off(dev); + printk("%s: link down\n", dev->name); + } mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500)); } @@ -665,17 +668,25 @@ static void __init am79c961_banner(void) printk(KERN_INFO "%s", version); } -static int __init am79c961_init(void) +static int __init am79c961_probe(struct device *_dev) { + struct platform_device *pdev = to_platform_device(_dev); + struct resource *res; struct net_device *dev; struct dev_priv *priv; int i, ret; + res = platform_get_resource(pdev, IORESOURCE_IO, 0); + if (!res) + return -ENODEV; + dev = alloc_etherdev(sizeof(struct dev_priv)); ret = -ENOMEM; if (!dev) goto out; + SET_NETDEV_DEV(dev, &pdev->dev); + priv = netdev_priv(dev); /* @@ -683,8 +694,8 @@ static int __init am79c961_init(void) * The PNP initialisation should have been * done by the ether bootp loader. */ - dev->base_addr = 0x220; - dev->irq = IRQ_EBSA110_ETHERNET; + dev->base_addr = res->start; + dev->irq = platform_get_irq(pdev, 0); ret = -ENODEV; if (!request_region(dev->base_addr, 0x18, dev->name)) @@ -705,11 +716,11 @@ static int __init am79c961_init(void) inb(dev->base_addr + 4) != 0x2b) goto release; - am79c961_banner(); - for (i = 0; i < 6; i++) dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff; + am79c961_banner(); + spin_lock_init(&priv->chip_lock); init_timer(&priv->timer); priv->timer.data = (unsigned long)dev; @@ -732,6 +743,7 @@ static int __init am79c961_init(void) if (ret == 0) { printk(KERN_INFO "%s: ether address ", dev->name); + /* Retrive and print the ethernet address. */ for (i = 0; i < 6; i++) printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]); @@ -746,4 +758,15 @@ out: return ret; } +static struct device_driver am79c961_driver = { + .name = "am79c961", + .bus = &platform_bus_type, + .probe = am79c961_probe, +}; + +static int __init am79c961_init(void) +{ + return driver_register(&am79c961_driver); +} + __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 { struct timer_list timer; }; -extern int am79c961_probe (struct net_device *dev); - #endif |