diff options
Diffstat (limited to 'drivers/net/sis190.c')
-rw-r--r-- | drivers/net/sis190.c | 225 |
1 files changed, 127 insertions, 98 deletions
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 7cc9898f4e00..b30ce752bbf3 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -17,7 +17,9 @@ | |||
17 | 17 | ||
18 | See the file COPYING in this distribution for more information. | 18 | See the file COPYING in this distribution for more information. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | |||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | 23 | ||
22 | #include <linux/module.h> | 24 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 25 | #include <linux/moduleparam.h> |
@@ -30,27 +32,16 @@ | |||
30 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
31 | #include <linux/crc32.h> | 33 | #include <linux/crc32.h> |
32 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/slab.h> | ||
33 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
34 | 37 | ||
35 | #define net_drv(p, arg...) if (netif_msg_drv(p)) \ | ||
36 | printk(arg) | ||
37 | #define net_probe(p, arg...) if (netif_msg_probe(p)) \ | ||
38 | printk(arg) | ||
39 | #define net_link(p, arg...) if (netif_msg_link(p)) \ | ||
40 | printk(arg) | ||
41 | #define net_intr(p, arg...) if (netif_msg_intr(p)) \ | ||
42 | printk(arg) | ||
43 | #define net_tx_err(p, arg...) if (netif_msg_tx_err(p)) \ | ||
44 | printk(arg) | ||
45 | |||
46 | #define PHY_MAX_ADDR 32 | 38 | #define PHY_MAX_ADDR 32 |
47 | #define PHY_ID_ANY 0x1f | 39 | #define PHY_ID_ANY 0x1f |
48 | #define MII_REG_ANY 0x1f | 40 | #define MII_REG_ANY 0x1f |
49 | 41 | ||
50 | #define DRV_VERSION "1.3" | 42 | #define DRV_VERSION "1.4" |
51 | #define DRV_NAME "sis190" | 43 | #define DRV_NAME "sis190" |
52 | #define SIS190_DRIVER_NAME DRV_NAME " Gigabit Ethernet driver " DRV_VERSION | 44 | #define SIS190_DRIVER_NAME DRV_NAME " Gigabit Ethernet driver " DRV_VERSION |
53 | #define PFX DRV_NAME ": " | ||
54 | 45 | ||
55 | #define sis190_rx_skb netif_rx | 46 | #define sis190_rx_skb netif_rx |
56 | #define sis190_rx_quota(count, quota) count | 47 | #define sis190_rx_quota(count, quota) count |
@@ -294,6 +285,12 @@ struct sis190_private { | |||
294 | struct mii_if_info mii_if; | 285 | struct mii_if_info mii_if; |
295 | struct list_head first_phy; | 286 | struct list_head first_phy; |
296 | u32 features; | 287 | u32 features; |
288 | u32 negotiated_lpa; | ||
289 | enum { | ||
290 | LNK_OFF, | ||
291 | LNK_ON, | ||
292 | LNK_AUTONEG, | ||
293 | } link_status; | ||
297 | }; | 294 | }; |
298 | 295 | ||
299 | struct sis190_phy { | 296 | struct sis190_phy { |
@@ -334,7 +331,7 @@ static const struct { | |||
334 | { "SiS 191 PCI Gigabit Ethernet adapter" }, | 331 | { "SiS 191 PCI Gigabit Ethernet adapter" }, |
335 | }; | 332 | }; |
336 | 333 | ||
337 | static struct pci_device_id sis190_pci_tbl[] = { | 334 | static DEFINE_PCI_DEVICE_TABLE(sis190_pci_tbl) = { |
338 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0190), 0, 0, 0 }, | 335 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0190), 0, 0, 0 }, |
339 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0191), 0, 0, 1 }, | 336 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x0191), 0, 0, 1 }, |
340 | { 0, }, | 337 | { 0, }, |
@@ -381,7 +378,7 @@ static void __mdio_cmd(void __iomem *ioaddr, u32 ctl) | |||
381 | } | 378 | } |
382 | 379 | ||
383 | if (i > 99) | 380 | if (i > 99) |
384 | printk(KERN_ERR PFX "PHY command failed !\n"); | 381 | pr_err("PHY command failed !\n"); |
385 | } | 382 | } |
386 | 383 | ||
387 | static void mdio_write(void __iomem *ioaddr, int phy_id, int reg, int val) | 384 | static void mdio_write(void __iomem *ioaddr, int phy_id, int reg, int val) |
@@ -493,18 +490,24 @@ static struct sk_buff *sis190_alloc_rx_skb(struct sis190_private *tp, | |||
493 | { | 490 | { |
494 | u32 rx_buf_sz = tp->rx_buf_sz; | 491 | u32 rx_buf_sz = tp->rx_buf_sz; |
495 | struct sk_buff *skb; | 492 | struct sk_buff *skb; |
493 | dma_addr_t mapping; | ||
496 | 494 | ||
497 | skb = netdev_alloc_skb(tp->dev, rx_buf_sz); | 495 | skb = netdev_alloc_skb(tp->dev, rx_buf_sz); |
498 | if (likely(skb)) { | 496 | if (unlikely(!skb)) |
499 | dma_addr_t mapping; | 497 | goto skb_alloc_failed; |
500 | 498 | mapping = pci_map_single(tp->pci_dev, skb->data, tp->rx_buf_sz, | |
501 | mapping = pci_map_single(tp->pci_dev, skb->data, tp->rx_buf_sz, | 499 | PCI_DMA_FROMDEVICE); |
502 | PCI_DMA_FROMDEVICE); | 500 | if (pci_dma_mapping_error(tp->pci_dev, mapping)) |
503 | sis190_map_to_asic(desc, mapping, rx_buf_sz); | 501 | goto out; |
504 | } else | 502 | sis190_map_to_asic(desc, mapping, rx_buf_sz); |
505 | sis190_make_unusable_by_asic(desc); | ||
506 | 503 | ||
507 | return skb; | 504 | return skb; |
505 | |||
506 | out: | ||
507 | dev_kfree_skb_any(skb); | ||
508 | skb_alloc_failed: | ||
509 | sis190_make_unusable_by_asic(desc); | ||
510 | return NULL; | ||
508 | } | 511 | } |
509 | 512 | ||
510 | static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, | 513 | static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, |
@@ -536,13 +539,12 @@ static bool sis190_try_rx_copy(struct sis190_private *tp, | |||
536 | if (pkt_size >= rx_copybreak) | 539 | if (pkt_size >= rx_copybreak) |
537 | goto out; | 540 | goto out; |
538 | 541 | ||
539 | skb = netdev_alloc_skb(tp->dev, pkt_size + 2); | 542 | skb = netdev_alloc_skb_ip_align(tp->dev, pkt_size); |
540 | if (!skb) | 543 | if (!skb) |
541 | goto out; | 544 | goto out; |
542 | 545 | ||
543 | pci_dma_sync_single_for_cpu(tp->pci_dev, addr, tp->rx_buf_sz, | 546 | pci_dma_sync_single_for_cpu(tp->pci_dev, addr, tp->rx_buf_sz, |
544 | PCI_DMA_FROMDEVICE); | 547 | PCI_DMA_FROMDEVICE); |
545 | skb_reserve(skb, 2); | ||
546 | skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size); | 548 | skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size); |
547 | *sk_buff = skb; | 549 | *sk_buff = skb; |
548 | done = true; | 550 | done = true; |
@@ -590,8 +592,7 @@ static int sis190_rx_interrupt(struct net_device *dev, | |||
590 | 592 | ||
591 | status = le32_to_cpu(desc->PSize); | 593 | status = le32_to_cpu(desc->PSize); |
592 | 594 | ||
593 | // net_intr(tp, KERN_INFO "%s: Rx PSize = %08x.\n", dev->name, | 595 | //netif_info(tp, intr, dev, "Rx PSize = %08x\n", status); |
594 | // status); | ||
595 | 596 | ||
596 | if (sis190_rx_pkt_err(status, stats) < 0) | 597 | if (sis190_rx_pkt_err(status, stats) < 0) |
597 | sis190_give_to_asic(desc, tp->rx_buf_sz); | 598 | sis190_give_to_asic(desc, tp->rx_buf_sz); |
@@ -602,9 +603,8 @@ static int sis190_rx_interrupt(struct net_device *dev, | |||
602 | struct pci_dev *pdev = tp->pci_dev; | 603 | struct pci_dev *pdev = tp->pci_dev; |
603 | 604 | ||
604 | if (unlikely(pkt_size > tp->rx_buf_sz)) { | 605 | if (unlikely(pkt_size > tp->rx_buf_sz)) { |
605 | net_intr(tp, KERN_INFO | 606 | netif_info(tp, intr, dev, |
606 | "%s: (frag) status = %08x.\n", | 607 | "(frag) status = %08x\n", status); |
607 | dev->name, status); | ||
608 | stats->rx_dropped++; | 608 | stats->rx_dropped++; |
609 | stats->rx_length_errors++; | 609 | stats->rx_length_errors++; |
610 | sis190_give_to_asic(desc, tp->rx_buf_sz); | 610 | sis190_give_to_asic(desc, tp->rx_buf_sz); |
@@ -638,12 +638,12 @@ static int sis190_rx_interrupt(struct net_device *dev, | |||
638 | tp->cur_rx = cur_rx; | 638 | tp->cur_rx = cur_rx; |
639 | 639 | ||
640 | delta = sis190_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); | 640 | delta = sis190_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); |
641 | if (!delta && count && netif_msg_intr(tp)) | 641 | if (!delta && count) |
642 | printk(KERN_INFO "%s: no Rx buffer allocated.\n", dev->name); | 642 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); |
643 | tp->dirty_rx += delta; | 643 | tp->dirty_rx += delta; |
644 | 644 | ||
645 | if (((tp->dirty_rx + NUM_RX_DESC) == tp->cur_rx) && netif_msg_intr(tp)) | 645 | if ((tp->dirty_rx + NUM_RX_DESC) == tp->cur_rx) |
646 | printk(KERN_EMERG "%s: Rx buffers exhausted.\n", dev->name); | 646 | netif_emerg(tp, intr, dev, "Rx buffers exhausted\n"); |
647 | 647 | ||
648 | return count; | 648 | return count; |
649 | } | 649 | } |
@@ -752,10 +752,11 @@ static irqreturn_t sis190_interrupt(int irq, void *__dev) | |||
752 | 752 | ||
753 | SIS_W32(IntrStatus, status); | 753 | SIS_W32(IntrStatus, status); |
754 | 754 | ||
755 | // net_intr(tp, KERN_INFO "%s: status = %08x.\n", dev->name, status); | 755 | // netif_info(tp, intr, dev, "status = %08x\n", status); |
756 | 756 | ||
757 | if (status & LinkChange) { | 757 | if (status & LinkChange) { |
758 | net_intr(tp, KERN_INFO "%s: link change.\n", dev->name); | 758 | netif_info(tp, intr, dev, "link change\n"); |
759 | del_timer(&tp->timer); | ||
759 | schedule_work(&tp->phy_task); | 760 | schedule_work(&tp->phy_task); |
760 | } | 761 | } |
761 | 762 | ||
@@ -842,19 +843,17 @@ static void sis190_set_rx_mode(struct net_device *dev) | |||
842 | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | | 843 | AcceptBroadcast | AcceptMulticast | AcceptMyPhys | |
843 | AcceptAllPhys; | 844 | AcceptAllPhys; |
844 | mc_filter[1] = mc_filter[0] = 0xffffffff; | 845 | mc_filter[1] = mc_filter[0] = 0xffffffff; |
845 | } else if ((dev->mc_count > multicast_filter_limit) || | 846 | } else if ((netdev_mc_count(dev) > multicast_filter_limit) || |
846 | (dev->flags & IFF_ALLMULTI)) { | 847 | (dev->flags & IFF_ALLMULTI)) { |
847 | /* Too many to filter perfectly -- accept all multicasts. */ | 848 | /* Too many to filter perfectly -- accept all multicasts. */ |
848 | rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; | 849 | rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; |
849 | mc_filter[1] = mc_filter[0] = 0xffffffff; | 850 | mc_filter[1] = mc_filter[0] = 0xffffffff; |
850 | } else { | 851 | } else { |
851 | struct dev_mc_list *mclist; | 852 | struct dev_mc_list *mclist; |
852 | unsigned int i; | ||
853 | 853 | ||
854 | rx_mode = AcceptBroadcast | AcceptMyPhys; | 854 | rx_mode = AcceptBroadcast | AcceptMyPhys; |
855 | mc_filter[1] = mc_filter[0] = 0; | 855 | mc_filter[1] = mc_filter[0] = 0; |
856 | for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; | 856 | netdev_for_each_mc_addr(mclist, dev) { |
857 | i++, mclist = mclist->next) { | ||
858 | int bit_nr = | 857 | int bit_nr = |
859 | ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3f; | 858 | ether_crc(ETH_ALEN, mclist->dmi_addr) & 0x3f; |
860 | mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); | 859 | mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31); |
@@ -930,13 +929,15 @@ static void sis190_phy_task(struct work_struct *work) | |||
930 | if (val & BMCR_RESET) { | 929 | if (val & BMCR_RESET) { |
931 | // FIXME: needlessly high ? -- FR 02/07/2005 | 930 | // FIXME: needlessly high ? -- FR 02/07/2005 |
932 | mod_timer(&tp->timer, jiffies + HZ/10); | 931 | mod_timer(&tp->timer, jiffies + HZ/10); |
933 | } else if (!(mdio_read_latched(ioaddr, phy_id, MII_BMSR) & | 932 | goto out_unlock; |
934 | BMSR_ANEGCOMPLETE)) { | 933 | } |
934 | |||
935 | val = mdio_read_latched(ioaddr, phy_id, MII_BMSR); | ||
936 | if (!(val & BMSR_ANEGCOMPLETE) && tp->link_status != LNK_AUTONEG) { | ||
935 | netif_carrier_off(dev); | 937 | netif_carrier_off(dev); |
936 | net_link(tp, KERN_WARNING "%s: auto-negotiating...\n", | 938 | netif_warn(tp, link, dev, "auto-negotiating...\n"); |
937 | dev->name); | 939 | tp->link_status = LNK_AUTONEG; |
938 | mod_timer(&tp->timer, jiffies + SIS190_PHY_TIMEOUT); | 940 | } else if ((val & BMSR_LSTATUS) && tp->link_status != LNK_ON) { |
939 | } else { | ||
940 | /* Rejoice ! */ | 941 | /* Rejoice ! */ |
941 | struct { | 942 | struct { |
942 | int val; | 943 | int val; |
@@ -960,13 +961,13 @@ static void sis190_phy_task(struct work_struct *work) | |||
960 | u16 adv, autoexp, gigadv, gigrec; | 961 | u16 adv, autoexp, gigadv, gigrec; |
961 | 962 | ||
962 | val = mdio_read(ioaddr, phy_id, 0x1f); | 963 | val = mdio_read(ioaddr, phy_id, 0x1f); |
963 | net_link(tp, KERN_INFO "%s: mii ext = %04x.\n", dev->name, val); | 964 | netif_info(tp, link, dev, "mii ext = %04x\n", val); |
964 | 965 | ||
965 | val = mdio_read(ioaddr, phy_id, MII_LPA); | 966 | val = mdio_read(ioaddr, phy_id, MII_LPA); |
966 | adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE); | 967 | adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE); |
967 | autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION); | 968 | autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION); |
968 | net_link(tp, KERN_INFO "%s: mii lpa=%04x adv=%04x exp=%04x.\n", | 969 | netif_info(tp, link, dev, "mii lpa=%04x adv=%04x exp=%04x\n", |
969 | dev->name, val, adv, autoexp); | 970 | val, adv, autoexp); |
970 | 971 | ||
971 | if (val & LPA_NPAGE && autoexp & EXPANSION_NWAY) { | 972 | if (val & LPA_NPAGE && autoexp & EXPANSION_NWAY) { |
972 | /* check for gigabit speed */ | 973 | /* check for gigabit speed */ |
@@ -1005,10 +1006,14 @@ static void sis190_phy_task(struct work_struct *work) | |||
1005 | SIS_W32(RGDelay, 0x0440); | 1006 | SIS_W32(RGDelay, 0x0440); |
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | net_link(tp, KERN_INFO "%s: link on %s mode.\n", dev->name, | 1009 | tp->negotiated_lpa = p->val; |
1009 | p->msg); | 1010 | |
1011 | netif_info(tp, link, dev, "link on %s mode\n", p->msg); | ||
1010 | netif_carrier_on(dev); | 1012 | netif_carrier_on(dev); |
1011 | } | 1013 | tp->link_status = LNK_ON; |
1014 | } else if (!(val & BMSR_LSTATUS) && tp->link_status != LNK_AUTONEG) | ||
1015 | tp->link_status = LNK_OFF; | ||
1016 | mod_timer(&tp->timer, jiffies + SIS190_PHY_TIMEOUT); | ||
1012 | 1017 | ||
1013 | out_unlock: | 1018 | out_unlock: |
1014 | rtnl_unlock(); | 1019 | rtnl_unlock(); |
@@ -1192,13 +1197,17 @@ static netdev_tx_t sis190_start_xmit(struct sk_buff *skb, | |||
1192 | 1197 | ||
1193 | if (unlikely(le32_to_cpu(desc->status) & OWNbit)) { | 1198 | if (unlikely(le32_to_cpu(desc->status) & OWNbit)) { |
1194 | netif_stop_queue(dev); | 1199 | netif_stop_queue(dev); |
1195 | net_tx_err(tp, KERN_ERR PFX | 1200 | netif_err(tp, tx_err, dev, |
1196 | "%s: BUG! Tx Ring full when queue awake!\n", | 1201 | "BUG! Tx Ring full when queue awake!\n"); |
1197 | dev->name); | ||
1198 | return NETDEV_TX_BUSY; | 1202 | return NETDEV_TX_BUSY; |
1199 | } | 1203 | } |
1200 | 1204 | ||
1201 | mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); | 1205 | mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); |
1206 | if (pci_dma_mapping_error(tp->pci_dev, mapping)) { | ||
1207 | netif_err(tp, tx_err, dev, | ||
1208 | "PCI mapping failed, dropping packet"); | ||
1209 | return NETDEV_TX_BUSY; | ||
1210 | } | ||
1202 | 1211 | ||
1203 | tp->Tx_skbuff[entry] = skb; | 1212 | tp->Tx_skbuff[entry] = skb; |
1204 | 1213 | ||
@@ -1212,6 +1221,12 @@ static netdev_tx_t sis190_start_xmit(struct sk_buff *skb, | |||
1212 | wmb(); | 1221 | wmb(); |
1213 | 1222 | ||
1214 | desc->status = cpu_to_le32(OWNbit | INTbit | DEFbit | CRCbit | PADbit); | 1223 | desc->status = cpu_to_le32(OWNbit | INTbit | DEFbit | CRCbit | PADbit); |
1224 | if (tp->negotiated_lpa & (LPA_1000HALF | LPA_100HALF | LPA_10HALF)) { | ||
1225 | /* Half Duplex */ | ||
1226 | desc->status |= cpu_to_le32(COLEN | CRSEN | BKFEN); | ||
1227 | if (tp->negotiated_lpa & (LPA_1000HALF | LPA_1000FULL)) | ||
1228 | desc->status |= cpu_to_le32(EXTEN | BSTEN); /* gigabit HD */ | ||
1229 | } | ||
1215 | 1230 | ||
1216 | tp->cur_tx++; | 1231 | tp->cur_tx++; |
1217 | 1232 | ||
@@ -1288,9 +1303,9 @@ static u16 sis190_default_phy(struct net_device *dev) | |||
1288 | 1303 | ||
1289 | if (mii_if->phy_id != phy_default->phy_id) { | 1304 | if (mii_if->phy_id != phy_default->phy_id) { |
1290 | mii_if->phy_id = phy_default->phy_id; | 1305 | mii_if->phy_id = phy_default->phy_id; |
1291 | net_probe(tp, KERN_INFO | 1306 | if (netif_msg_probe(tp)) |
1292 | "%s: Using transceiver at address %d as default.\n", | 1307 | pr_info("%s: Using transceiver at address %d as default\n", |
1293 | pci_name(tp->pci_dev), mii_if->phy_id); | 1308 | pci_name(tp->pci_dev), mii_if->phy_id); |
1294 | } | 1309 | } |
1295 | 1310 | ||
1296 | status = mdio_read(ioaddr, mii_if->phy_id, MII_BMCR); | 1311 | status = mdio_read(ioaddr, mii_if->phy_id, MII_BMCR); |
@@ -1328,14 +1343,15 @@ static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp, | |||
1328 | ((mii_status & (BMSR_100FULL | BMSR_100HALF)) ? | 1343 | ((mii_status & (BMSR_100FULL | BMSR_100HALF)) ? |
1329 | LAN : HOME) : p->type; | 1344 | LAN : HOME) : p->type; |
1330 | tp->features |= p->feature; | 1345 | tp->features |= p->feature; |
1331 | net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n", | 1346 | if (netif_msg_probe(tp)) |
1332 | pci_name(tp->pci_dev), p->name, phy_id); | 1347 | pr_info("%s: %s transceiver at address %d\n", |
1348 | pci_name(tp->pci_dev), p->name, phy_id); | ||
1333 | } else { | 1349 | } else { |
1334 | phy->type = UNKNOWN; | 1350 | phy->type = UNKNOWN; |
1335 | net_probe(tp, KERN_INFO | 1351 | if (netif_msg_probe(tp)) |
1336 | "%s: unknown PHY 0x%x:0x%x transceiver at address %d\n", | 1352 | pr_info("%s: unknown PHY 0x%x:0x%x transceiver at address %d\n", |
1337 | pci_name(tp->pci_dev), | 1353 | pci_name(tp->pci_dev), |
1338 | phy->id[0], (phy->id[1] & 0xfff0), phy_id); | 1354 | phy->id[0], (phy->id[1] & 0xfff0), phy_id); |
1339 | } | 1355 | } |
1340 | } | 1356 | } |
1341 | 1357 | ||
@@ -1399,8 +1415,9 @@ static int __devinit sis190_mii_probe(struct net_device *dev) | |||
1399 | } | 1415 | } |
1400 | 1416 | ||
1401 | if (list_empty(&tp->first_phy)) { | 1417 | if (list_empty(&tp->first_phy)) { |
1402 | net_probe(tp, KERN_INFO "%s: No MII transceivers found!\n", | 1418 | if (netif_msg_probe(tp)) |
1403 | pci_name(tp->pci_dev)); | 1419 | pr_info("%s: No MII transceivers found!\n", |
1420 | pci_name(tp->pci_dev)); | ||
1404 | rc = -EIO; | 1421 | rc = -EIO; |
1405 | goto out; | 1422 | goto out; |
1406 | } | 1423 | } |
@@ -1446,7 +1463,8 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) | |||
1446 | 1463 | ||
1447 | dev = alloc_etherdev(sizeof(*tp)); | 1464 | dev = alloc_etherdev(sizeof(*tp)); |
1448 | if (!dev) { | 1465 | if (!dev) { |
1449 | net_drv(&debug, KERN_ERR PFX "unable to alloc new ethernet\n"); | 1466 | if (netif_msg_drv(&debug)) |
1467 | pr_err("unable to alloc new ethernet\n"); | ||
1450 | rc = -ENOMEM; | 1468 | rc = -ENOMEM; |
1451 | goto err_out_0; | 1469 | goto err_out_0; |
1452 | } | 1470 | } |
@@ -1459,34 +1477,39 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) | |||
1459 | 1477 | ||
1460 | rc = pci_enable_device(pdev); | 1478 | rc = pci_enable_device(pdev); |
1461 | if (rc < 0) { | 1479 | if (rc < 0) { |
1462 | net_probe(tp, KERN_ERR "%s: enable failure\n", pci_name(pdev)); | 1480 | if (netif_msg_probe(tp)) |
1481 | pr_err("%s: enable failure\n", pci_name(pdev)); | ||
1463 | goto err_free_dev_1; | 1482 | goto err_free_dev_1; |
1464 | } | 1483 | } |
1465 | 1484 | ||
1466 | rc = -ENODEV; | 1485 | rc = -ENODEV; |
1467 | 1486 | ||
1468 | if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { | 1487 | if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { |
1469 | net_probe(tp, KERN_ERR "%s: region #0 is no MMIO resource.\n", | 1488 | if (netif_msg_probe(tp)) |
1470 | pci_name(pdev)); | 1489 | pr_err("%s: region #0 is no MMIO resource\n", |
1490 | pci_name(pdev)); | ||
1471 | goto err_pci_disable_2; | 1491 | goto err_pci_disable_2; |
1472 | } | 1492 | } |
1473 | if (pci_resource_len(pdev, 0) < SIS190_REGS_SIZE) { | 1493 | if (pci_resource_len(pdev, 0) < SIS190_REGS_SIZE) { |
1474 | net_probe(tp, KERN_ERR "%s: invalid PCI region size(s).\n", | 1494 | if (netif_msg_probe(tp)) |
1475 | pci_name(pdev)); | 1495 | pr_err("%s: invalid PCI region size(s)\n", |
1496 | pci_name(pdev)); | ||
1476 | goto err_pci_disable_2; | 1497 | goto err_pci_disable_2; |
1477 | } | 1498 | } |
1478 | 1499 | ||
1479 | rc = pci_request_regions(pdev, DRV_NAME); | 1500 | rc = pci_request_regions(pdev, DRV_NAME); |
1480 | if (rc < 0) { | 1501 | if (rc < 0) { |
1481 | net_probe(tp, KERN_ERR PFX "%s: could not request regions.\n", | 1502 | if (netif_msg_probe(tp)) |
1482 | pci_name(pdev)); | 1503 | pr_err("%s: could not request regions\n", |
1504 | pci_name(pdev)); | ||
1483 | goto err_pci_disable_2; | 1505 | goto err_pci_disable_2; |
1484 | } | 1506 | } |
1485 | 1507 | ||
1486 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 1508 | rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
1487 | if (rc < 0) { | 1509 | if (rc < 0) { |
1488 | net_probe(tp, KERN_ERR "%s: DMA configuration failed.\n", | 1510 | if (netif_msg_probe(tp)) |
1489 | pci_name(pdev)); | 1511 | pr_err("%s: DMA configuration failed\n", |
1512 | pci_name(pdev)); | ||
1490 | goto err_free_res_3; | 1513 | goto err_free_res_3; |
1491 | } | 1514 | } |
1492 | 1515 | ||
@@ -1494,14 +1517,16 @@ static struct net_device * __devinit sis190_init_board(struct pci_dev *pdev) | |||
1494 | 1517 | ||
1495 | ioaddr = ioremap(pci_resource_start(pdev, 0), SIS190_REGS_SIZE); | 1518 | ioaddr = ioremap(pci_resource_start(pdev, 0), SIS190_REGS_SIZE); |
1496 | if (!ioaddr) { | 1519 | if (!ioaddr) { |
1497 | net_probe(tp, KERN_ERR "%s: cannot remap MMIO, aborting\n", | 1520 | if (netif_msg_probe(tp)) |
1498 | pci_name(pdev)); | 1521 | pr_err("%s: cannot remap MMIO, aborting\n", |
1522 | pci_name(pdev)); | ||
1499 | rc = -EIO; | 1523 | rc = -EIO; |
1500 | goto err_free_res_3; | 1524 | goto err_free_res_3; |
1501 | } | 1525 | } |
1502 | 1526 | ||
1503 | tp->pci_dev = pdev; | 1527 | tp->pci_dev = pdev; |
1504 | tp->mmio_addr = ioaddr; | 1528 | tp->mmio_addr = ioaddr; |
1529 | tp->link_status = LNK_OFF; | ||
1505 | 1530 | ||
1506 | sis190_irq_mask_and_ack(ioaddr); | 1531 | sis190_irq_mask_and_ack(ioaddr); |
1507 | 1532 | ||
@@ -1531,9 +1556,8 @@ static void sis190_tx_timeout(struct net_device *dev) | |||
1531 | if (tmp8 & CmdTxEnb) | 1556 | if (tmp8 & CmdTxEnb) |
1532 | SIS_W8(TxControl, tmp8 & ~CmdTxEnb); | 1557 | SIS_W8(TxControl, tmp8 & ~CmdTxEnb); |
1533 | 1558 | ||
1534 | 1559 | netif_info(tp, tx_err, dev, "Transmit timeout, status %08x %08x\n", | |
1535 | net_tx_err(tp, KERN_INFO "%s: Transmit timeout, status %08x %08x.\n", | 1560 | SIS_R32(TxControl), SIS_R32(TxSts)); |
1536 | dev->name, SIS_R32(TxControl), SIS_R32(TxSts)); | ||
1537 | 1561 | ||
1538 | /* Disable interrupts by clearing the interrupt mask. */ | 1562 | /* Disable interrupts by clearing the interrupt mask. */ |
1539 | SIS_W32(IntrMask, 0x0000); | 1563 | SIS_W32(IntrMask, 0x0000); |
@@ -1562,15 +1586,16 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev, | |||
1562 | u16 sig; | 1586 | u16 sig; |
1563 | int i; | 1587 | int i; |
1564 | 1588 | ||
1565 | net_probe(tp, KERN_INFO "%s: Read MAC address from EEPROM\n", | 1589 | if (netif_msg_probe(tp)) |
1566 | pci_name(pdev)); | 1590 | pr_info("%s: Read MAC address from EEPROM\n", pci_name(pdev)); |
1567 | 1591 | ||
1568 | /* Check to see if there is a sane EEPROM */ | 1592 | /* Check to see if there is a sane EEPROM */ |
1569 | sig = (u16) sis190_read_eeprom(ioaddr, EEPROMSignature); | 1593 | sig = (u16) sis190_read_eeprom(ioaddr, EEPROMSignature); |
1570 | 1594 | ||
1571 | if ((sig == 0xffff) || (sig == 0x0000)) { | 1595 | if ((sig == 0xffff) || (sig == 0x0000)) { |
1572 | net_probe(tp, KERN_INFO "%s: Error EEPROM read %x.\n", | 1596 | if (netif_msg_probe(tp)) |
1573 | pci_name(pdev), sig); | 1597 | pr_info("%s: Error EEPROM read %x\n", |
1598 | pci_name(pdev), sig); | ||
1574 | return -EIO; | 1599 | return -EIO; |
1575 | } | 1600 | } |
1576 | 1601 | ||
@@ -1604,8 +1629,8 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, | |||
1604 | u8 reg, tmp8; | 1629 | u8 reg, tmp8; |
1605 | unsigned int i; | 1630 | unsigned int i; |
1606 | 1631 | ||
1607 | net_probe(tp, KERN_INFO "%s: Read MAC address from APC.\n", | 1632 | if (netif_msg_probe(tp)) |
1608 | pci_name(pdev)); | 1633 | pr_info("%s: Read MAC address from APC\n", pci_name(pdev)); |
1609 | 1634 | ||
1610 | for (i = 0; i < ARRAY_SIZE(ids); i++) { | 1635 | for (i = 0; i < ARRAY_SIZE(ids); i++) { |
1611 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL); | 1636 | isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL); |
@@ -1614,8 +1639,9 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev, | |||
1614 | } | 1639 | } |
1615 | 1640 | ||
1616 | if (!isa_bridge) { | 1641 | if (!isa_bridge) { |
1617 | net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n", | 1642 | if (netif_msg_probe(tp)) |
1618 | pci_name(pdev)); | 1643 | pr_info("%s: Can not find ISA bridge\n", |
1644 | pci_name(pdev)); | ||
1619 | return -EIO; | 1645 | return -EIO; |
1620 | } | 1646 | } |
1621 | 1647 | ||
@@ -1696,7 +1722,7 @@ static void sis190_set_speed_auto(struct net_device *dev) | |||
1696 | int phy_id = tp->mii_if.phy_id; | 1722 | int phy_id = tp->mii_if.phy_id; |
1697 | int val; | 1723 | int val; |
1698 | 1724 | ||
1699 | net_link(tp, KERN_INFO "%s: Enabling Auto-negotiation.\n", dev->name); | 1725 | netif_info(tp, link, dev, "Enabling Auto-negotiation\n"); |
1700 | 1726 | ||
1701 | val = mdio_read(ioaddr, phy_id, MII_ADVERTISE); | 1727 | val = mdio_read(ioaddr, phy_id, MII_ADVERTISE); |
1702 | 1728 | ||
@@ -1823,7 +1849,8 @@ static int __devinit sis190_init_one(struct pci_dev *pdev, | |||
1823 | int rc; | 1849 | int rc; |
1824 | 1850 | ||
1825 | if (!printed_version) { | 1851 | if (!printed_version) { |
1826 | net_drv(&debug, KERN_INFO SIS190_DRIVER_NAME " loaded.\n"); | 1852 | if (netif_msg_drv(&debug)) |
1853 | pr_info(SIS190_DRIVER_NAME " loaded\n"); | ||
1827 | printed_version = 1; | 1854 | printed_version = 1; |
1828 | } | 1855 | } |
1829 | 1856 | ||
@@ -1863,12 +1890,14 @@ static int __devinit sis190_init_one(struct pci_dev *pdev, | |||
1863 | if (rc < 0) | 1890 | if (rc < 0) |
1864 | goto err_remove_mii; | 1891 | goto err_remove_mii; |
1865 | 1892 | ||
1866 | net_probe(tp, KERN_INFO "%s: %s at %p (IRQ: %d), %pM\n", | 1893 | if (netif_msg_probe(tp)) { |
1867 | pci_name(pdev), sis_chip_info[ent->driver_data].name, | 1894 | netdev_info(dev, "%s: %s at %p (IRQ: %d), %pM\n", |
1868 | ioaddr, dev->irq, dev->dev_addr); | 1895 | pci_name(pdev), |
1869 | 1896 | sis_chip_info[ent->driver_data].name, | |
1870 | net_probe(tp, KERN_INFO "%s: %s mode.\n", dev->name, | 1897 | ioaddr, dev->irq, dev->dev_addr); |
1871 | (tp->features & F_HAS_RGMII) ? "RGMII" : "GMII"); | 1898 | netdev_info(dev, "%s mode.\n", |
1899 | (tp->features & F_HAS_RGMII) ? "RGMII" : "GMII"); | ||
1900 | } | ||
1872 | 1901 | ||
1873 | netif_carrier_off(dev); | 1902 | netif_carrier_off(dev); |
1874 | 1903 | ||