~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/net/tulip/tulip_core.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
        Please submit bugs to http://bugzilla.kernel.org/ .
13
13
*/
14
14
 
 
15
#define pr_fmt(fmt) "tulip: " fmt
15
16
 
16
17
#define DRV_NAME        "tulip"
17
18
#ifdef CONFIG_TULIP_NAPI
119
120
module_param_array(options, int, NULL, 0);
120
121
module_param_array(full_duplex, int, NULL, 0);
121
122
 
122
 
#define PFX DRV_NAME ": "
123
 
 
124
123
#ifdef TULIP_DEBUG
125
124
int tulip_debug = TULIP_DEBUG;
126
125
#else
331
330
        udelay(100);
332
331
 
333
332
        if (tulip_debug > 1)
334
 
                printk(KERN_DEBUG "%s: tulip_up(), irq==%d\n",
335
 
                       dev->name, dev->irq);
 
333
                netdev_dbg(dev, "tulip_up(), irq==%d\n", dev->irq);
336
334
 
337
335
        iowrite32(tp->rx_ring_dma, ioaddr + CSR3);
338
336
        iowrite32(tp->tx_ring_dma, ioaddr + CSR4);
499
497
        iowrite32(0, ioaddr + CSR2);            /* Rx poll demand */
500
498
 
501
499
        if (tulip_debug > 2) {
502
 
                printk(KERN_DEBUG "%s: Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n",
503
 
                       dev->name, ioread32(ioaddr + CSR0),
504
 
                       ioread32(ioaddr + CSR5),
505
 
                       ioread32(ioaddr + CSR6));
 
500
                netdev_dbg(dev, "Done tulip_up(), CSR0 %08x, CSR5 %08x CSR6 %08x\n",
 
501
                           ioread32(ioaddr + CSR0),
 
502
                           ioread32(ioaddr + CSR5),
 
503
                           ioread32(ioaddr + CSR6));
506
504
        }
507
505
 
508
506
        /* Set the timer to switch to check for link beat and perhaps switch
843
841
        tulip_down (dev);
844
842
 
845
843
        if (tulip_debug > 1)
846
 
                dev_printk(KERN_DEBUG, &dev->dev,
847
 
                           "Shutting down ethercard, status was %02x\n",
 
844
                netdev_dbg(dev, "Shutting down ethercard, status was %02x\n",
848
845
                           ioread32 (ioaddr + CSR5));
849
846
 
850
847
        free_irq (dev->irq, dev);
1207
1204
        u32 csr0;
1208
1205
 
1209
1206
        if (tulip_debug > 3)
1210
 
                printk(KERN_DEBUG "%s: tulip_mwi_config()\n", pci_name(pdev));
 
1207
                netdev_dbg(dev, "tulip_mwi_config()\n");
1211
1208
 
1212
1209
        tp->csr0 = csr0 = 0;
1213
1210
 
1269
1266
out:
1270
1267
        tp->csr0 = csr0;
1271
1268
        if (tulip_debug > 2)
1272
 
                printk(KERN_DEBUG "%s: MWI config cacheline=%d, csr0=%08x\n",
1273
 
                       pci_name(pdev), cache, csr0);
 
1269
                netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n",
 
1270
                           cache, csr0);
1274
1271
}
1275
1272
#endif
1276
1273
 
1340
1337
         */
1341
1338
 
1342
1339
        if (pdev->subsystem_vendor == PCI_VENDOR_ID_LMC) {
1343
 
                pr_err(PFX "skipping LMC card\n");
 
1340
                pr_err("skipping LMC card\n");
1344
1341
                return -ENODEV;
1345
1342
        } else if (pdev->subsystem_vendor == PCI_VENDOR_ID_SBE &&
1346
1343
                   (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_T3E3 ||
1347
1344
                    pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P0 ||
1348
1345
                    pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)) {
1349
 
                pr_err(PFX "skipping SBE T3E3 port\n");
 
1346
                pr_err("skipping SBE T3E3 port\n");
1350
1347
                return -ENODEV;
1351
1348
        }
1352
1349
 
1362
1359
 
