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.c259
1 files changed, 102 insertions, 157 deletions
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 187da21f720..a2eda28f903 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -211,20 +211,6 @@ enum xirc_cmd { /* Commands */
211 211
212static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; 212static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
213 213
214/****************
215 * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
216 * you do not define PCMCIA_DEBUG at all, all the debug code will be
217 * left out. If you compile with PCMCIA_DEBUG=0, the debug code will
218 * be present but disabled -- but it can then be enabled for specific
219 * modules at load time with a 'pc_debug=#' option to insmod.
220 */
221#ifdef PCMCIA_DEBUG
222static int pc_debug = PCMCIA_DEBUG;
223module_param(pc_debug, int, 0);
224#define DEBUG(n, args...) if (pc_debug>(n)) printk(KDBG_XIRC args)
225#else
226#define DEBUG(n, args...)
227#endif
228 214
229#define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " 215#define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: "
230#define KERR_XIRC KERN_ERR "xirc2ps_cs: " 216#define KERR_XIRC KERN_ERR "xirc2ps_cs: "
@@ -359,7 +345,7 @@ static void xirc_tx_timeout(struct net_device *dev);
359static void xirc2ps_tx_timeout_task(struct work_struct *work); 345static void xirc2ps_tx_timeout_task(struct work_struct *work);
360static void set_addresses(struct net_device *dev); 346static void set_addresses(struct net_device *dev);
361static void set_multicast_list(struct net_device *dev); 347static void set_multicast_list(struct net_device *dev);
362static int set_card_type(struct pcmcia_device *link, const void *s); 348static int set_card_type(struct pcmcia_device *link);
363static int do_config(struct net_device *dev, struct ifmap *map); 349static int do_config(struct net_device *dev, struct ifmap *map);
364static int do_open(struct net_device *dev); 350static int do_open(struct net_device *dev);
365static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 351static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -371,28 +357,6 @@ static void do_powerdown(struct net_device *dev);
371static int do_stop(struct net_device *dev); 357static int do_stop(struct net_device *dev);
372 358
373/*=============== Helper functions =========================*/ 359/*=============== Helper functions =========================*/
374static int
375first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
376{
377 int err;
378
379 if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 &&
380 (err = pcmcia_get_tuple_data(handle, tuple)) == 0)
381 err = pcmcia_parse_tuple(tuple, parse);
382 return err;
383}
384
385static int
386next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
387{
388 int err;
389
390 if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 &&
391 (err = pcmcia_get_tuple_data(handle, tuple)) == 0)
392 err = pcmcia_parse_tuple(tuple, parse);
393 return err;
394}
395
396#define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR) 360#define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR)
397#define GetByte(reg) ((unsigned)inb(ioaddr + (reg))) 361#define GetByte(reg) ((unsigned)inb(ioaddr + (reg)))
398#define GetWord(reg) ((unsigned)inw(ioaddr + (reg))) 362#define GetWord(reg) ((unsigned)inw(ioaddr + (reg)))
@@ -400,7 +364,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse)
400#define PutWord(reg,value) outw((value), ioaddr+(reg)) 364#define PutWord(reg,value) outw((value), ioaddr+(reg))
401 365
402/*====== Functions used for debugging =================================*/ 366/*====== Functions used for debugging =================================*/
403#if defined(PCMCIA_DEBUG) && 0 /* reading regs may change system status */ 367#if 0 /* reading regs may change system status */
404static void 368static void
405PrintRegisters(struct net_device *dev) 369PrintRegisters(struct net_device *dev)
406{ 370{
@@ -432,7 +396,7 @@ PrintRegisters(struct net_device *dev)
432 } 396 }
433 } 397 }
434} 398}
435#endif /* PCMCIA_DEBUG */ 399#endif /* 0 */
436 400
437/*============== MII Management functions ===============*/ 401/*============== MII Management functions ===============*/
438 402
@@ -576,7 +540,7 @@ xirc2ps_probe(struct pcmcia_device *link)
576 struct net_device *dev; 540 struct net_device *dev;
577 local_info_t *local; 541 local_info_t *local;
578 542
579 DEBUG(0, "attach()\n"); 543 dev_dbg(&link->dev, "attach()\n");
580 544
581 /* Allocate the device structure */ 545 /* Allocate the device structure */
582 dev = alloc_etherdev(sizeof(local_info_t)); 546 dev = alloc_etherdev(sizeof(local_info_t));
@@ -592,7 +556,6 @@ xirc2ps_probe(struct pcmcia_device *link)
592 link->conf.IntType = INT_MEMORY_AND_IO; 556 link->conf.IntType = INT_MEMORY_AND_IO;
593 link->conf.ConfigIndex = 1; 557 link->conf.ConfigIndex = 1;
594 link->irq.Handler = xirc2ps_interrupt; 558 link->irq.Handler = xirc2ps_interrupt;
595 link->irq.Instance = dev;
596 559
597 /* Fill in card specific entries */ 560 /* Fill in card specific entries */
598 dev->netdev_ops = &netdev_ops; 561 dev->netdev_ops = &netdev_ops;
@@ -615,7 +578,7 @@ xirc2ps_detach(struct pcmcia_device *link)
615{ 578{
616 struct net_device *dev = link->priv; 579 struct net_device *dev = link->priv;
617 580
618 DEBUG(0, "detach(0x%p)\n", link); 581 dev_dbg(&link->dev, "detach\n");
619 582
620 if (link->dev_node) 583 if (link->dev_node)
621 unregister_netdev(dev); 584 unregister_netdev(dev);
@@ -644,17 +607,25 @@ xirc2ps_detach(struct pcmcia_device *link)
644 * 607 *
645 */ 608 */
646static int 609static int
647set_card_type(struct pcmcia_device *link, const void *s) 610set_card_type(struct pcmcia_device *link)
648{ 611{
649 struct net_device *dev = link->priv; 612 struct net_device *dev = link->priv;
650 local_info_t *local = netdev_priv(dev); 613 local_info_t *local = netdev_priv(dev);
651 #ifdef PCMCIA_DEBUG 614 u8 *buf;
652 unsigned cisrev = ((const unsigned char *)s)[2]; 615 unsigned int cisrev, mediaid, prodid;
653 #endif 616 size_t len;
654 unsigned mediaid= ((const unsigned char *)s)[3]; 617
655 unsigned prodid = ((const unsigned char *)s)[4]; 618 len = pcmcia_get_tuple(link, CISTPL_MANFID, &buf);
619 if (len < 5) {
620 dev_err(&link->dev, "invalid CIS -- sorry\n");
621 return 0;
622 }
656 623
657 DEBUG(0, "cisrev=%02x mediaid=%02x prodid=%02x\n", 624 cisrev = buf[2];
625 mediaid = buf[3];
626 prodid = buf[4];
627
628 dev_dbg(&link->dev, "cisrev=%02x mediaid=%02x prodid=%02x\n",
658 cisrev, mediaid, prodid); 629 cisrev, mediaid, prodid);
659 630
660 local->mohawk = 0; 631 local->mohawk = 0;
@@ -761,6 +732,26 @@ xirc2ps_config_check(struct pcmcia_device *p_dev,
761 732
762} 733}
763 734
735
736static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev,
737 tuple_t *tuple,
738 void *priv)
739{
740 struct net_device *dev = priv;
741 int i;
742
743 if (tuple->TupleDataLen != 13)
744 return -EINVAL;
745 if ((tuple->TupleData[0] != 2) || (tuple->TupleData[1] != 1) ||
746 (tuple->TupleData[2] != 6))
747 return -EINVAL;
748 /* another try (James Lehmer's CE2 version 4.1)*/
749 for (i = 2; i < 6; i++)
750 dev->dev_addr[i] = tuple->TupleData[i+2];
751 return 0;
752};
753
754
764/**************** 755/****************
765 * xirc2ps_config() is scheduled to run after a CARD_INSERTION event 756 * xirc2ps_config() is scheduled to run after a CARD_INSERTION event
766 * is received, to configure the PCMCIA socket, and to make the 757 * is received, to configure the PCMCIA socket, and to make the
@@ -772,33 +763,21 @@ xirc2ps_config(struct pcmcia_device * link)
772 struct net_device *dev = link->priv; 763 struct net_device *dev = link->priv;
773 local_info_t *local = netdev_priv(dev); 764 local_info_t *local = netdev_priv(dev);
774 unsigned int ioaddr; 765 unsigned int ioaddr;
775 tuple_t tuple; 766 int err;
776 cisparse_t parse; 767 u8 *buf;
777 int err, i; 768 size_t len;
778 u_char buf[64];
779 cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data;
780 769
781 local->dingo_ccr = NULL; 770 local->dingo_ccr = NULL;
782 771
783 DEBUG(0, "config(0x%p)\n", link); 772 dev_dbg(&link->dev, "config\n");
784
785 /*
786 * This reads the card's CONFIG tuple to find its configuration
787 * registers.
788 */
789 tuple.Attributes = 0;
790 tuple.TupleData = buf;
791 tuple.TupleDataMax = 64;
792 tuple.TupleOffset = 0;
793 773
794 /* Is this a valid card */ 774 /* Is this a valid card */
795 tuple.DesiredTuple = CISTPL_MANFID; 775 if (link->has_manf_id == 0) {
796 if ((err=first_tuple(link, &tuple, &parse))) {
797 printk(KNOT_XIRC "manfid not found in CIS\n"); 776 printk(KNOT_XIRC "manfid not found in CIS\n");
798 goto failure; 777 goto failure;
799 } 778 }
800 779
801 switch(parse.manfid.manf) { 780 switch (link->manf_id) {
802 case MANFID_XIRCOM: 781 case MANFID_XIRCOM:
803 local->manf_str = "Xircom"; 782 local->manf_str = "Xircom";
804 break; 783 break;
@@ -817,65 +796,44 @@ xirc2ps_config(struct pcmcia_device * link)
817 break; 796 break;
818 default: 797 default:
819 printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", 798 printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n",
820 (unsigned)parse.manfid.manf); 799 (unsigned)link->manf_id);
821 goto failure; 800 goto failure;
822 } 801 }
823 DEBUG(0, "found %s card\n", local->manf_str); 802 dev_dbg(&link->dev, "found %s card\n", local->manf_str);
824 803
825 if (!set_card_type(link, buf)) { 804 if (!set_card_type(link)) {
826 printk(KNOT_XIRC "this card is not supported\n"); 805 printk(KNOT_XIRC "this card is not supported\n");
827 goto failure; 806 goto failure;
828 } 807 }
829 808
830 /* get the ethernet address from the CIS */ 809 /* get the ethernet address from the CIS */
831 tuple.DesiredTuple = CISTPL_FUNCE; 810 err = pcmcia_get_mac_from_cis(link, dev);
832 for (err = first_tuple(link, &tuple, &parse); !err; 811
833 err = next_tuple(link, &tuple, &parse)) { 812 /* not found: try to get the node-id from tuple 0x89 */
834 /* Once I saw two CISTPL_FUNCE_LAN_NODE_ID entries: 813 if (err) {
835 * the first one with a length of zero the second correct - 814 len = pcmcia_get_tuple(link, 0x89, &buf);
836 * so I skip all entries with length 0 */ 815 /* data layout looks like tuple 0x22 */
837 if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID && 816 if (buf && len == 8) {
838 ((cistpl_lan_node_id_t *)parse.funce.data)->nb) 817 if (*buf == CISTPL_FUNCE_LAN_NODE_ID) {
839 break; 818 int i;
840 } 819 for (i = 2; i < 6; i++)
841 if (err) { /* not found: try to get the node-id from tuple 0x89 */ 820 dev->dev_addr[i] = buf[i+2];
842 tuple.DesiredTuple = 0x89; /* data layout looks like tuple 0x22 */ 821 } else
843 if ((err = pcmcia_get_first_tuple(link, &tuple)) == 0 && 822 err = -1;
844 (err = pcmcia_get_tuple_data(link, &tuple)) == 0) {
845 if (tuple.TupleDataLen == 8 && *buf == CISTPL_FUNCE_LAN_NODE_ID)
846 memcpy(&parse, buf, 8);
847 else
848 err = -1;
849 }
850 }
851 if (err) { /* another try (James Lehmer's CE2 version 4.1)*/
852 tuple.DesiredTuple = CISTPL_FUNCE;
853 for (err = first_tuple(link, &tuple, &parse); !err;
854 err = next_tuple(link, &tuple, &parse)) {
855 if (parse.funce.type == 0x02 && parse.funce.data[0] == 1 &&
856 parse.funce.data[1] == 6 && tuple.TupleDataLen == 13) {
857 buf[1] = 4;
858 memcpy(&parse, buf+1, 8);
859 break;
860 } 823 }
861 } 824 kfree(buf);
862 } 825 }
826
827 if (err)
828 err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev);
829
863 if (err) { 830 if (err) {
864 printk(KNOT_XIRC "node-id not found in CIS\n"); 831 printk(KNOT_XIRC "node-id not found in CIS\n");
865 goto failure; 832 goto failure;
866 } 833 }
867 node_id = (cistpl_lan_node_id_t *)parse.funce.data;
868 if (node_id->nb != 6) {
869 printk(KNOT_XIRC "malformed node-id in CIS\n");
870 goto failure;
871 }
872 for (i=0; i < 6; i++)
873 dev->dev_addr[i] = node_id->id[i];
874 834
875 link->io.IOAddrLines =10; 835 link->io.IOAddrLines =10;
876 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 836 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
877 link->irq.Attributes = IRQ_HANDLE_PRESENT;
878 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
879 if (local->modem) { 837 if (local->modem) {
880 int pass; 838 int pass;
881 839
@@ -916,10 +874,8 @@ xirc2ps_config(struct pcmcia_device * link)
916 goto port_found; 874 goto port_found;
917 } 875 }
918 link->io.BasePort1 = 0; /* let CS decide */ 876 link->io.BasePort1 = 0; /* let CS decide */
919 if ((err=pcmcia_request_io(link, &link->io))) { 877 if ((err=pcmcia_request_io(link, &link->io)))
920 cs_error(link, RequestIO, err);
921 goto config_error; 878 goto config_error;
922 }
923 } 879 }
924 port_found: 880 port_found:
925 if (err) 881 if (err)
@@ -929,19 +885,15 @@ xirc2ps_config(struct pcmcia_device * link)
929 * Now allocate an interrupt line. Note that this does not 885 * Now allocate an interrupt line. Note that this does not
930 * actually assign a handler to the interrupt. 886 * actually assign a handler to the interrupt.
931 */ 887 */
932 if ((err=pcmcia_request_irq(link, &link->irq))) { 888 if ((err=pcmcia_request_irq(link, &link->irq)))
933 cs_error(link, RequestIRQ, err);
934 goto config_error; 889 goto config_error;
935 }
936 890
937 /**************** 891 /****************
938 * This actually configures the PCMCIA socket -- setting up 892 * This actually configures the PCMCIA socket -- setting up
939 * the I/O windows and the interrupt mapping. 893 * the I/O windows and the interrupt mapping.
940 */ 894 */
941 if ((err=pcmcia_request_configuration(link, &link->conf))) { 895 if ((err=pcmcia_request_configuration(link, &link->conf)))
942 cs_error(link, RequestConfiguration, err);
943 goto config_error; 896 goto config_error;
944 }
945 897
946 if (local->dingo) { 898 if (local->dingo) {
947 conf_reg_t reg; 899 conf_reg_t reg;
@@ -956,17 +908,13 @@ xirc2ps_config(struct pcmcia_device * link)
956 reg.Action = CS_WRITE; 908 reg.Action = CS_WRITE;
957 reg.Offset = CISREG_IOBASE_0; 909 reg.Offset = CISREG_IOBASE_0;
958 reg.Value = link->io.BasePort2 & 0xff; 910 reg.Value = link->io.BasePort2 & 0xff;
959 if ((err = pcmcia_access_configuration_register(link, &reg))) { 911 if ((err = pcmcia_access_configuration_register(link, &reg)))
960 cs_error(link, AccessConfigurationRegister, err);
961 goto config_error; 912 goto config_error;
962 }
963 reg.Action = CS_WRITE; 913 reg.Action = CS_WRITE;
964 reg.Offset = CISREG_IOBASE_1; 914 reg.Offset = CISREG_IOBASE_1;
965 reg.Value = (link->io.BasePort2 >> 8) & 0xff; 915 reg.Value = (link->io.BasePort2 >> 8) & 0xff;
966 if ((err = pcmcia_access_configuration_register(link, &reg))) { 916 if ((err = pcmcia_access_configuration_register(link, &reg)))
967 cs_error(link, AccessConfigurationRegister, err);
968 goto config_error; 917 goto config_error;
969 }
970 918
971 /* There is no config entry for the Ethernet part which 919 /* There is no config entry for the Ethernet part which
972 * is at 0x0800. So we allocate a window into the attribute 920 * is at 0x0800. So we allocate a window into the attribute
@@ -975,17 +923,14 @@ xirc2ps_config(struct pcmcia_device * link)
975 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 923 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
976 req.Base = req.Size = 0; 924 req.Base = req.Size = 0;
977 req.AccessSpeed = 0; 925 req.AccessSpeed = 0;
978 if ((err = pcmcia_request_window(&link, &req, &link->win))) { 926 if ((err = pcmcia_request_window(link, &req, &link->win)))
979 cs_error(link, RequestWindow, err);
980 goto config_error; 927 goto config_error;
981 } 928
982 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 929 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
983 mem.CardOffset = 0x0; 930 mem.CardOffset = 0x0;
984 mem.Page = 0; 931 mem.Page = 0;
985 if ((err = pcmcia_map_mem_page(link->win, &mem))) { 932 if ((err = pcmcia_map_mem_page(link, link->win, &mem)))
986 cs_error(link, MapMemPage, err);
987 goto config_error; 933 goto config_error;
988 }
989 934
990 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 935 /* Setup the CCRs; there are no infos in the CIS about the Ethernet
991 * part. 936 * part.
@@ -1044,7 +989,7 @@ xirc2ps_config(struct pcmcia_device * link)
1044 do_reset(dev, 1); /* a kludge to make the cem56 work */ 989 do_reset(dev, 1); /* a kludge to make the cem56 work */
1045 990
1046 link->dev_node = &local->node; 991 link->dev_node = &local->node;
1047 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 992 SET_NETDEV_DEV(dev, &link->dev);
1048 993
1049 if ((err=register_netdev(dev))) { 994 if ((err=register_netdev(dev))) {
1050 printk(KNOT_XIRC "register_netdev() failed\n"); 995 printk(KNOT_XIRC "register_netdev() failed\n");
@@ -1077,7 +1022,7 @@ xirc2ps_config(struct pcmcia_device * link)
1077static void 1022static void
1078xirc2ps_release(struct pcmcia_device *link) 1023xirc2ps_release(struct pcmcia_device *link)
1079{ 1024{
1080 DEBUG(0, "release(0x%p)\n", link); 1025 dev_dbg(&link->dev, "release\n");
1081 1026
1082 if (link->win) { 1027 if (link->win) {
1083 struct net_device *dev = link->priv; 1028 struct net_device *dev = link->priv;
@@ -1144,7 +1089,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1144 PutByte(XIRCREG_CR, 0); 1089 PutByte(XIRCREG_CR, 0);
1145 } 1090 }
1146 1091
1147 DEBUG(6, "%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr); 1092 pr_debug("%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr);
1148 1093
1149 saved_page = GetByte(XIRCREG_PR); 1094 saved_page = GetByte(XIRCREG_PR);
1150 /* Read the ISR to see whats the cause for the interrupt. 1095 /* Read the ISR to see whats the cause for the interrupt.
@@ -1154,7 +1099,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1154 bytes_rcvd = 0; 1099 bytes_rcvd = 0;
1155 loop_entry: 1100 loop_entry:
1156 if (int_status == 0xff) { /* card may be ejected */ 1101 if (int_status == 0xff) { /* card may be ejected */
1157 DEBUG(3, "%s: interrupt %d for dead card\n", dev->name, irq); 1102 pr_debug("%s: interrupt %d for dead card\n", dev->name, irq);
1158 goto leave; 1103 goto leave;
1159 } 1104 }
1160 eth_status = GetByte(XIRCREG_ESR); 1105 eth_status = GetByte(XIRCREG_ESR);
@@ -1167,7 +1112,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1167 PutByte(XIRCREG40_TXST0, 0); 1112 PutByte(XIRCREG40_TXST0, 0);
1168 PutByte(XIRCREG40_TXST1, 0); 1113 PutByte(XIRCREG40_TXST1, 0);
1169 1114
1170 DEBUG(3, "%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n", 1115 pr_debug("%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n",
1171 dev->name, int_status, eth_status, rx_status, tx_status); 1116 dev->name, int_status, eth_status, rx_status, tx_status);
1172 1117
1173 /***** receive section ******/ 1118 /***** receive section ******/
@@ -1178,14 +1123,14 @@ xirc2ps_interrupt(int irq, void *dev_id)
1178 /* too many bytes received during this int, drop the rest of the 1123 /* too many bytes received during this int, drop the rest of the
1179 * packets */ 1124 * packets */
1180 dev->stats.rx_dropped++; 1125 dev->stats.rx_dropped++;
1181 DEBUG(2, "%s: RX drop, too much done\n", dev->name); 1126 pr_debug("%s: RX drop, too much done\n", dev->name);
1182 } else if (rsr & PktRxOk) { 1127 } else if (rsr & PktRxOk) {
1183 struct sk_buff *skb; 1128 struct sk_buff *skb;
1184 1129
1185 pktlen = GetWord(XIRCREG0_RBC); 1130 pktlen = GetWord(XIRCREG0_RBC);
1186 bytes_rcvd += pktlen; 1131 bytes_rcvd += pktlen;
1187 1132
1188 DEBUG(5, "rsr=%#02x packet_length=%u\n", rsr, pktlen); 1133 pr_debug("rsr=%#02x packet_length=%u\n", rsr, pktlen);
1189 1134
1190 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ 1135 skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */
1191 if (!skb) { 1136 if (!skb) {
@@ -1253,19 +1198,19 @@ xirc2ps_interrupt(int irq, void *dev_id)
1253 dev->stats.multicast++; 1198 dev->stats.multicast++;
1254 } 1199 }
1255 } else { /* bad packet */ 1200 } else { /* bad packet */
1256 DEBUG(5, "rsr=%#02x\n", rsr); 1201 pr_debug("rsr=%#02x\n", rsr);
1257 } 1202 }
1258 if (rsr & PktTooLong) { 1203 if (rsr & PktTooLong) {
1259 dev->stats.rx_frame_errors++; 1204 dev->stats.rx_frame_errors++;
1260 DEBUG(3, "%s: Packet too long\n", dev->name); 1205 pr_debug("%s: Packet too long\n", dev->name);
1261 } 1206 }
1262 if (rsr & CRCErr) { 1207 if (rsr & CRCErr) {
1263 dev->stats.rx_crc_errors++; 1208 dev->stats.rx_crc_errors++;
1264 DEBUG(3, "%s: CRC error\n", dev->name); 1209 pr_debug("%s: CRC error\n", dev->name);
1265 } 1210 }
1266 if (rsr & AlignErr) { 1211 if (rsr & AlignErr) {
1267 dev->stats.rx_fifo_errors++; /* okay ? */ 1212 dev->stats.rx_fifo_errors++; /* okay ? */
1268 DEBUG(3, "%s: Alignment error\n", dev->name); 1213 pr_debug("%s: Alignment error\n", dev->name);
1269 } 1214 }
1270 1215
1271 /* clear the received/dropped/error packet */ 1216 /* clear the received/dropped/error packet */
@@ -1277,7 +1222,7 @@ xirc2ps_interrupt(int irq, void *dev_id)
1277 if (rx_status & 0x10) { /* Receive overrun */ 1222 if (rx_status & 0x10) { /* Receive overrun */
1278 dev->stats.rx_over_errors++; 1223 dev->stats.rx_over_errors++;
1279 PutByte(XIRCREG_CR, ClearRxOvrun); 1224 PutByte(XIRCREG_CR, ClearRxOvrun);
1280 DEBUG(3, "receive overrun cleared\n"); 1225 pr_debug("receive overrun cleared\n");
1281 } 1226 }
1282 1227
1283 /***** transmit section ******/ 1228 /***** transmit section ******/
@@ -1290,13 +1235,13 @@ xirc2ps_interrupt(int irq, void *dev_id)
1290 if (nn < n) /* rollover */ 1235 if (nn < n) /* rollover */
1291 dev->stats.tx_packets += 256 - n; 1236 dev->stats.tx_packets += 256 - n;
1292 else if (n == nn) { /* happens sometimes - don't know why */ 1237 else if (n == nn) { /* happens sometimes - don't know why */
1293 DEBUG(0, "PTR not changed?\n"); 1238 pr_debug("PTR not changed?\n");
1294 } else 1239 } else
1295 dev->stats.tx_packets += lp->last_ptr_value - n; 1240 dev->stats.tx_packets += lp->last_ptr_value - n;
1296 netif_wake_queue(dev); 1241 netif_wake_queue(dev);
1297 } 1242 }
1298 if (tx_status & 0x0002) { /* Execessive collissions */ 1243 if (tx_status & 0x0002) { /* Execessive collissions */
1299 DEBUG(0, "tx restarted due to execssive collissions\n"); 1244 pr_debug("tx restarted due to execssive collissions\n");
1300 PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ 1245 PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */
1301 } 1246 }
1302 if (tx_status & 0x0040) 1247 if (tx_status & 0x0040)
@@ -1315,14 +1260,14 @@ xirc2ps_interrupt(int irq, void *dev_id)
1315 maxrx_bytes = 2000; 1260 maxrx_bytes = 2000;
1316 else if (maxrx_bytes > 22000) 1261 else if (maxrx_bytes > 22000)
1317 maxrx_bytes = 22000; 1262 maxrx_bytes = 22000;
1318 DEBUG(1, "set maxrx=%u (rcvd=%u ticks=%lu)\n", 1263 pr_debug("set maxrx=%u (rcvd=%u ticks=%lu)\n",
1319 maxrx_bytes, bytes_rcvd, duration); 1264 maxrx_bytes, bytes_rcvd, duration);
1320 } else if (!duration && maxrx_bytes < 22000) { 1265 } else if (!duration && maxrx_bytes < 22000) {
1321 /* now much faster */ 1266 /* now much faster */
1322 maxrx_bytes += 2000; 1267 maxrx_bytes += 2000;
1323 if (maxrx_bytes > 22000) 1268 if (maxrx_bytes > 22000)
1324 maxrx_bytes = 22000; 1269 maxrx_bytes = 22000;
1325 DEBUG(1, "set maxrx=%u\n", maxrx_bytes); 1270 pr_debug("set maxrx=%u\n", maxrx_bytes);
1326 } 1271 }
1327 } 1272 }
1328 1273
@@ -1372,7 +1317,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1372 unsigned freespace; 1317 unsigned freespace;
1373 unsigned pktlen = skb->len; 1318 unsigned pktlen = skb->len;
1374 1319
1375 DEBUG(1, "do_start_xmit(skb=%p, dev=%p) len=%u\n", 1320 pr_debug("do_start_xmit(skb=%p, dev=%p) len=%u\n",
1376 skb, dev, pktlen); 1321 skb, dev, pktlen);
1377 1322
1378 1323
@@ -1398,7 +1343,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev)
1398 freespace &= 0x7fff; 1343 freespace &= 0x7fff;
1399 /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */ 1344 /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */
1400 okay = pktlen +2 < freespace; 1345 okay = pktlen +2 < freespace;
1401 DEBUG(2 + (okay ? 2 : 0), "%s: avail. tx space=%u%s\n", 1346 pr_debug("%s: avail. tx space=%u%s\n",
1402 dev->name, freespace, okay ? " (okay)":" (not enough)"); 1347 dev->name, freespace, okay ? " (okay)":" (not enough)");
1403 if (!okay) { /* not enough space */ 1348 if (!okay) { /* not enough space */
1404 return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */ 1349 return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */
@@ -1500,7 +1445,7 @@ do_config(struct net_device *dev, struct ifmap *map)
1500{ 1445{
1501 local_info_t *local = netdev_priv(dev); 1446 local_info_t *local = netdev_priv(dev);
1502 1447
1503 DEBUG(0, "do_config(%p)\n", dev); 1448 pr_debug("do_config(%p)\n", dev);
1504 if (map->port != 255 && map->port != dev->if_port) { 1449 if (map->port != 255 && map->port != dev->if_port) {
1505 if (map->port > 4) 1450 if (map->port > 4)
1506 return -EINVAL; 1451 return -EINVAL;
@@ -1527,7 +1472,7 @@ do_open(struct net_device *dev)
1527 local_info_t *lp = netdev_priv(dev); 1472 local_info_t *lp = netdev_priv(dev);
1528 struct pcmcia_device *link = lp->p_dev; 1473 struct pcmcia_device *link = lp->p_dev;
1529 1474
1530 DEBUG(0, "do_open(%p)\n", dev); 1475 dev_dbg(&link->dev, "do_open(%p)\n", dev);
1531 1476
1532 /* Check that the PCMCIA card is still here. */ 1477 /* Check that the PCMCIA card is still here. */
1533 /* Physical device present signature. */ 1478 /* Physical device present signature. */
@@ -1561,7 +1506,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1561 unsigned int ioaddr = dev->base_addr; 1506 unsigned int ioaddr = dev->base_addr;
1562 struct mii_ioctl_data *data = if_mii(rq); 1507 struct mii_ioctl_data *data = if_mii(rq);
1563 1508
1564 DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", 1509 pr_debug("%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n",
1565 dev->name, rq->ifr_ifrn.ifrn_name, cmd, 1510 dev->name, rq->ifr_ifrn.ifrn_name, cmd,
1566 data->phy_id, data->reg_num, data->val_in, data->val_out); 1511 data->phy_id, data->reg_num, data->val_in, data->val_out);
1567 1512
@@ -1610,7 +1555,7 @@ do_reset(struct net_device *dev, int full)
1610 unsigned int ioaddr = dev->base_addr; 1555 unsigned int ioaddr = dev->base_addr;
1611 unsigned value; 1556 unsigned value;
1612 1557
1613 DEBUG(0, "%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full); 1558 pr_debug("%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full);
1614 1559
1615 hardreset(dev); 1560 hardreset(dev);
1616 PutByte(XIRCREG_CR, SoftReset); /* set */ 1561 PutByte(XIRCREG_CR, SoftReset); /* set */
@@ -1648,8 +1593,8 @@ do_reset(struct net_device *dev, int full)
1648 } 1593 }
1649 msleep(40); /* wait 40 msec to let it complete */ 1594 msleep(40); /* wait 40 msec to let it complete */
1650 1595
1651 #ifdef PCMCIA_DEBUG 1596 #if 0
1652 if (pc_debug) { 1597 {
1653 SelectPage(0); 1598 SelectPage(0);
1654 value = GetByte(XIRCREG_ESR); /* read the ESR */ 1599 value = GetByte(XIRCREG_ESR); /* read the ESR */
1655 printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); 1600 printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value);
@@ -1666,7 +1611,7 @@ do_reset(struct net_device *dev, int full)
1666 value |= DisableLinkPulse; 1611 value |= DisableLinkPulse;
1667 PutByte(XIRCREG1_ECR, value); 1612 PutByte(XIRCREG1_ECR, value);
1668 #endif 1613 #endif
1669 DEBUG(0, "%s: ECR is: %#02x\n", dev->name, value); 1614 pr_debug("%s: ECR is: %#02x\n", dev->name, value);
1670 1615
1671 SelectPage(0x42); 1616 SelectPage(0x42);
1672 PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */ 1617 PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */
@@ -1844,7 +1789,7 @@ do_powerdown(struct net_device *dev)
1844 1789
1845 unsigned int ioaddr = dev->base_addr; 1790 unsigned int ioaddr = dev->base_addr;
1846 1791
1847 DEBUG(0, "do_powerdown(%p)\n", dev); 1792 pr_debug("do_powerdown(%p)\n", dev);
1848 1793
1849 SelectPage(4); 1794 SelectPage(4);
1850 PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ 1795 PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */
@@ -1858,7 +1803,7 @@ do_stop(struct net_device *dev)
1858 local_info_t *lp = netdev_priv(dev); 1803 local_info_t *lp = netdev_priv(dev);
1859 struct pcmcia_device *link = lp->p_dev; 1804 struct pcmcia_device *link = lp->p_dev;
1860 1805
1861 DEBUG(0, "do_stop(%p)\n", dev); 1806 dev_dbg(&link->dev, "do_stop(%p)\n", dev);
1862 1807
1863 if (!link) 1808 if (!link)
1864 return -ENODEV; 1809 return -ENODEV;