Lines Matching refs:card
113 static void xircom_up(struct xircom_private *card);
118 static void investigate_read_descriptor(struct net_device *dev,struct xircom_private *card, int des…
119 static void investigate_write_descriptor(struct net_device *dev, struct xircom_private *card, int d…
120 static void read_mac_address(struct xircom_private *card);
121 static void transceiver_voodoo(struct xircom_private *card);
122 static void initialize_card(struct xircom_private *card);
123 static void trigger_transmit(struct xircom_private *card);
124 static void trigger_receive(struct xircom_private *card);
125 static void setup_descriptors(struct xircom_private *card);
126 static void remove_descriptors(struct xircom_private *card);
127 static int link_status_changed(struct xircom_private *card);
128 static void activate_receiver(struct xircom_private *card);
129 static void deactivate_receiver(struct xircom_private *card);
130 static void activate_transmitter(struct xircom_private *card);
131 static void deactivate_transmitter(struct xircom_private *card);
132 static void enable_transmit_interrupt(struct xircom_private *card);
133 static void enable_receive_interrupt(struct xircom_private *card);
134 static void enable_link_interrupt(struct xircom_private *card);
135 static void disable_all_interrupts(struct xircom_private *card);
136 static int link_status(struct xircom_private *card);
312 struct xircom_private *card = netdev_priv(dev); in xircom_remove() local
316 pci_iounmap(pdev, card->ioaddr); in xircom_remove()
317 dma_free_coherent(d, 8192, card->tx_buffer, card->tx_dma_handle); in xircom_remove()
318 dma_free_coherent(d, 8192, card->rx_buffer, card->rx_dma_handle); in xircom_remove()
327 struct xircom_private *card = netdev_priv(dev); in xircom_interrupt() local
328 void __iomem *ioaddr = card->ioaddr; in xircom_interrupt()
332 spin_lock(&card->lock); in xircom_interrupt()
338 card->tx_buffer[0], card->tx_buffer[4]); in xircom_interrupt()
340 card->rx_buffer[0], card->rx_buffer[4]); in xircom_interrupt()
344 spin_unlock(&card->lock); in xircom_interrupt()
348 if (link_status_changed(card)) { in xircom_interrupt()
351 newlink = link_status(card); in xircom_interrupt()
367 investigate_write_descriptor(dev,card,i,bufferoffsets[i]); in xircom_interrupt()
369 investigate_read_descriptor(dev,card,i,bufferoffsets[i]); in xircom_interrupt()
371 spin_unlock(&card->lock); in xircom_interrupt()
378 struct xircom_private *card; in xircom_start_xmit() local
383 card = netdev_priv(dev); in xircom_start_xmit()
384 spin_lock_irqsave(&card->lock,flags); in xircom_start_xmit()
388 investigate_write_descriptor(dev,card,desc,bufferoffsets[desc]); in xircom_start_xmit()
391 nextdescriptor = (card->transmit_used +1) % (NUMDESCRIPTORS); in xircom_start_xmit()
392 desc = card->transmit_used; in xircom_start_xmit()
395 if (card->tx_buffer[4*desc]==0) { in xircom_start_xmit()
399 memset(&card->tx_buffer[bufferoffsets[desc]/4],0,1536); in xircom_start_xmit()
401 &(card->tx_buffer[bufferoffsets[desc] / 4]), in xircom_start_xmit()
406 card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len); in xircom_start_xmit()
408 card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25); in xircom_start_xmit()
410 card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000); in xircom_start_xmit()
412 card->tx_skb[desc] = skb; in xircom_start_xmit()
416 card->tx_buffer[4*desc] = cpu_to_le32(0x80000000); in xircom_start_xmit()
417 trigger_transmit(card); in xircom_start_xmit()
418 if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) { in xircom_start_xmit()
422 card->transmit_used = nextdescriptor; in xircom_start_xmit()
423 spin_unlock_irqrestore(&card->lock,flags); in xircom_start_xmit()
429 spin_unlock_irqrestore(&card->lock,flags); in xircom_start_xmit()
430 trigger_transmit(card); in xircom_start_xmit()
457 struct xircom_private *card; in xircom_close() local
460 card = netdev_priv(dev); in xircom_close()
464 spin_lock_irqsave(&card->lock,flags); in xircom_close()
466 disable_all_interrupts(card); in xircom_close()
469 deactivate_receiver(card); in xircom_close()
470 deactivate_transmitter(card); in xircom_close()
472 remove_descriptors(card); in xircom_close()
474 spin_unlock_irqrestore(&card->lock,flags); in xircom_close()
476 card->open = 0; in xircom_close()
477 free_irq(card->pdev->irq, dev); in xircom_close()
497 static void initialize_card(struct xircom_private *card) in initialize_card() argument
499 void __iomem *ioaddr = card->ioaddr; in initialize_card()
503 spin_lock_irqsave(&card->lock, flags); in initialize_card()
522 disable_all_interrupts(card); in initialize_card()
523 deactivate_receiver(card); in initialize_card()
524 deactivate_transmitter(card); in initialize_card()
526 spin_unlock_irqrestore(&card->lock, flags); in initialize_card()
535 static void trigger_transmit(struct xircom_private *card) in trigger_transmit() argument
537 void __iomem *ioaddr = card->ioaddr; in trigger_transmit()
549 static void trigger_receive(struct xircom_private *card) in trigger_receive() argument
551 void __iomem *ioaddr = card->ioaddr; in trigger_receive()
560 static void setup_descriptors(struct xircom_private *card) in setup_descriptors() argument
562 void __iomem *ioaddr = card->ioaddr; in setup_descriptors()
566 BUG_ON(card->rx_buffer == NULL); in setup_descriptors()
567 BUG_ON(card->tx_buffer == NULL); in setup_descriptors()
570 memset(card->rx_buffer, 0, 128); /* clear the descriptors */ in setup_descriptors()
574 card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000); in setup_descriptors()
576 card->rx_buffer[i*4 + 1] = cpu_to_le32(1536); in setup_descriptors()
578 card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25); in setup_descriptors()
583 address = card->rx_dma_handle; in setup_descriptors()
584 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); in setup_descriptors()
586 card->rx_buffer[i*4 + 3] = 0; in setup_descriptors()
591 address = card->rx_dma_handle; in setup_descriptors()
596 memset(card->tx_buffer, 0, 128); /* clear the descriptors */ in setup_descriptors()
600 card->tx_buffer[i*4 + 0] = 0x00000000; in setup_descriptors()
602 card->tx_buffer[i*4 + 1] = cpu_to_le32(1536); in setup_descriptors()
604 card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25); in setup_descriptors()
608 address = card->tx_dma_handle; in setup_descriptors()
609 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); in setup_descriptors()
611 card->tx_buffer[i*4 + 3] = 0; in setup_descriptors()
616 address = card->tx_dma_handle; in setup_descriptors()
624 static void remove_descriptors(struct xircom_private *card) in remove_descriptors() argument
626 void __iomem *ioaddr = card->ioaddr; in remove_descriptors()
640 static int link_status_changed(struct xircom_private *card) in link_status_changed() argument
642 void __iomem *ioaddr = card->ioaddr; in link_status_changed()
662 static int transmit_active(struct xircom_private *card) in transmit_active() argument
664 void __iomem *ioaddr = card->ioaddr; in transmit_active()
676 static int receive_active(struct xircom_private *card) in receive_active() argument
678 void __iomem *ioaddr = card->ioaddr; in receive_active()
696 static void activate_receiver(struct xircom_private *card) in activate_receiver() argument
698 void __iomem *ioaddr = card->ioaddr; in activate_receiver()
706 if ((val&2) && (receive_active(card))) in activate_receiver()
715 if (!receive_active(card)) in activate_receiver()
721 netdev_err(card->dev, "Receiver failed to deactivate\n"); in activate_receiver()
732 if (receive_active(card)) in activate_receiver()
738 netdev_err(card->dev, in activate_receiver()
750 static void deactivate_receiver(struct xircom_private *card) in deactivate_receiver() argument
752 void __iomem *ioaddr = card->ioaddr; in deactivate_receiver()
762 if (!receive_active(card)) in deactivate_receiver()
768 netdev_err(card->dev, "Receiver failed to deactivate\n"); in deactivate_receiver()
783 static void activate_transmitter(struct xircom_private *card) in activate_transmitter() argument
785 void __iomem *ioaddr = card->ioaddr; in activate_transmitter()
793 if ((val&(1<<13)) && (transmit_active(card))) in activate_transmitter()
801 if (!transmit_active(card)) in activate_transmitter()
807 netdev_err(card->dev, in activate_transmitter()
819 if (transmit_active(card)) in activate_transmitter()
825 netdev_err(card->dev, in activate_transmitter()
837 static void deactivate_transmitter(struct xircom_private *card) in deactivate_transmitter() argument
839 void __iomem *ioaddr = card->ioaddr; in deactivate_transmitter()
849 if (!transmit_active(card)) in deactivate_transmitter()
855 netdev_err(card->dev, in deactivate_transmitter()
866 static void enable_transmit_interrupt(struct xircom_private *card) in enable_transmit_interrupt() argument
868 void __iomem *ioaddr = card->ioaddr; in enable_transmit_interrupt()
882 static void enable_receive_interrupt(struct xircom_private *card) in enable_receive_interrupt() argument
884 void __iomem *ioaddr = card->ioaddr; in enable_receive_interrupt()
897 static void enable_link_interrupt(struct xircom_private *card) in enable_link_interrupt() argument
899 void __iomem *ioaddr = card->ioaddr; in enable_link_interrupt()
914 static void disable_all_interrupts(struct xircom_private *card) in disable_all_interrupts() argument
916 void __iomem *ioaddr = card->ioaddr; in disable_all_interrupts()
926 static void enable_common_interrupts(struct xircom_private *card) in enable_common_interrupts() argument
928 void __iomem *ioaddr = card->ioaddr; in enable_common_interrupts()
948 static int enable_promisc(struct xircom_private *card) in enable_promisc() argument
950 void __iomem *ioaddr = card->ioaddr; in enable_promisc()
968 static int link_status(struct xircom_private *card) in link_status() argument
970 void __iomem *ioaddr = card->ioaddr; in link_status()
996 static void read_mac_address(struct xircom_private *card) in read_mac_address() argument
998 void __iomem *ioaddr = card->ioaddr; in read_mac_address()
1003 spin_lock_irqsave(&card->lock, flags); in read_mac_address()
1025 eth_hw_addr_set(card->dev, addr); in read_mac_address()
1031 spin_unlock_irqrestore(&card->lock, flags); in read_mac_address()
1032 pr_debug(" %pM\n", card->dev->dev_addr); in read_mac_address()
1041 static void transceiver_voodoo(struct xircom_private *card) in transceiver_voodoo() argument
1043 void __iomem *ioaddr = card->ioaddr; in transceiver_voodoo()
1047 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); in transceiver_voodoo()
1049 setup_descriptors(card); in transceiver_voodoo()
1051 spin_lock_irqsave(&card->lock, flags); in transceiver_voodoo()
1060 spin_unlock_irqrestore(&card->lock, flags); in transceiver_voodoo()
1062 netif_start_queue(card->dev); in transceiver_voodoo()
1066 static void xircom_up(struct xircom_private *card) in xircom_up() argument
1072 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); in xircom_up()
1074 setup_descriptors(card); in xircom_up()
1076 spin_lock_irqsave(&card->lock, flags); in xircom_up()
1079 enable_link_interrupt(card); in xircom_up()
1080 enable_transmit_interrupt(card); in xircom_up()
1081 enable_receive_interrupt(card); in xircom_up()
1082 enable_common_interrupts(card); in xircom_up()
1083 enable_promisc(card); in xircom_up()
1087 investigate_read_descriptor(card->dev,card,i,bufferoffsets[i]); in xircom_up()
1090 spin_unlock_irqrestore(&card->lock, flags); in xircom_up()
1091 trigger_receive(card); in xircom_up()
1092 trigger_transmit(card); in xircom_up()
1093 netif_start_queue(card->dev); in xircom_up()
1098 investigate_read_descriptor(struct net_device *dev, struct xircom_private *card, in investigate_read_descriptor() argument
1103 status = le32_to_cpu(card->rx_buffer[4*descnr]); in investigate_read_descriptor()
1125 &card->rx_buffer[bufferoffset / 4], in investigate_read_descriptor()
1135 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000); in investigate_read_descriptor()
1136 trigger_receive(card); in investigate_read_descriptor()
1144 struct xircom_private *card, in investigate_write_descriptor() argument
1149 status = le32_to_cpu(card->tx_buffer[4*descnr]); in investigate_write_descriptor()
1153 card->tx_buffer[4*descnr] = 0; in investigate_write_descriptor()
1158 if (card->tx_skb[descnr]!=NULL) { in investigate_write_descriptor()
1159 dev->stats.tx_bytes += card->tx_skb[descnr]->len; in investigate_write_descriptor()
1160 dev_kfree_skb_irq(card->tx_skb[descnr]); in investigate_write_descriptor()
1162 card->tx_skb[descnr] = NULL; in investigate_write_descriptor()
1166 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ in investigate_write_descriptor()