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

« back to all changes in this revision

Viewing changes to drivers/net/via-rhine.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:
29
29
 
30
30
*/
31
31
 
 
32
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
33
 
32
34
#define DRV_NAME        "via-rhine"
33
35
#define DRV_VERSION     "1.5.0"
34
36
#define DRV_RELDATE     "2010-10-09"
37
39
/* A few user-configurable values.
38
40
   These may be modified when a driver module is loaded. */
39
41
 
 
42
#define DEBUG
40
43
static int debug = 1;   /* 1 normal messages, 0 quiet .. 7 verbose. */
41
44
static int max_interrupt_work = 20;
42
45
 
111
114
 
112
115
/* These identify the driver base version and may not be removed. */
113
116
static const char version[] __devinitconst =
114
 
        KERN_INFO DRV_NAME ".c:v1.10-LK" DRV_VERSION " " DRV_RELDATE
115
 
        " Written by Donald Becker\n";
 
117
        "v1.10-LK" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker";
116
118
 
117
119
/* This driver was written to use PCI memory space. Some early versions
118
120
   of the Rhine may only work correctly with I/O space accesses. */
495
497
static void rhine_init_cam_filter(struct net_device *dev);
496
498
static void rhine_update_vcam(struct net_device *dev);
497
499
 
498
 
#define RHINE_WAIT_FOR(condition) do {                                  \
499
 
        int i=1024;                                                     \
500
 
        while (!(condition) && --i)                                     \
501
 
                ;                                                       \
502
 
        if (debug > 1 && i < 512)                                       \
503
 
                printk(KERN_INFO "%s: %4d cycles used @ %s:%d\n",       \
504
 
                                DRV_NAME, 1024-i, __func__, __LINE__);  \
505
 
} while(0)
 
500
#define RHINE_WAIT_FOR(condition)                               \
 
501
do {                                                            \
 
502
        int i = 1024;                                           \
 
503
        while (!(condition) && --i)                             \
 
504
                ;                                               \
 
505
        if (debug > 1 && i < 512)                               \
 
506
                pr_info("%4d cycles used @ %s:%d\n",            \
 
507
                        1024 - i, __func__, __LINE__);          \
 
508
} while (0)
506
509
 
507
510
static inline u32 get_intr_status(struct net_device *dev)
508
511
{
571
574
                        default:
572
575
                                reason = "Unknown";
573
576
                        }
574
 
                        printk(KERN_INFO "%s: Woke system up. Reason: %s.\n",
575
 
                               DRV_NAME, reason);
 
577
                        netdev_info(dev, "Woke system up. Reason: %s\n",
 
578
                                    reason);
576
579
                }
577
580
        }
578
581
}
586
589
        IOSYNC;
587
590
 
588
591
        if (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) {
589
 
                printk(KERN_INFO "%s: Reset not complete yet. "
590
 
                        "Trying harder.\n", DRV_NAME);
 
592
                netdev_info(dev, "Reset not complete yet. Trying harder.\n");
591
593
 
592
594
                /* Force reset */
593
595
                if (rp->quirks & rqForceReset)
598
600
        }
599
601
 
600
602
        if (debug > 1)
601
 
                printk(KERN_INFO "%s: Reset %s.\n", dev->name,
602
 
                        (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) ?
603
 
                        "failed" : "succeeded");
 
603
                netdev_info(dev, "Reset %s\n",
 
604
                            (ioread8(ioaddr + ChipCmd1) & Cmd1Reset) ?
 
605
                            "failed" : "succeeded");
604
606
}
605
607
 
606
608
#ifdef USE_MMIO
728
730
 
729
731
/* when built into the kernel, we only print version if device is found */
730
732
#ifndef MODULE
731
 
        static int printed_version;
732
 
        if (!printed_version++)
733
 
                printk(version);
 
733
        pr_info_once("%s\n", version);
734
734
#endif
735
735
 
736
736
        io_size = 256;
765
765
        /* this should always be supported */
766
766
        rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
