aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/jazzsonic.c
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2007-09-08 15:46:49 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:07 -0400
commited9f0e0bf3ceb44334ca9b70779a50b2e79b7f97 (patch)
tree90a5001290a90ce366100ab5ff7b30510e455b1c /drivers/net/jazzsonic.c
parent99cd149efe824cf27c5d34506002a0fbfa831c0f (diff)
remove setup of platform device from jazzsonic.c
remove setup platform device from jazzsonic, which is done in arch code now Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/jazzsonic.c')
-rw-r--r--drivers/net/jazzsonic.c61
1 files changed, 7 insertions, 54 deletions
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index 75f6f441e876..b71e6633f42d 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -45,7 +45,6 @@
45#include <asm/jazzdma.h> 45#include <asm/jazzdma.h>
46 46
47static char jazz_sonic_string[] = "jazzsonic"; 47static char jazz_sonic_string[] = "jazzsonic";
48static struct platform_device *jazz_sonic_device;
49 48
50#define SONIC_MEM_SIZE 0x100 49#define SONIC_MEM_SIZE 0x100
51 50
@@ -70,14 +69,6 @@ static unsigned int sonic_debug = 1;
70#endif 69#endif
71 70
72/* 71/*
73 * Base address and interrupt of the SONIC controller on JAZZ boards
74 */
75static struct {
76 unsigned int port;
77 unsigned int irq;
78} sonic_portlist[] = { {JAZZ_ETHERNET_BASE, JAZZ_ETHERNET_IRQ}, {0, 0}};
79
80/*
81 * We cannot use station (ethernet) address prefixes to detect the 72 * We cannot use station (ethernet) address prefixes to detect the
82 * sonic controller since these are board manufacturer depended. 73 * sonic controller since these are board manufacturer depended.
83 * So we check for known Silicon Revision IDs instead. 74 * So we check for known Silicon Revision IDs instead.
@@ -215,13 +206,12 @@ static int __init jazz_sonic_probe(struct platform_device *pdev)
215{ 206{
216 struct net_device *dev; 207 struct net_device *dev;
217 struct sonic_local *lp; 208 struct sonic_local *lp;
209 struct resource *res;
218 int err = 0; 210 int err = 0;
219 int i; 211 int i;
220 212
221 /* 213 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
222 * Don't probe if we're not running on a Jazz board. 214 if (!res)
223 */
224 if (mips_machgroup != MACH_GROUP_JAZZ)
225 return -ENODEV; 215 return -ENODEV;
226 216
227 dev = alloc_etherdev(sizeof(struct sonic_local)); 217 dev = alloc_etherdev(sizeof(struct sonic_local));
@@ -235,20 +225,9 @@ static int __init jazz_sonic_probe(struct platform_device *pdev)
235 225
236 netdev_boot_setup_check(dev); 226 netdev_boot_setup_check(dev);
237 227
238 if (dev->base_addr >= KSEG0) { /* Check a single specified location. */ 228 dev->base_addr = res->start;
239 err = sonic_probe1(dev); 229 dev->irq = platform_get_irq(pdev, 0);
240 } else if (dev->base_addr != 0) { /* Don't probe at all. */ 230 err = sonic_probe1(dev);
241 err = -ENXIO;
242 } else {
243 for (i = 0; sonic_portlist[i].port; i++) {
244 dev->base_addr = sonic_portlist[i].port;
245 dev->irq = sonic_portlist[i].irq;
246 if (sonic_probe1(dev) == 0)
247 break;
248 }
249 if (!sonic_portlist[i].port)
250 err = -ENODEV;
251 }
252 if (err) 231 if (err)
253 goto out; 232 goto out;
254 err = register_netdev(dev); 233 err = register_netdev(dev);
@@ -303,38 +282,12 @@ static struct platform_driver jazz_sonic_driver = {
303 282
304static int __init jazz_sonic_init_module(void) 283static int __init jazz_sonic_init_module(void)
305{ 284{
306 int err; 285 return platform_driver_register(&jazz_sonic_driver);
307
308 if ((err = platform_driver_register(&jazz_sonic_driver))) {
309 printk(KERN_ERR "Driver registration failed\n");
310 return err;
311 }
312
313 jazz_sonic_device = platform_device_alloc(jazz_sonic_string, 0);
314 if (!jazz_sonic_device)
315 goto out_unregister;
316
317 if (platform_device_add(jazz_sonic_device)) {
318 platform_device_put(jazz_sonic_device);
319 jazz_sonic_device = NULL;
320 }
321
322 return 0;
323
324out_unregister:
325 platform_driver_unregister(&jazz_sonic_driver);
326
327 return -ENOMEM;
328} 286}
329 287
330static void __exit jazz_sonic_cleanup_module(void) 288static void __exit jazz_sonic_cleanup_module(void)
331{ 289{
332 platform_driver_unregister(&jazz_sonic_driver); 290 platform_driver_unregister(&jazz_sonic_driver);
333
334 if (jazz_sonic_device) {
335 platform_device_unregister(jazz_sonic_device);
336 jazz_sonic_device = NULL;
337 }
338} 291}
339 292
340module_init(jazz_sonic_init_module); 293module_init(jazz_sonic_init_module);