diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2018-03-01 18:29:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-01 21:21:36 -0500 |
commit | 43bf2e6d69dd6c2cea7a28763893a3dff34b7873 (patch) | |
tree | 0a827f5544d29c4a6d4e58b55adb729f51b31877 | |
parent | c967226b1c6caf6888af0f54ea08cb79384cef86 (diff) |
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: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/m68k/mac/config.c | 4 | ||||
-rw-r--r-- | drivers/net/Space.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/cirrus/mac89x0.c | 68 | ||||
-rw-r--r-- | include/net/Space.h | 1 |
4 files changed, 33 insertions, 43 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index d3d435248a24..c73eb8209555 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -1088,6 +1088,10 @@ int __init mac_platform_init(void) | |||
1088 | macintosh_config->expansion_type == MAC_EXP_PDS_COMM) | 1088 | macintosh_config->expansion_type == MAC_EXP_PDS_COMM) |
1089 | platform_device_register_simple("macsonic", -1, NULL, 0); | 1089 | platform_device_register_simple("macsonic", -1, NULL, 0); |
1090 | 1090 | ||
1091 | if (macintosh_config->expansion_type == MAC_EXP_PDS || | ||
1092 | macintosh_config->expansion_type == MAC_EXP_PDS_COMM) | ||
1093 | platform_device_register_simple("mac89x0", -1, NULL, 0); | ||
1094 | |||
1091 | if (macintosh_config->ether_type == MAC_ETHER_MACE) | 1095 | if (macintosh_config->ether_type == MAC_ETHER_MACE) |
1092 | platform_device_register_simple("macmace", -1, NULL, 0); | 1096 | platform_device_register_simple("macmace", -1, NULL, 0); |
1093 | 1097 | ||
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 64333ec999ac..3afda6561434 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -114,9 +114,6 @@ static struct devprobe2 m68k_probes[] __initdata = { | |||
114 | #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ | 114 | #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ |
115 | {mvme147lance_probe, 0}, | 115 | {mvme147lance_probe, 0}, |
116 | #endif | 116 | #endif |
117 | #ifdef CONFIG_MAC89x0 | ||
118 | {mac89x0_probe, 0}, | ||
119 | #endif | ||
120 | {NULL, 0}, | 117 | {NULL, 0}, |
121 | }; | 118 | }; |
122 | 119 | ||
diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c index 4fe0ae93ab36..911139abbe20 100644 --- a/drivers/net/ethernet/cirrus/mac89x0.c +++ b/drivers/net/ethernet/cirrus/mac89x0.c | |||
@@ -93,6 +93,7 @@ static const char version[] = | |||
93 | #include <linux/errno.h> | 93 | #include <linux/errno.h> |
94 | #include <linux/init.h> | 94 | #include <linux/init.h> |
95 | #include <linux/netdevice.h> | 95 | #include <linux/netdevice.h> |
96 | #include <linux/platform_device.h> | ||
96 | #include <linux/etherdevice.h> | 97 | #include <linux/etherdevice.h> |
97 | #include <linux/skbuff.h> | 98 | #include <linux/skbuff.h> |
98 | #include <linux/delay.h> | 99 | #include <linux/delay.h> |
@@ -105,6 +106,10 @@ static const char version[] = | |||
105 | 106 | ||
106 | #include "cs89x0.h" | 107 | #include "cs89x0.h" |
107 | 108 | ||
109 | static int debug; | ||
110 | module_param(debug, int, 0); | ||
111 | MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); | ||
112 | |||
108 | static unsigned int net_debug = NET_DEBUG; | 113 | static unsigned int net_debug = NET_DEBUG; |
109 | 114 | ||
110 | /* Information that need to be kept for each board. */ | 115 | /* Information that need to be kept for each board. */ |
@@ -167,10 +172,9 @@ static const struct net_device_ops mac89x0_netdev_ops = { | |||
167 | 172 | ||
168 | /* Probe for the CS8900 card in slot E. We won't bother looking | 173 | /* Probe for the CS8900 card in slot E. We won't bother looking |
169 | anywhere else until we have a really good reason to do so. */ | 174 | anywhere else until we have a really good reason to do so. */ |
170 | struct net_device * __init mac89x0_probe(int unit) | 175 | static int mac89x0_device_probe(struct platform_device *pdev) |
171 | { | 176 | { |
172 | struct net_device *dev; | 177 | struct net_device *dev; |
173 | static int once_is_enough; | ||
174 | struct net_local *lp; | 178 | struct net_local *lp; |
175 | static unsigned version_printed; | 179 | static unsigned version_printed; |
176 | int i, slot; | 180 | int i, slot; |
@@ -180,21 +184,11 @@ struct net_device * __init mac89x0_probe(int unit) | |||
180 | int err = -ENODEV; | 184 | int err = -ENODEV; |
181 | struct nubus_rsrc *fres; | 185 | struct nubus_rsrc *fres; |
182 | 186 | ||
183 | if (!MACH_IS_MAC) | 187 | net_debug = debug; |
184 | return ERR_PTR(-ENODEV); | ||
185 | 188 | ||
186 | dev = alloc_etherdev(sizeof(struct net_local)); | 189 | dev = alloc_etherdev(sizeof(struct net_local)); |
187 | if (!dev) | 190 | if (!dev) |
188 | return ERR_PTR(-ENOMEM); | 191 | return -ENOMEM; |
189 | |||
190 | if (unit >= 0) { | ||
191 | sprintf(dev->name, "eth%d", unit); | ||
192 | netdev_boot_setup_check(dev); | ||
193 | } | ||
194 | |||
195 | if (once_is_enough) | ||
196 | goto out; | ||
197 | once_is_enough = 1; | ||
198 | 192 | ||
199 | /* We might have to parameterize this later */ | 193 | /* We might have to parameterize this later */ |
200 | slot = 0xE; | 194 | slot = 0xE; |
@@ -221,6 +215,8 @@ struct net_device * __init mac89x0_probe(int unit) | |||
221 | if (sig != swab16(CHIP_EISA_ID_SIG)) | 215 | if (sig != swab16(CHIP_EISA_ID_SIG)) |
222 | goto out; | 216 | goto out; |
223 | 217 | ||
218 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
219 | |||
224 | /* Initialize the net_device structure. */ | 220 | /* Initialize the net_device structure. */ |
225 | lp = netdev_priv(dev); | 221 | lp = netdev_priv(dev); |
226 | 222 | ||
@@ -280,12 +276,14 @@ struct net_device * __init mac89x0_probe(int unit) | |||
280 | err = register_netdev(dev); | 276 | err = register_netdev(dev); |
281 | if (err) | 277 | if (err) |
282 | goto out1; | 278 | goto out1; |
283 | return NULL; | 279 | |
280 | platform_set_drvdata(pdev, dev); | ||
281 | return 0; | ||
284 | out1: | 282 | out1: |
285 | nubus_writew(0, dev->base_addr + ADD_PORT); | 283 | nubus_writew(0, dev->base_addr + ADD_PORT); |
286 | out: | 284 | out: |
287 | free_netdev(dev); | 285 | free_netdev(dev); |
288 | return ERR_PTR(err); | 286 | return err; |
289 | } | 287 | } |
290 | 288 | ||
291 | /* Open/initialize the board. This is called (in the current kernel) | 289 | /* 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 | return 0; | 569 | return 0; |
572 | } | 570 | } |
573 | 571 | ||
574 | #ifdef MODULE | ||
575 | |||
576 | static struct net_device *dev_cs89x0; | ||
577 | static int debug; | ||
578 | |||
579 | module_param(debug, int, 0); | ||
580 | MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); | ||
581 | MODULE_LICENSE("GPL"); | 572 | MODULE_LICENSE("GPL"); |
582 | 573 | ||
583 | int __init | 574 | static int mac89x0_device_remove(struct platform_device *pdev) |
584 | init_module(void) | ||
585 | { | 575 | { |
586 | net_debug = debug; | 576 | struct net_device *dev = platform_get_drvdata(pdev); |
587 | dev_cs89x0 = mac89x0_probe(-1); | 577 | |
588 | if (IS_ERR(dev_cs89x0)) { | 578 | unregister_netdev(dev); |
589 | printk(KERN_WARNING "mac89x0.c: No card found\n"); | 579 | nubus_writew(0, dev->base_addr + ADD_PORT); |
590 | return PTR_ERR(dev_cs89x0); | 580 | free_netdev(dev); |
591 | } | ||
592 | return 0; | 581 | return 0; |
593 | } | 582 | } |
594 | 583 | ||
595 | void | 584 | static struct platform_driver mac89x0_platform_driver = { |
596 | cleanup_module(void) | 585 | .probe = mac89x0_device_probe, |
597 | { | 586 | .remove = mac89x0_device_remove, |
598 | unregister_netdev(dev_cs89x0); | 587 | .driver = { |
599 | nubus_writew(0, dev_cs89x0->base_addr + ADD_PORT); | 588 | .name = "mac89x0", |
600 | free_netdev(dev_cs89x0); | 589 | }, |
601 | } | 590 | }; |
602 | #endif /* MODULE */ | 591 | |
592 | module_platform_driver(mac89x0_platform_driver); | ||
diff --git a/include/net/Space.h b/include/net/Space.h index 336da258885a..9cce0d80d37a 100644 --- a/include/net/Space.h +++ b/include/net/Space.h | |||
@@ -20,7 +20,6 @@ struct net_device *cs89x0_probe(int unit); | |||
20 | struct net_device *mvme147lance_probe(int unit); | 20 | struct net_device *mvme147lance_probe(int unit); |
21 | struct net_device *tc515_probe(int unit); | 21 | struct net_device *tc515_probe(int unit); |
22 | struct net_device *lance_probe(int unit); | 22 | struct net_device *lance_probe(int unit); |
23 | struct net_device *mac89x0_probe(int unit); | ||
24 | struct net_device *cops_probe(int unit); | 23 | struct net_device *cops_probe(int unit); |
25 | struct net_device *ltpc_probe(void); | 24 | struct net_device *ltpc_probe(void); |
26 | 25 | ||