Lines Matching +full:de +full:- +full:activated
2 * xircom_cb: A driver for the (tulip-like) Xircom Cardbus ethernet cards
7 * Written by Arjan van de Ven for Red Hat, Inc.
40 MODULE_AUTHOR("Arjan van de Ven <arjanv@redhat.com>");
77 /* Send and receive buffers, kernel-addressable and dma addressable forms */
161 for (i=31;i>=0;i--) { in print_binary()
193 struct device *d = &pdev->dev; in xircom_probe()
217 pr_err("%s: failed to allocate io-region\n", __func__); in xircom_probe()
221 rc = -ENOMEM; in xircom_probe()
234 private->rx_buffer = dma_alloc_coherent(d, 8192, in xircom_probe()
235 &private->rx_dma_handle, in xircom_probe()
237 if (private->rx_buffer == NULL) in xircom_probe()
240 private->tx_buffer = dma_alloc_coherent(d, 8192, in xircom_probe()
241 &private->tx_dma_handle, in xircom_probe()
243 if (private->tx_buffer == NULL) in xircom_probe()
246 SET_NETDEV_DEV(dev, &pdev->dev); in xircom_probe()
249 private->dev = dev; in xircom_probe()
250 private->pdev = pdev; in xircom_probe()
253 private->ioaddr = pci_iomap(pdev, 0, 0); in xircom_probe()
254 if (!private->ioaddr) in xircom_probe()
257 spin_lock_init(&private->lock); in xircom_probe()
263 dev->netdev_ops = &netdev_ops; in xircom_probe()
273 pdev->revision, pdev->irq); in xircom_probe()
278 spin_lock_irqsave(&private->lock,flags); in xircom_probe()
281 spin_unlock_irqrestore(&private->lock,flags); in xircom_probe()
288 pci_iounmap(pdev, private->ioaddr); in xircom_probe()
290 dma_free_coherent(d, 8192, private->tx_buffer, private->tx_dma_handle); in xircom_probe()
292 dma_free_coherent(d, 8192, private->rx_buffer, private->rx_dma_handle); in xircom_probe()
304 xircom_remove is called on module-unload or on device-eject.
305 it unregisters the irq, io-region and network device.
313 struct device *d = &pdev->dev; in xircom_remove()
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()
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()
371 spin_unlock(&card->lock); in xircom_interrupt()
384 spin_lock_irqsave(&card->lock,flags); 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()
402 skb->len); in xircom_start_xmit()
406 card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len); in xircom_start_xmit()
407 if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */ 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()
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()
441 const int irq = xp->pdev->irq; in xircom_open()
445 retval = request_irq(irq, xircom_interrupt, IRQF_SHARED, dev->name, dev); in xircom_open()
450 xp->open = 1; in xircom_open()
464 spin_lock_irqsave(&card->lock,flags); 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()
488 const int irq = xp->pdev->irq; in xircom_poll_controller()
499 void __iomem *ioaddr = card->ioaddr; in initialize_card()
503 spin_lock_irqsave(&card->lock, flags); in initialize_card()
526 spin_unlock_irqrestore(&card->lock, flags); in initialize_card()
537 void __iomem *ioaddr = card->ioaddr; in trigger_transmit()
551 void __iomem *ioaddr = card->ioaddr; in trigger_receive()
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()
573 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ 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()
577 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */ 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()
585 /* Rx Desc3: address of 2nd buffer -> 0 */ 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()
599 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ 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()
603 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */ 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()
610 /* Tx Desc3: address of 2nd buffer -> 0 */ in setup_descriptors()
611 card->tx_buffer[i*4 + 3] = 0; in setup_descriptors()
616 address = card->tx_dma_handle; in setup_descriptors()
626 void __iomem *ioaddr = card->ioaddr; in remove_descriptors()
638 This function also clears the status-bit.
642 void __iomem *ioaddr = card->ioaddr; in link_status_changed()
660 in a non-stopped state.
664 void __iomem *ioaddr = card->ioaddr; in transmit_active()
674 in a non-stopped state.
678 void __iomem *ioaddr = card->ioaddr; in receive_active()
689 must be completely de-activated. To achieve this,
698 void __iomem *ioaddr = card->ioaddr; in activate_receiver()
719 counter--; in activate_receiver()
721 netdev_err(card->dev, "Receiver failed to deactivate\n"); in activate_receiver()
736 counter--; in activate_receiver()
738 netdev_err(card->dev, in activate_receiver()
739 "Receiver failed to re-activate\n"); in activate_receiver()
752 void __iomem *ioaddr = card->ioaddr; in deactivate_receiver()
766 counter--; in deactivate_receiver()
768 netdev_err(card->dev, "Receiver failed to deactivate\n"); in deactivate_receiver()
776 must be completely de-activated. To achieve this,
785 void __iomem *ioaddr = card->ioaddr; in activate_transmitter()
805 counter--; in activate_transmitter()
807 netdev_err(card->dev, in activate_transmitter()
823 counter--; in activate_transmitter()
825 netdev_err(card->dev, in activate_transmitter()
826 "Transmitter failed to re-activate\n"); in activate_transmitter()
839 void __iomem *ioaddr = card->ioaddr; in deactivate_transmitter()
853 counter--; in deactivate_transmitter()
855 netdev_err(card->dev, in deactivate_transmitter()
868 void __iomem *ioaddr = card->ioaddr; in enable_transmit_interrupt()
884 void __iomem *ioaddr = card->ioaddr; in enable_receive_interrupt()
899 void __iomem *ioaddr = card->ioaddr; in enable_link_interrupt()
916 void __iomem *ioaddr = card->ioaddr; in disable_all_interrupts()
928 void __iomem *ioaddr = card->ioaddr; in enable_common_interrupts()
950 void __iomem *ioaddr = card->ioaddr; in enable_promisc()
970 void __iomem *ioaddr = card->ioaddr; in link_status()
982 /* If we get here -> no link at all */ in link_status()
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()
1038 it's called voodoo as I stole this code and cannot cross-reference
1043 void __iomem *ioaddr = card->ioaddr; in transceiver_voodoo()
1047 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); 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()
1072 pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); in xircom_up()
1076 spin_lock_irqsave(&card->lock, flags); 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()
1093 netif_start_queue(card->dev); in xircom_up()
1103 status = le32_to_cpu(card->rx_buffer[4*descnr]); in investigate_read_descriptor()
1109 short pkt_len = ((status >> 16) & 0x7ff) - 4; in investigate_read_descriptor()
1120 dev->stats.rx_dropped++; in investigate_read_descriptor()
1125 &card->rx_buffer[bufferoffset / 4], in investigate_read_descriptor()
1128 skb->protocol = eth_type_trans(skb, dev); in investigate_read_descriptor()
1130 dev->stats.rx_packets++; in investigate_read_descriptor()
1131 dev->stats.rx_bytes += pkt_len; in investigate_read_descriptor()
1135 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000); in investigate_read_descriptor()
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()
1165 dev->stats.collisions++; in investigate_write_descriptor()
1166 card->tx_buffer[4*descnr] = 0; /* descriptor is free again */ in investigate_write_descriptor()
1168 dev->stats.tx_packets++; in investigate_write_descriptor()