767
767
        if (rc) {
768
 
                printk(KERN_ERR "32-bit PCI DMA addresses not supported by "
769
 
                       "the card!?\n");
 
768
                dev_err(&pdev->dev,
 
769
                        "32-bit PCI DMA addresses not supported by the card!?\n");
770
770
                goto err_out;
771
771
        }
772
772
 
774
774
        if ((pci_resource_len(pdev, 0) < io_size) ||
775
775
            (pci_resource_len(pdev, 1) < io_size)) {
776
776
                rc = -EIO;
777
 
                printk(KERN_ERR "Insufficient PCI resources, aborting\n");
 
777
                dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
778
778
                goto err_out;
779
779
        }
780
780
 
786
786
        dev = alloc_etherdev(sizeof(struct rhine_private));
787
787
        if (!dev) {
788
788
                rc = -ENOMEM;
789
 
                printk(KERN_ERR "alloc_etherdev failed\n");
 
789
                dev_err(&pdev->dev, "alloc_etherdev failed\n");
790
790
                goto err_out;
791
791
        }
792
792
        SET_NETDEV_DEV(dev, &pdev->dev);
804
804
        ioaddr = pci_iomap(pdev, bar, io_size);
805
805
        if (!ioaddr) {
806
806
                rc = -EIO;
807
 
                printk(KERN_ERR "ioremap failed for device %s, region 0x%X "
808
 
                       "@ 0x%lX\n", pci_name(pdev), io_size, memaddr);
 
807
                dev_err(&pdev->dev,
 
808
                        "ioremap failed for device %s, region 0x%X @ 0x%lX\n",
 
809
                        pci_name(pdev), io_size, memaddr);
809
810
                goto err_out_free_res;
810
811
        }
811
812
 
820
821
                unsigned char b = readb(ioaddr+reg);
821
822
                if (a != b) {
822
823
                        rc = -EIO;
823
 
                        printk(KERN_ERR "MMIO do not match PIO [%02x] "
824
 
                               "(%02x != %02x)\n", reg, a, b);
 
824
                        dev_err(&pdev->dev,
 
825
                                "MMIO do not match PIO [%02x] (%02x != %02x)\n",
 
826
                                reg, a, b);
825
827
                        goto err_out_unmap;
826
828
                }
827
829
        }
836
838
 
837
839
        for (i = 0; i < 6; i++)
838
840
                dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
 
841
 
 
842
        if (!is_valid_ether_addr(dev->dev_addr)) {
 
843
                /* Report it and use a random ethernet address instead */
 
844
                netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr);
 
845
                random_ether_addr(dev->dev_addr);
 
846
                netdev_info(dev, "Using random MAC address: %pM\n",
 
847
                            dev->dev_addr);
 
848
        }
839
849
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
840
850
 
841
 
        if (!is_valid_ether_addr(dev->perm_addr)) {
842
 
                rc = -EIO;
843
 
                printk(KERN_ERR "Invalid MAC address\n");
844
 
                goto err_out_unmap;
845
 
        }
846
 
 
847
851
        /* For Rhine-I/II, phy_id is loaded from EEPROM */
848
852
        if (!phy_id)
849
853
                phy_id = ioread8(ioaddr + 0x6C);
878
882
        if (rc)
879
883
                goto err_out_unmap;
880
884
 
881
 
        printk(KERN_INFO "%s: VIA %s at 0x%lx, %pM, IRQ %d.\n",
882
 
               dev->name, name,
 
885
        netdev_info(dev, "VIA %s at 0x%lx, %pM, IRQ %d\n",
 
886
                    name,
883
887
#ifdef USE_MMIO
884
 
               memaddr,
 
888
                    memaddr,
885
889
#else
886
 
               (long)ioaddr,
 
890
                    (long)ioaddr,
887
891
#endif
888
 
               dev->dev_addr, pdev->irq);
 
892
                    dev->dev_addr, pdev->irq);
889
893
 
890
894
        pci_set_drvdata(pdev, dev);
891
895
 
896
900
                mdio_write(dev, phy_id, MII_BMCR, mii_cmd);
897
901
                if (mii_status != 0xffff && mii_status != 0x0000) {
898
902
                        rp->mii_if.advertising = mdio_read(dev, phy_id, 4);
899
 
                        printk(KERN_INFO "%s: MII PHY found at address "
900
 
                               "%d, status 0x%4.4x advertising %4.4x "
901
 
                               "Link %4.4x.\n", dev->name, phy_id,
902
 
                               mii_status, rp->mii_if.advertising,
903
 
                               mdio_read(dev, phy_id, 5));
 
903
                        netdev_info(dev,
 
904
                                    "MII PHY found at address %d, status 0x%04x advertising %04x Link %04x\n",
 
905
                                    phy_id,
 
906
                                    mii_status, rp->mii_if.advertising,
 
907
                                    mdio_read(dev, phy_id, 5));
904
908
 
905
909
                        /* set IFF_RUNNING */
906
910
                        if (mii_status & BMSR_LSTATUS)
912
916
        }
913
917
        rp->mii_if.phy_id = phy_id;
914
918
        if (debug > 1 && avoid_D3)
915
 
                printk(KERN_INFO "%s: No D3 power state at shutdown.\n",
916
 
                       dev->name);
 
919
                netdev_info(dev, "No D3 power state at shutdown\n");
917
920
 
918
921
        return 0;
919
922
 
938
941
                                    TX_RING_SIZE * sizeof(struct tx_desc),
939
942
                                    &ring_dma);
940
943
        if (!ring) {
941
 
                printk(KERN_ERR "Could not allocate DMA memory.\n");
 
944
                netdev_err(dev, "Could not allocate DMA memory\n");
942
945
                return -ENOMEM;
943
946
        }
944
947
        if (rp->quirks & rqRhineI) {
1098
1101
            iowrite8(ioread8(ioaddr + ChipCmd1) & ~Cmd1FDuplex,
1099
1102
                   ioaddr + ChipCmd1);
1100
1103
        if (debug > 1)
1101
 
                printk(KERN_INFO "%s: force_media %d, carrier %d\n", dev->name,
1102
 
                        rp->mii_if.force_media, netif_carrier_ok(dev));
 
1104
                netdev_info(dev, "force_media %d, carrier %d\n",
 
1105
                            rp->mii_if.force_media, netif_carrier_ok(dev));
1103
1106
}
1104
1107
 
1105
1108
/* Called after status of force_media possibly changed */
1113
1116
        else    /* Let MMI library update carrier status */
1114
1117
                rhine_check_media(mii->dev, 0);
1115
1118
        if (debug > 1)
1116
 
                printk(KERN_INFO "%s: force_media %d, carrier %d\n",
1117
 
                       mii->dev->name, mii->force_media,
1118
 
                       netif_carrier_ok(mii->dev));
 
1119
                netdev_info(mii->dev, "force_media %d, carrier %d\n",
 
1120
                            mii->force_media, netif_carrier_ok(mii->dev));
1119
1121
}
1120
1122
 
