aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/xirc2ps_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pcmcia/xirc2ps_cs.c')
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c104
1 files changed, 46 insertions, 58 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 1fece617c069..a46b7fd6c0f5 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -63,6 +63,8 @@
63 * OF THE POSSIBILITY OF SUCH DAMAGE. 63 * OF THE POSSIBILITY OF SUCH DAMAGE.
64 */ 64 */
65 65
66#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
67
66#include <linux/module.h> 68#include <linux/module.h>
67#include <linux/kernel.h> 69#include <linux/kernel.h>
68#include <linux/init.h> 70#include <linux/init.h>
@@ -209,13 +211,6 @@ enum xirc_cmd { /* Commands */
209 211
210static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; 212static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
211 213
212
213#define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: "
214#define KERR_XIRC KERN_ERR "xirc2ps_cs: "
215#define KWRN_XIRC KERN_WARNING "xirc2ps_cs: "
216#define KNOT_XIRC KERN_NOTICE "xirc2ps_cs: "
217#define KINF_XIRC KERN_INFO "xirc2ps_cs: "
218
219/* card types */ 214/* card types */
220#define XIR_UNKNOWN 0 /* unknown: not supported */ 215#define XIR_UNKNOWN 0 /* unknown: not supported */
221#define XIR_CE 1 /* (prodid 1) different hardware: not supported */ 216#define XIR_CE 1 /* (prodid 1) different hardware: not supported */
@@ -327,26 +322,26 @@ PrintRegisters(struct net_device *dev)
327 if (pc_debug > 1) { 322 if (pc_debug > 1) {
328 int i, page; 323 int i, page;
329 324
330 printk(KDBG_XIRC "Register common: "); 325 printk(KERN_DEBUG pr_fmt("Register common: "));
331 for (i = 0; i < 8; i++) 326 for (i = 0; i < 8; i++)
332 printk(" %2.2x", GetByte(i)); 327 pr_cont(" %2.2x", GetByte(i));
333 printk("\n"); 328 pr_cont("\n");
334 for (page = 0; page <= 8; page++) { 329 for (page = 0; page <= 8; page++) {
335 printk(KDBG_XIRC "Register page %2x: ", page); 330 printk(KERN_DEBUG pr_fmt("Register page %2x: "), page);
336 SelectPage(page); 331 SelectPage(page);
337 for (i = 8; i < 16; i++) 332 for (i = 8; i < 16; i++)
338 printk(" %2.2x", GetByte(i)); 333 pr_cont(" %2.2x", GetByte(i));
339 printk("\n"); 334 pr_cont("\n");
340 } 335 }
341 for (page=0x40 ; page <= 0x5f; page++) { 336 for (page=0x40 ; page <= 0x5f; page++) {
342 if (page == 0x43 || (page >= 0x46 && page <= 0x4f) || 337 if (page == 0x43 || (page >= 0x46 && page <= 0x4f) ||
343 (page >= 0x51 && page <=0x5e)) 338 (page >= 0x51 && page <=0x5e))
344 continue; 339 continue;
345 printk(KDBG_XIRC "Register page %2x: ", page); 340 printk(KERN_DEBUG pr_fmt("Register page %2x: "), page);
346 SelectPage(page); 341 SelectPage(page);
347 for (i = 8; i < 16; i++) 342 for (i = 8; i < 16; i++)
348 printk(" %2.2x", GetByte(i)); 343 pr_cont(" %2.2x", GetByte(i));
349 printk("\n"); 344 pr_cont("\n");
350 } 345 }
351 } 346 }
352} 347}
@@ -566,11 +561,11 @@ set_card_type(struct pcmcia_device *link)
566 local->modem = 0; 561 local->modem = 0;
567 local->card_type = XIR_UNKNOWN; 562 local->card_type = XIR_UNKNOWN;
568 if (!(prodid & 0x40)) { 563 if (!(prodid & 0x40)) {
569 printk(KNOT_XIRC "Ooops: Not a creditcard\n"); 564 pr_notice("Oops: Not a creditcard\n");
570 return 0; 565 return 0;
571 } 566 }
572 if (!(mediaid & 0x01)) { 567 if (!(mediaid & 0x01)) {
573 printk(KNOT_XIRC "Not an Ethernet card\n"); 568 pr_notice("Not an Ethernet card\n");
574 return 0; 569 return 0;
575 } 570 }
576 if (mediaid & 0x10) { 571 if (mediaid & 0x10) {
@@ -601,12 +596,11 @@ set_card_type(struct pcmcia_device *link)
601 } 596 }
602 } 597 }
603 if (local->card_type == XIR_CE || local->card_type == XIR_CEM) { 598 if (local->card_type == XIR_CE || local->card_type == XIR_CEM) {
604 printk(KNOT_XIRC "Sorry, this is an old CE card\n"); 599 pr_notice("Sorry, this is an old CE card\n");
605 return 0; 600 return 0;
606 } 601 }
607 if (local->card_type == XIR_UNKNOWN) 602 if (local->card_type == XIR_UNKNOWN)
608 printk(KNOT_XIRC "unknown card (mediaid=%02x prodid=%02x)\n", 603 pr_notice("unknown card (mediaid=%02x prodid=%02x)\n", mediaid, prodid);
609 mediaid, prodid);
610 604
611 return 1; 605 return 1;
612} 606}
@@ -710,7 +704,7 @@ xirc2ps_config(struct pcmcia_device * link)
710 704
711 /* Is this a valid card */ 705 /* Is this a valid card */
712 if (link->has_manf_id == 0) { 706 if (link->has_manf_id == 0) {
713 printk(KNOT_XIRC "manfid not found in CIS\n"); 707 pr_notice("manfid not found in CIS\n");
714 goto failure; 708 goto failure;
715 } 709 }
716 710
@@ -732,14 +726,14 @@ xirc2ps_config(struct pcmcia_device * link)
732 local->manf_str = "Toshiba"; 726 local->manf_str = "Toshiba";
733 break; 727 break;
734 default: 728 default:
735 printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", 729 pr_notice("Unknown Card Manufacturer ID: 0x%04x\n",
736 (unsigned)link->manf_id); 730 (unsigned)link->manf_id);
737 goto failure; 731 goto failure;
738 } 732 }
739 dev_dbg(&link->dev, "found %s card\n", local->manf_str); 733 dev_dbg(&link->dev, "found %s card\n", local->manf_str);
740 734
741 if (!set_card_type(link)) { 735 if (!set_card_type(link)) {
742 printk(KNOT_XIRC "this card is not supported\n"); 736 pr_notice("this card is not supported\n");
743 goto failure; 737 goto failure;
744 } 738 }
745 739
@@ -765,7 +759,7 @@ xirc2ps_config(struct pcmcia_device * link)
765 err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev); 759 err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev);
766 760
767 if (err) { 761 if (err) {
768 printk(KNOT_XIRC "node-id not found in CIS\n"); 762 pr_notice("node-id not found in CIS\n");
769 goto failure; 763 goto failure;
770 } 764 }
771 765
@@ -792,7 +786,7 @@ xirc2ps_config(struct pcmcia_device * link)
792 * try to configure as Ethernet only. 786 * try to configure as Ethernet only.
793 * .... */ 787 * .... */
794 } 788 }
795 printk(KNOT_XIRC "no ports available\n"); 789 pr_notice("no ports available\n");
796 } else { 790 } else {
797 link->io_lines = 10; 791 link->io_lines = 10;
798 link->resource[0]->end = 16; 792 link->resource[0]->end = 16;
@@ -865,24 +859,24 @@ xirc2ps_config(struct pcmcia_device * link)
865 #if 0 859 #if 0
866 { 860 {
867 u_char tmp; 861 u_char tmp;
868 printk(KERN_INFO "ECOR:"); 862 pr_info("ECOR:");
869 for (i=0; i < 7; i++) { 863 for (i=0; i < 7; i++) {
870 tmp = readb(local->dingo_ccr + i*2); 864 tmp = readb(local->dingo_ccr + i*2);
871 printk(" %02x", tmp); 865 pr_cont(" %02x", tmp);
872 } 866 }
873 printk("\n"); 867 pr_cont("\n");
874 printk(KERN_INFO "DCOR:"); 868 pr_info("DCOR:");
875 for (i=0; i < 4; i++) { 869 for (i=0; i < 4; i++) {
876 tmp = readb(local->dingo_ccr + 0x20 + i*2); 870 tmp = readb(local->dingo_ccr + 0x20 + i*2);
877 printk(" %02x", tmp); 871 pr_cont(" %02x", tmp);
878 } 872 }
879 printk("\n"); 873 pr_cont("\n");
880 printk(KERN_INFO "SCOR:"); 874 pr_info("SCOR:");
881 for (i=0; i < 10; i++) { 875 for (i=0; i < 10; i++) {
882 tmp = readb(local->dingo_ccr + 0x40 + i*2); 876 tmp = readb(local->dingo_ccr + 0x40 + i*2);
883 printk(" %02x", tmp); 877 pr_cont(" %02x", tmp);
884 } 878 }
885 printk("\n"); 879 pr_cont("\n");
886 } 880 }
887 #endif 881 #endif
888 882
@@ -901,7 +895,7 @@ xirc2ps_config(struct pcmcia_device * link)
901 (local->mohawk && if_port==4)) 895 (local->mohawk && if_port==4))
902 dev->if_port = if_port; 896 dev->if_port = if_port;
903 else 897 else
904 printk(KNOT_XIRC "invalid if_port requested\n"); 898 pr_notice("invalid if_port requested\n");
905 899
906 /* we can now register the device with the net subsystem */ 900 /* we can now register the device with the net subsystem */
907 dev->irq = link->irq; 901 dev->irq = link->irq;
@@ -913,14 +907,14 @@ xirc2ps_config(struct pcmcia_device * link)
913 SET_NETDEV_DEV(dev, &link->dev); 907 SET_NETDEV_DEV(dev, &link->dev);
914 908
915 if ((err=register_netdev(dev))) { 909 if ((err=register_netdev(dev))) {
916 printk(KNOT_XIRC "register_netdev() failed\n"); 910 pr_notice("register_netdev() failed\n");
917 goto config_error; 911 goto config_error;
918 } 912 }
919 913
920 /* give some infos about the hardware */ 914 /* give some infos about the hardware */
921 printk(KERN_INFO "%s: %s: port %#3lx, irq %d, hwaddr %pM\n", 915 netdev_info(dev, "%s: port %#3lx, irq %d, hwaddr %pM\n",
922 dev->name, local->manf_str,(u_long)dev->base_addr, (int)dev->irq, 916 local->manf_str, (u_long)dev->base_addr, (int)dev->irq,
923 dev->dev_addr); 917 dev->dev_addr);
924 918
925 return 0; 919 return 0;
926 920
@@ -1047,8 +1041,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1047 1041
1048 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ 1042 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */
1049 if (!skb) { 1043 if (!skb) {
1050 printk(KNOT_XIRC "low memory, packet dropped (size=%u)\n", 1044 pr_notice("low memory, packet dropped (size=%u)\n", pktlen);
1051 pktlen);
1052 dev->stats.rx_dropped++; 1045 dev->stats.rx_dropped++;
1053 } else { /* okay get the packet */ 1046 } else { /* okay get the packet */
1054 skb_reserve(skb, 2); 1047 skb_reserve(skb, 2);
@@ -1217,7 +1210,7 @@ xirc_tx_timeout(struct net_device *dev)
1217{ 1210{
1218 local_info_t *lp = netdev_priv(dev); 1211 local_info_t *lp = netdev_priv(dev);
1219 dev->stats.tx_errors++; 1212 dev->stats.tx_errors++;
1220 printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); 1213 netdev_notice(dev, "transmit timed out\n");
1221 schedule_work(&lp->tx_timeout_task); 1214 schedule_work(&lp->tx_timeout_task);
1222} 1215}
1223 1216
@@ -1384,8 +1377,7 @@ do_config(struct net_device *dev, struct ifmap *map)
1384 local->probe_port = 0; 1377 local->probe_port = 0;
1385 dev->if_port = map->port; 1378 dev->if_port = map->port;
1386 } 1379 }
1387 printk(KERN_INFO "%s: switching to %s port\n", 1380 netdev_info(dev, "switching to %s port\n", if_names[dev->if_port]);
1388 dev->name, if_names[dev->if_port]);
1389 do_reset(dev,1); /* not the fine way :-) */ 1381 do_reset(dev,1); /* not the fine way :-) */
1390 } 1382 }
1391 return 0; 1383 return 0;
@@ -1525,7 +1517,7 @@ do_reset(struct net_device *dev, int full)
1525 { 1517 {
1526 SelectPage(0); 1518 SelectPage(0);
1527 value = GetByte(XIRCREG_ESR); /* read the ESR */ 1519 value = GetByte(XIRCREG_ESR); /* read the ESR */
1528 printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); 1520 pr_debug("%s: ESR is: %#02x\n", dev->name, value);
1529 } 1521 }
1530 #endif 1522 #endif
1531 1523
@@ -1575,13 +1567,12 @@ do_reset(struct net_device *dev, int full)
1575 1567
1576 if (full && local->mohawk && init_mii(dev)) { 1568 if (full && local->mohawk && init_mii(dev)) {
1577 if (dev->if_port == 4 || local->dingo || local->new_mii) { 1569 if (dev->if_port == 4 || local->dingo || local->new_mii) {
1578 printk(KERN_INFO "%s: MII selected\n", dev->name); 1570 netdev_info(dev, "MII selected\n");
1579 SelectPage(2); 1571 SelectPage(2);
1580 PutByte(XIRCREG2_MSR, GetByte(XIRCREG2_MSR) | 0x08); 1572 PutByte(XIRCREG2_MSR, GetByte(XIRCREG2_MSR) | 0x08);
1581 msleep(20); 1573 msleep(20);
1582 } else { 1574 } else {
1583 printk(KERN_INFO "%s: MII detected; using 10mbs\n", 1575 netdev_info(dev, "MII detected; using 10mbs\n");
1584 dev->name);
1585 SelectPage(0x42); 1576 SelectPage(0x42);
1586 if (dev->if_port == 2) /* enable 10Base2 */ 1577 if (dev->if_port == 2) /* enable 10Base2 */
1587 PutByte(XIRCREG42_SWC1, 0xC0); 1578 PutByte(XIRCREG42_SWC1, 0xC0);
@@ -1626,8 +1617,8 @@ do_reset(struct net_device *dev, int full)
1626 } 1617 }
1627 1618
1628 if (full) 1619 if (full)
1629 printk(KERN_INFO "%s: media %s, silicon revision %d\n", 1620 netdev_info(dev, "media %s, silicon revision %d\n",
1630 dev->name, if_names[dev->if_port], local->silicon); 1621 if_names[dev->if_port], local->silicon);
1631 /* We should switch back to page 0 to avoid a bug in revision 0 1622 /* We should switch back to page 0 to avoid a bug in revision 0
1632 * where regs with offset below 8 can't be read after an access 1623 * where regs with offset below 8 can't be read after an access
1633 * to the MAC registers */ 1624 * to the MAC registers */
@@ -1669,8 +1660,7 @@ init_mii(struct net_device *dev)
1669 control = mii_rd(ioaddr, 0, 0); 1660 control = mii_rd(ioaddr, 0, 0);
1670 1661
1671 if (control & 0x0400) { 1662 if (control & 0x0400) {
1672 printk(KERN_NOTICE "%s can't take PHY out of isolation mode\n", 1663 netdev_notice(dev, "can't take PHY out of isolation mode\n");
1673 dev->name);
1674 local->probe_port = 0; 1664 local->probe_port = 0;
1675 return 0; 1665 return 0;
1676 } 1666 }
@@ -1688,8 +1678,7 @@ init_mii(struct net_device *dev)
1688 } 1678 }
1689 1679
1690 if (!(status & 0x0020)) { 1680 if (!(status & 0x0020)) {
1691 printk(KERN_INFO "%s: autonegotiation failed;" 1681 netdev_info(dev, "autonegotiation failed; using 10mbs\n");
1692 " using 10mbs\n", dev->name);
1693 if (!local->new_mii) { 1682 if (!local->new_mii) {
1694 control = 0x0000; 1683 control = 0x0000;
1695 mii_wr(ioaddr, 0, 0, control, 16); 1684 mii_wr(ioaddr, 0, 0, control, 16);
@@ -1699,8 +1688,7 @@ init_mii(struct net_device *dev)
1699 } 1688 }
1700 } else { 1689 } else {
1701 linkpartner = mii_rd(ioaddr, 0, 5); 1690 linkpartner = mii_rd(ioaddr, 0, 5);
1702 printk(KERN_INFO "%s: MII link partner: %04x\n", 1691 netdev_info(dev, "MII link partner: %04x\n", linkpartner);
1703 dev->name, linkpartner);
1704 if (linkpartner & 0x0080) { 1692 if (linkpartner & 0x0080) {
1705 dev->if_port = 4; 1693 dev->if_port = 4;
1706 } else 1694 } else