1363
1360
                if (pdev->vendor == 0x1282 && pdev->device == 0x9100 &&
1364
1361
                    pdev->revision < 0x30) {
1365
 
                        pr_info(PFX "skipping early DM9100 with Crc bug (use dmfe)\n");
 
1362
                        pr_info("skipping early DM9100 with Crc bug (use dmfe)\n");
1366
1363
                        return -ENODEV;
1367
1364
                }
1368
1365
 
1369
1366
                dp = pci_device_to_OF_node(pdev);
1370
1367
                if (!(dp && of_get_property(dp, "local-mac-address", NULL))) {
1371
 
                        pr_info(PFX "skipping DM910x expansion card (use dmfe)\n");
 
1368
                        pr_info("skipping DM910x expansion card (use dmfe)\n");
1372
1369
                        return -ENODEV;
1373
1370
                }
1374
1371
        }
1415
1412
 
1416
1413
        i = pci_enable_device(pdev);
1417
1414
        if (i) {
1418
 
                pr_err(PFX "Cannot enable tulip board #%d, aborting\n",
1419
 
                       board_idx);
 
1415
                pr_err("Cannot enable tulip board #%d, aborting\n", board_idx);
1420
1416
                return i;
1421
1417
        }
1422
1418
 
1423
1419
        /* The chip will fail to enter a low-power state later unless
1424
1420
         * first explicitly commanded into D0 */
1425
1421
        if (pci_set_power_state(pdev, PCI_D0)) {
1426
 
                printk (KERN_NOTICE PFX
1427
 
                        "Failed to set power state to D0\n");
 
1422
                pr_notice("Failed to set power state to D0\n");
1428
1423
        }
1429
1424
 
1430
1425
        irq = pdev->irq;
1432
1427
        /* alloc_etherdev ensures aligned and zeroed private structures */
1433
1428
        dev = alloc_etherdev (sizeof (*tp));
1434
1429
        if (!dev) {
1435
 
                pr_err(PFX "ether device alloc failed, aborting\n");
 
1430
                pr_err("ether device alloc failed, aborting\n");
1436
1431
                return -ENOMEM;
1437
1432
        }
1438
1433
 
1439
1434
        SET_NETDEV_DEV(dev, &pdev->dev);
1440
1435
        if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) {
1441
 
                pr_err(PFX "%s: I/O region (0x%llx@0x%llx) too small, aborting\n",
 
1436
                pr_err("%s: I/O region (0x%llx@0x%llx) too small, aborting\n",
1442
1437
                       pci_name(pdev),
1443
1438
                       (unsigned long long)pci_resource_len (pdev, 0),
1444
1439
                       (unsigned long long)pci_resource_start (pdev, 0));
1483
1478
                if (sig == 0x09811317) {
1484
1479
                        tp->flags |= COMET_PM;
1485
1480
                        tp->wolinfo.supported = WAKE_PHY | WAKE_MAGIC;
1486
 
                        printk(KERN_INFO "tulip_init_one: Enabled WOL support for AN983B\n");
 
1481
                        pr_info("%s: Enabled WOL support for AN983B\n",
 
1482
                                __func__);
1487
1483
                }
1488
1484
        }
1489
1485
        tp->pdev = pdev;
1879
1875
                tulip_set_wolopts(pdev, tp->wolinfo.wolopts);
1880
1876
                rc = pci_enable_wake(pdev, pstate, tp->wolinfo.wolopts);
1881
1877
                if (rc)
1882
 
                        printk("tulip: pci_enable_wake failed (%d)\n", rc);
 
1878
                        pr_err("pci_enable_wake failed (%d)\n", rc);
1883
1879
        }
1884
1880
        pci_set_power_state(pdev, pstate);
1885
1881
 
1905
1901
                return 0;
1906
1902
 
1907
1903
        if ((retval = pci_enable_device(pdev))) {
1908
 
                pr_err(PFX "pci_enable_device failed in resume\n");
 
1904
                pr_err("pci_enable_device failed in resume\n");
1909
1905
                return retval;
1910
1906
        }
1911
1907
 
1912
1908
        if ((retval = request_irq(dev->irq, tulip_interrupt, IRQF_SHARED, dev->name, dev))) {
1913
 
                pr_err(PFX "request_irq failed in resume\n");
 
1909
                pr_err("request_irq failed in resume\n");
1914
1910
                return retval;
1915
1911
        }
1916
1912