1121
1123
/**
1402
1404
                return rc;
1403
1405
 
1404
1406
        if (debug > 1)
1405
 
                printk(KERN_DEBUG "%s: rhine_open() irq %d.\n",
1406
 
                       dev->name, rp->pdev->irq);
 
1407
                netdev_dbg(dev, "%s() irq %d\n", __func__, rp->pdev->irq);
1407
1408
 
1408
1409
        rc = alloc_ring(dev);
1409
1410
        if (rc) {
1415
1416
        rhine_chip_reset(dev);
1416
1417
        init_registers(dev);
1417
1418
        if (debug > 2)
1418
 
                printk(KERN_DEBUG "%s: Done rhine_open(), status %4.4x "
1419
 
                       "MII status: %4.4x.\n",
1420
 
                       dev->name, ioread16(ioaddr + ChipCmd),
1421
 
                       mdio_read(dev, rp->mii_if.phy_id, MII_BMSR));
 
1419
                netdev_dbg(dev, "%s() Done - status %04x MII status: %04x\n",
 
1420
                           __func__, ioread16(ioaddr + ChipCmd),
 
1421
                           mdio_read(dev, rp->mii_if.phy_id, MII_BMSR));
1422
1422
 
1423
1423
        netif_start_queue(dev);
1424
1424
 
1461
1461
        struct rhine_private *rp = netdev_priv(dev);
1462
1462
        void __iomem *ioaddr = rp->base;
1463
1463
 
1464
 
        printk(KERN_WARNING "%s: Transmit timed out, status %4.4x, PHY status "
1465
 
               "%4.4x, resetting...\n",
1466
 
               dev->name, ioread16(ioaddr + IntrStatus),
1467
 
               mdio_read(dev, rp->mii_if.phy_id, MII_BMSR));
 
1464
        netdev_warn(dev, "Transmit timed out, status %04x, PHY status %04x, resetting...\n",
 
1465
                    ioread16(ioaddr + IntrStatus),
 
1466
                    mdio_read(dev, rp->mii_if.phy_id, MII_BMSR));
1468
1467
 
1469
1468
        schedule_work(&rp->reset_task);
1470
1469
}
1551
1550
        spin_unlock_irqrestore(&rp->lock, flags);
1552
1551
 
1553
1552
        if (debug > 4) {
1554
 
                printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
1555
 
                       dev->name, rp->cur_tx-1, entry);
 
1553
                netdev_dbg(dev, "Transmit frame #%d queued in slot %d\n",
 
1554
                           rp->cur_tx-1, entry);
1556
1555
        }
1557
1556
        return NETDEV_TX_OK;
1558
1557
}
1578
1577
                IOSYNC;
1579
1578
 
1580
1579
                if (debug > 4)
1581
 
                        printk(KERN_DEBUG "%s: Interrupt, status %8.8x.\n",
1582
 
                               dev->name, intr_status);
 
1580
                        netdev_dbg(dev, "Interrupt, status %08x\n",
 
1581
                                   intr_status);
1583
1582
 
1584
1583
                if (intr_status & (IntrRxDone | IntrRxErr | IntrRxDropped |
1585
1584
                                   IntrRxWakeUp | IntrRxEmpty | IntrRxNoBuf)) {
1597
1596
                                RHINE_WAIT_FOR(!(ioread8(ioaddr+ChipCmd) & CmdTxOn));
1598
1597
                                if (debug > 2 &&
1599
1598
                                    ioread8(ioaddr+ChipCmd) & CmdTxOn)
1600
 
                                        printk(KERN_WARNING "%s: "
1601
 
                                               "rhine_interrupt() Tx engine "
1602
 
                                               "still on.\n", dev->name);
 
1599
                                        netdev_warn(dev,
 
1600
                                                    "%s: Tx engine still on\n",
 
1601
                                                    __func__);
1603
1602
                        }
1604
1603
                        rhine_tx(dev);
1605
1604
                }
1611
1610
                        rhine_error(dev, intr_status);
1612
1611
 
1613
1612
                if (--boguscnt < 0) {
1614
 
                        printk(KERN_WARNING "%s: Too much work at interrupt, "
1615
 
                               "status=%#8.8x.\n",
1616
 
                               dev->name, intr_status);
 
1613
                        netdev_warn(dev, "Too much work at interrupt, status=%#08x\n",
 
1614
                                    intr_status);
1617
1615
                        break;
1618
1616
                }
1619
1617
        }
1620
1618
 
1621
1619
        if (debug > 3)
1622
 
                printk(KERN_DEBUG "%s: exiting interrupt, status=%8.8x.\n",
1623
 
                       dev->name, ioread16(ioaddr + IntrStatus));
 
1620
                netdev_dbg(dev, "exiting interrupt, status=%08x\n",
 
1621
                           ioread16(ioaddr + IntrStatus));
1624
1622
        return IRQ_RETVAL(handled);
1625
1623
}
1626
1624
 
1637
1635
        while (rp->dirty_tx != rp->cur_tx) {
1638
1636
                txstatus = le32_to_cpu(rp->tx_ring[entry].tx_status);
1639
1637
                if (debug > 6)
1640
 
                        printk(KERN_DEBUG "Tx scavenge %d status %8.8x.\n",
1641
 
                               entry, txstatus);
 
1638
                        netdev_dbg(dev, "Tx scavenge %d status %08x\n",
 
1639
                                   entry, txstatus);
1642
1640
                if (txstatus & DescOwn)
1643
1641
                        break;
1644
1642
                if (txstatus & 0x8000) {
1645
1643
                        if (debug > 1)
1646
 
                                printk(KERN_DEBUG "%s: Transmit error, "
1647
 
                                       "Tx status %8.8x.\n",
1648
 
                                       dev->name, txstatus);
 
1644
                                netdev_dbg(dev, "Transmit error, Tx status %08x\n",
 
1645
                                           txstatus);
1649
1646
                        dev->stats.tx_errors++;
1650
1647
                        if (txstatus & 0x0400)
1651
1648
                                dev->stats.tx_carrier_errors++;
1668
1665
                        else
1669
1666
                                dev->stats.collisions += txstatus & 0x0F;
1670
1667
                        if (debug > 6)
1671
 
                                printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n",
1672
 
                                       (txstatus >> 3) & 0xF,
1673
 
                                       txstatus & 0xF);
 
1668
                                netdev_dbg(dev, "collisions: %1.1x:%1.1x\n",
 
1669
                                           (txstatus >> 3) & 0xF,
 
1670
                                           txstatus & 0xF);
1674
1671
                        dev->stats.tx_bytes += rp->tx_skbuff[entry]->len;
1675
1672
                        dev->stats.tx_packets++;
1676
1673
                }
1703
1700
static inline u16 rhine_get_vlan_tci(struct sk_buff *skb, int data_size)
1704
1701
{
1705
1702
        u8 *trailer = (u8 *)skb->data + ((data_size + 3) & ~3) + 2;
1706
 
        return ntohs(*(u16 *)trailer);
 
1703
        return be16_to_cpup((__be16 *)trailer);
1707
1704
}
1708
1705
 
1709
1706
/* Process up to limit frames from receive ring */
1714
1711
        int entry = rp->cur_rx % RX_RING_SIZE;
