Commit 43bf2e6d authored by Finn Thain's avatar Finn Thain Committed by David S. Miller

net/mac89x0: Convert to platform_driver

Apparently these Dayna cards don't have a pseudoslot declaration ROM
which means they can't be probed like NuBus cards.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c967226b
...@@ -1088,6 +1088,10 @@ int __init mac_platform_init(void) ...@@ -1088,6 +1088,10 @@ int __init mac_platform_init(void)
macintosh_config->expansion_type == MAC_EXP_PDS_COMM) macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
platform_device_register_simple("macsonic", -1, NULL, 0); platform_device_register_simple("macsonic", -1, NULL, 0);
if (macintosh_config->expansion_type == MAC_EXP_PDS ||
macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
platform_device_register_simple("mac89x0", -1, NULL, 0);
if (macintosh_config->ether_type == MAC_ETHER_MACE) if (macintosh_config->ether_type == MAC_ETHER_MACE)
platform_device_register_simple("macmace", -1, NULL, 0); platform_device_register_simple("macmace", -1, NULL, 0);
......
...@@ -113,9 +113,6 @@ static struct devprobe2 m68k_probes[] __initdata = { ...@@ -113,9 +113,6 @@ static struct devprobe2 m68k_probes[] __initdata = {
#endif #endif
#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
{mvme147lance_probe, 0}, {mvme147lance_probe, 0},
#endif
#ifdef CONFIG_MAC89x0
{mac89x0_probe, 0},
#endif #endif
{NULL, 0}, {NULL, 0},
}; };
......
...@@ -93,6 +93,7 @@ static const char version[] = ...@@ -93,6 +93,7 @@ static const char version[] =
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -105,6 +106,10 @@ static const char version[] = ...@@ -105,6 +106,10 @@ static const char version[] =
#include "cs89x0.h" #include "cs89x0.h"
static int debug;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)");
static unsigned int net_debug = NET_DEBUG; static unsigned int net_debug = NET_DEBUG;
/* Information that need to be kept for each board. */ /* Information that need to be kept for each board. */
...@@ -167,10 +172,9 @@ static const struct net_device_ops mac89x0_netdev_ops = { ...@@ -167,10 +172,9 @@ static const struct net_device_ops mac89x0_netdev_ops = {
/* Probe for the CS8900 card in slot E. We won't bother looking /* Probe for the CS8900 card in slot E. We won't bother looking
anywhere else until we have a really good reason to do so. */ anywhere else until we have a really good reason to do so. */
struct net_device * __init mac89x0_probe(int unit) static int mac89x0_device_probe(struct platform_device *pdev)
{ {
struct net_device *dev; struct net_device *dev;
static int once_is_enough;
struct net_local *lp; struct net_local *lp;
static unsigned version_printed; static unsigned version_printed;
int i, slot; int i, slot;
...@@ -180,21 +184,11 @@ struct net_device * __init mac89x0_probe(int unit) ...@@ -180,21 +184,11 @@ struct net_device * __init mac89x0_probe(int unit)
int err = -ENODEV; int err = -ENODEV;
struct nubus_rsrc *fres; struct nubus_rsrc *fres;
if (!MACH_IS_MAC) net_debug = debug;
return ERR_PTR(-ENODEV);
dev = alloc_etherdev(sizeof(struct net_local)); dev = alloc_etherdev(sizeof(struct net_local));
if (!dev) if (!dev)
return ERR_PTR(-ENOMEM); return -ENOMEM;
if (unit >= 0) {
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
}
if (once_is_enough)
goto out;
once_is_enough = 1;
/* We might have to parameterize this later */ /* We might have to parameterize this later */
slot = 0xE; slot = 0xE;
...@@ -221,6 +215,8 @@ struct net_device * __init mac89x0_probe(int unit) ...@@ -221,6 +215,8 @@ struct net_device * __init mac89x0_probe(int unit)
if (sig != swab16(CHIP_EISA_ID_SIG)) if (sig != swab16(CHIP_EISA_ID_SIG))
goto out; goto out;
SET_NETDEV_DEV(dev, &pdev->dev);
/* Initialize the net_device structure. */ /* Initialize the net_device structure. */
lp = netdev_priv(dev); lp = netdev_priv(dev);
...@@ -280,12 +276,14 @@ struct net_device * __init mac89x0_probe(int unit) ...@@ -280,12 +276,14 @@ struct net_device * __init mac89x0_probe(int unit)
err = register_netdev(dev); err = register_netdev(dev);
if (err) if (err)
goto out1; goto out1;
return NULL;
platform_set_drvdata(pdev, dev);
return 0;
out1: out1:
nubus_writew(0, dev->base_addr + ADD_PORT); nubus_writew(0, dev->base_addr + ADD_PORT);
out: out:
free_netdev(dev); free_netdev(dev);
return ERR_PTR(err); return err;
} }
/* Open/initialize the board. This is called (in the current kernel) /* Open/initialize the board. This is called (in the current kernel)
...@@ -571,32 +569,24 @@ static int set_mac_address(struct net_device *dev, void *addr) ...@@ -571,32 +569,24 @@ static int set_mac_address(struct net_device *dev, void *addr)
return 0; return 0;
} }
#ifdef MODULE
static struct net_device *dev_cs89x0;
static int debug;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
int __init static int mac89x0_device_remove(struct platform_device *pdev)
init_module(void)
{ {
net_debug = debug; struct net_device *dev = platform_get_drvdata(pdev);
dev_cs89x0 = mac89x0_probe(-1);
if (IS_ERR(dev_cs89x0)) { unregister_netdev(dev);
printk(KERN_WARNING "mac89x0.c: No card found\n"); nubus_writew(0, dev->base_addr + ADD_PORT);
return PTR_ERR(dev_cs89x0); free_netdev(dev);
}
return 0; return 0;
} }
void static struct platform_driver mac89x0_platform_driver = {
cleanup_module(void) .probe = mac89x0_device_probe,
{ .remove = mac89x0_device_remove,
unregister_netdev(dev_cs89x0); .driver = {
nubus_writew(0, dev_cs89x0->base_addr + ADD_PORT); .name = "mac89x0",
free_netdev(dev_cs89x0); },
} };
#endif /* MODULE */
module_platform_driver(mac89x0_platform_driver);
...@@ -20,7 +20,6 @@ struct net_device *cs89x0_probe(int unit); ...@@ -20,7 +20,6 @@ struct net_device *cs89x0_probe(int unit);
struct net_device *mvme147lance_probe(int unit); struct net_device *mvme147lance_probe(int unit);
struct net_device *tc515_probe(int unit); struct net_device *tc515_probe(int unit);
struct net_device *lance_probe(int unit); struct net_device *lance_probe(int unit);
struct net_device *mac89x0_probe(int unit);
struct net_device *cops_probe(int unit); struct net_device *cops_probe(int unit);
struct net_device *ltpc_probe(void); struct net_device *ltpc_probe(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment