diff options
Diffstat (limited to 'drivers/net/dm9000.c')
-rw-r--r-- | drivers/net/dm9000.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 24996da4c1c4..7965a9b08e79 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -410,10 +410,7 @@ dm9000_probe(struct platform_device *pdev) | |||
410 | if (pdev->num_resources < 2) { | 410 | if (pdev->num_resources < 2) { |
411 | ret = -ENODEV; | 411 | ret = -ENODEV; |
412 | goto out; | 412 | goto out; |
413 | } | 413 | } else if (pdev->num_resources == 2) { |
414 | |||
415 | switch (pdev->num_resources) { | ||
416 | case 2: | ||
417 | base = pdev->resource[0].start; | 414 | base = pdev->resource[0].start; |
418 | 415 | ||
419 | if (!request_mem_region(base, 4, ndev->name)) { | 416 | if (!request_mem_region(base, 4, ndev->name)) { |
@@ -423,17 +420,16 @@ dm9000_probe(struct platform_device *pdev) | |||
423 | 420 | ||
424 | ndev->base_addr = base; | 421 | ndev->base_addr = base; |
425 | ndev->irq = pdev->resource[1].start; | 422 | ndev->irq = pdev->resource[1].start; |
426 | db->io_addr = (void *)base; | 423 | db->io_addr = (void __iomem *)base; |
427 | db->io_data = (void *)(base + 4); | 424 | db->io_data = (void __iomem *)(base + 4); |
428 | |||
429 | break; | ||
430 | 425 | ||
431 | case 3: | 426 | } else { |
432 | db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 427 | db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
433 | db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 428 | db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
434 | db->irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 429 | db->irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
435 | 430 | ||
436 | if (db->addr_res == NULL || db->data_res == NULL) { | 431 | if (db->addr_res == NULL || db->data_res == NULL || |
432 | db->irq_res == NULL) { | ||
437 | printk(KERN_ERR PFX "insufficient resources\n"); | 433 | printk(KERN_ERR PFX "insufficient resources\n"); |
438 | ret = -ENOENT; | 434 | ret = -ENOENT; |
439 | goto out; | 435 | goto out; |
@@ -482,7 +478,6 @@ dm9000_probe(struct platform_device *pdev) | |||
482 | 478 | ||
483 | /* ensure at least we have a default set of IO routines */ | 479 | /* ensure at least we have a default set of IO routines */ |
484 | dm9000_set_io(db, iosize); | 480 | dm9000_set_io(db, iosize); |
485 | |||
486 | } | 481 | } |
487 | 482 | ||
488 | /* check to see if anything is being over-ridden */ | 483 | /* check to see if anything is being over-ridden */ |
@@ -564,6 +559,13 @@ dm9000_probe(struct platform_device *pdev) | |||
564 | for (i = 0; i < 6; i++) | 559 | for (i = 0; i < 6; i++) |
565 | ndev->dev_addr[i] = db->srom[i]; | 560 | ndev->dev_addr[i] = db->srom[i]; |
566 | 561 | ||
562 | if (!is_valid_ether_addr(ndev->dev_addr)) { | ||
563 | /* try reading from mac */ | ||
564 | |||
565 | for (i = 0; i < 6; i++) | ||
566 | ndev->dev_addr[i] = ior(db, i+DM9000_PAR); | ||
567 | } | ||
568 | |||
567 | if (!is_valid_ether_addr(ndev->dev_addr)) | 569 | if (!is_valid_ether_addr(ndev->dev_addr)) |
568 | printk("%s: Invalid ethernet MAC address. Please " | 570 | printk("%s: Invalid ethernet MAC address. Please " |
569 | "set using ifconfig\n", ndev->name); | 571 | "set using ifconfig\n", ndev->name); |
@@ -663,7 +665,6 @@ dm9000_init_dm9000(struct net_device *dev) | |||
663 | db->tx_pkt_cnt = 0; | 665 | db->tx_pkt_cnt = 0; |
664 | db->queue_pkt_len = 0; | 666 | db->queue_pkt_len = 0; |
665 | dev->trans_start = 0; | 667 | dev->trans_start = 0; |
666 | spin_lock_init(&db->lock); | ||
667 | } | 668 | } |
668 | 669 | ||
669 | /* | 670 | /* |
@@ -767,7 +768,7 @@ dm9000_stop(struct net_device *ndev) | |||
767 | * receive the packet to upper layer, free the transmitted packet | 768 | * receive the packet to upper layer, free the transmitted packet |
768 | */ | 769 | */ |
769 | 770 | ||
770 | void | 771 | static void |
771 | dm9000_tx_done(struct net_device *dev, board_info_t * db) | 772 | dm9000_tx_done(struct net_device *dev, board_info_t * db) |
772 | { | 773 | { |
773 | int tx_status = ior(db, DM9000_NSR); /* Got TX status */ | 774 | int tx_status = ior(db, DM9000_NSR); /* Got TX status */ |
@@ -1187,13 +1188,14 @@ dm9000_drv_remove(struct platform_device *pdev) | |||
1187 | } | 1188 | } |
1188 | 1189 | ||
1189 | static struct platform_driver dm9000_driver = { | 1190 | static struct platform_driver dm9000_driver = { |
1191 | .driver = { | ||
1192 | .name = "dm9000", | ||
1193 | .owner = THIS_MODULE, | ||
1194 | }, | ||
1190 | .probe = dm9000_probe, | 1195 | .probe = dm9000_probe, |
1191 | .remove = dm9000_drv_remove, | 1196 | .remove = dm9000_drv_remove, |
1192 | .suspend = dm9000_drv_suspend, | 1197 | .suspend = dm9000_drv_suspend, |
1193 | .resume = dm9000_drv_resume, | 1198 | .resume = dm9000_drv_resume, |
1194 | .driver = { | ||
1195 | .name = "dm9000", | ||
1196 | }, | ||
1197 | }; | 1199 | }; |
1198 | 1200 | ||
1199 | static int __init | 1201 | static int __init |