1715
1712
 
1716
1713
        if (debug > 4) {
1717
 
                printk(KERN_DEBUG "%s: rhine_rx(), entry %d status %8.8x.\n",
1718
 
                       dev->name, entry,
1719
 
                       le32_to_cpu(rp->rx_head_desc->rx_status));
 
1714
                netdev_dbg(dev, "%s(), entry %d status %08x\n",
 
1715
                           __func__, entry,
 
1716
                           le32_to_cpu(rp->rx_head_desc->rx_status));
1720
1717
        }
1721
1718
 
1722
1719
        /* If EOP is set on the next entry, it's a new packet. Send it up. */
1730
1727
                        break;
1731
1728
 
1732
1729
                if (debug > 4)
1733
 
                        printk(KERN_DEBUG "rhine_rx() status is %8.8x.\n",
1734
 
                               desc_status);
 
1730
                        netdev_dbg(dev, "%s() status is %08x\n",
 
1731
                                   __func__, desc_status);
1735
1732
 
1736
1733
                if ((desc_status & (RxWholePkt | RxErr)) != RxWholePkt) {
1737
1734
                        if ((desc_status & RxWholePkt) != RxWholePkt) {
1738
 
                                printk(KERN_WARNING "%s: Oversized Ethernet "
1739
 
                                       "frame spanned multiple buffers, entry "
1740
 
                                       "%#x length %d status %8.8x!\n",
1741
 
                                       dev->name, entry, data_size,
1742
 
                                       desc_status);
1743
 
                                printk(KERN_WARNING "%s: Oversized Ethernet "
1744
 
                                       "frame %p vs %p.\n", dev->name,
1745
 
                                       rp->rx_head_desc, &rp->rx_ring[entry]);
 
1735
                                netdev_warn(dev,
 
1736
        "Oversized Ethernet frame spanned multiple buffers, "
 
1737
        "entry %#x length %d status %08x!\n",
 
1738
                                            entry, data_size,
 
1739
                                            desc_status);
 
1740
                                netdev_warn(dev,
 
1741
                                            "Oversized Ethernet frame %p vs %p\n",
 
1742
                                            rp->rx_head_desc,
 
1743
                                            &rp->rx_ring[entry]);
1746
1744
                                dev->stats.rx_length_errors++;
1747
1745
                        } else if (desc_status & RxErr) {
1748
1746
                                /* There was a error. */
1749
1747
                                if (debug > 2)
1750
 
                                        printk(KERN_DEBUG "rhine_rx() Rx "
1751
 
                                               "error was %8.8x.\n",
1752
 
                                               desc_status);
 
1748
                                        netdev_dbg(dev, "%s() Rx error was %08x\n",
 
1749
                                                   __func__, desc_status);
1753
1750
                                dev->stats.rx_errors++;
1754
1751
                                if (desc_status & 0x0030)
1755
1752
                                        dev->stats.rx_length_errors++;
1791
1788
                        } else {
1792
1789
                                skb = rp->rx_skbuff[entry];
1793
1790
                                if (skb == NULL) {
1794
 
                                        printk(KERN_ERR "%s: Inconsistent Rx "
1795
 
                                               "descriptor chain.\n",
1796
 
                                               dev->name);
 
1791
                                        netdev_err(dev, "Inconsistent Rx descriptor chain\n");
1797
1792
                                        break;
1798
1793
                                }
1799
1794
                                rp->rx_skbuff[entry] = NULL;
1861
1856
        u32 intr_status;
1862
1857
 
1863
1858
        /*
1864
 
         * If new errors occured, we need to sort them out before doing Tx.
 
1859
         * If new errors occurred, we need to sort them out before doing Tx.
1865
1860
         * In that case the ISR will be back here RSN anyway.
1866
1861
         */
1867
1862
        intr_status = get_intr_status(dev);
1886
1881
        else {
1887
1882
                /* This should never happen */
1888
1883
                if (debug > 1)
1889
 
                        printk(KERN_WARNING "%s: rhine_restart_tx() "
1890
 
                               "Another error occured %8.8x.\n",
1891
 
                               dev->name, intr_status);
 
1884
                        netdev_warn(dev, "%s() Another error occurred %08x\n",
 
1885
                                   __func__, intr_status);
1892
1886
        }
1893
1887
 
1894
1888
}
1909
1903
        }
1910
1904
        if (intr_status & IntrTxAborted) {
1911
1905
                if (debug > 1)
1912
 
                        printk(KERN_INFO "%s: Abort %8.8x, frame dropped.\n",
1913
 
                               dev->name, intr_status);
 
1906
                        netdev_info(dev, "Abort %08x, frame dropped\n",
 
1907
                                    intr_status);
1914
1908
        }
1915
1909
        if (intr_status & IntrTxUnderrun) {
1916
1910
                if (rp->tx_thresh < 0xE0)
1917
1911
                        BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig);
1918
1912
                if (debug > 1)
1919
 
                        printk(KERN_INFO "%s: Transmitter underrun, Tx "
1920
 
                               "threshold now %2.2x.\n",
1921
 
                               dev->name, rp->tx_thresh);
 
1913
                        netdev_info(dev, "Transmitter underrun, Tx threshold now %02x\n",
 
1914
                                    rp->tx_thresh);
1922
1915
        }
1923
1916
        if (intr_status & IntrTxDescRace) {
1924
1917
                if (debug > 2)
1925
 
                        printk(KERN_INFO "%s: Tx descriptor write-back race.\n",
1926
 
                               dev->name);
 
1918
                        netdev_info(dev, "Tx descriptor write-back race\n");
1927
1919
        }
1928
1920
        if ((intr_status & IntrTxError) &&
1929
1921
            (intr_status & (IntrTxAborted |
1932
1924
                        BYTE_REG_BITS_SET((rp->tx_thresh += 0x20), 0x80, ioaddr + TxConfig);
1933
1925
                }
1934
1926
                if (debug > 1)
1935
 
                        printk(KERN_INFO "%s: Unspecified error. Tx "
1936
 
                               "threshold now %2.2x.\n",
1937
 
                               dev->name, rp->tx_thresh);
 
1927
                        netdev_info(dev, "Unspecified error. Tx threshold now %02x\n",
 
1928
                                    rp->tx_thresh);
1938
1929
        }
1939
1930
        if (intr_status & (IntrTxAborted | IntrTxUnderrun | IntrTxDescRace |
1940
1931
                           IntrTxError))
1944
1935
                            IntrTxError | IntrTxAborted | IntrNormalSummary |
1945
1936
                            IntrTxDescRace)) {
1946
1937
                if (debug > 1)
1947
 
                        printk(KERN_ERR "%s: Something Wicked happened! "
1948
 
                               "%8.8x.\n", dev->name, intr_status);
 
1938
                        netdev_err(dev, "Something Wicked happened! %08x\n",
 
1939
                                   intr_status);
1949
1940
        }
1950
1941
 
1951
1942
        spin_unlock(&rp->lock);
2145
2136
        spin_lock_irq(&rp->lock);
2146
2137
 
2147
2138
        if (debug > 1)
2148
 
                printk(KERN_DEBUG "%s: Shutting down ethercard, "
2149
 
                       "status was %4.4x.\n",
2150
 
                       dev->name, ioread16(ioaddr + ChipCmd));
 
2139
                netdev_dbg(dev, "Shutting down ethercard, status was %04x\n",
 
2140
                           ioread16(ioaddr + ChipCmd));
2151
2141
 
2152
2142
        /* Switch to loopback mode to avoid hardware races. */
2153
2143
        iowrite8(rp->tx_thresh | 0x02, ioaddr + TxConfig);
2265
2255
                return 0;
2266
2256
 
2267
2257
        if (request_irq(dev->irq, rhine_interrupt, IRQF_SHARED, dev->name, dev))
2268
 
                printk(KERN_ERR "via-rhine %s: request_irq failed\n", dev->name);
 
2258
                netdev_err(dev, "request_irq failed\n");
2269
2259
 
2270
2260
        ret = pci_set_power_state(pdev, PCI_D0);
2271
2261
        if (debug > 1)
2272
 
                printk(KERN_INFO "%s: Entering power state D0 %s (%d).\n",
2273
 
                        dev->name, ret ? "failed" : "succeeded", ret);
 
2262
                netdev_info(dev, "Entering power state D0 %s (%d)\n",
 
2263
                            ret ? "failed" : "succeeded", ret);
2274
2264
 
2275
2265
        pci_restore_state(pdev);
2276
2266
 
2326
2316
{
2327
2317
/* when a module, this is printed whether or not devices are found in probe */
2328
2318
#ifdef MODULE
2329
 
        printk(version);
 
2319
        pr_info("%s\n", version);
2330
2320
#endif
2331
2321
        if (dmi_check_system(rhine_dmi_table)) {
2332
2322
                /* these BIOSes fail at PXE boot if chip is in D3 */
2333
2323
                avoid_D3 = 1;
2334
 
                printk(KERN_WARNING "%s: Broken BIOS detected, avoid_D3 "
2335
 
                                    "enabled.\n",
2336
 
                       DRV_NAME);
 
2324
                pr_warn("Broken BIOS detected, avoid_D3 enabled\n");
2337
2325
        }
2338
2326
        else if (avoid_D3)
2339
 
                printk(KERN_INFO "%s: avoid_D3 set.\n", DRV_NAME);
 
2327
                pr_info("avoid_D3 set\n");
2340
2328
 
2341
2329
        return pci_register_driver(&rhine_driver);
2342
2330
}