Lines Matching full:lynx
85 lynx_get(struct pcilynx *lynx) in lynx_get() argument
87 kref_get(&lynx->kref); in lynx_get()
89 return lynx; in lynx_get()
99 lynx_put(struct pcilynx *lynx) in lynx_put() argument
101 kref_put(&lynx->kref, lynx_release); in lynx_put()
105 struct pcilynx *lynx; member
145 list_empty(&client->lynx->link)) in packet_buffer_get()
216 reg_write(struct pcilynx *lynx, int offset, u32 data) in reg_write() argument
218 writel(data, lynx->registers + offset); in reg_write()
222 reg_read(struct pcilynx *lynx, int offset) in reg_read() argument
224 return readl(lynx->registers + offset); in reg_read()
228 reg_set_bits(struct pcilynx *lynx, int offset, u32 mask) in reg_set_bits() argument
230 reg_write(lynx, offset, (reg_read(lynx, offset) | mask)); in reg_set_bits()
238 run_pcl(struct pcilynx *lynx, dma_addr_t pcl_bus, in run_pcl() argument
241 reg_write(lynx, DMA0_CURRENT_PCL + dmachan * 0x20, pcl_bus); in run_pcl()
242 reg_write(lynx, DMA0_CHAN_CTRL + dmachan * 0x20, in run_pcl()
247 set_phy_reg(struct pcilynx *lynx, int addr, int val) in set_phy_reg() argument
250 dev_err(&lynx->pci_device->dev, in set_phy_reg()
255 dev_err(&lynx->pci_device->dev, in set_phy_reg()
259 reg_write(lynx, LINK_PHY, LINK_PHY_WRITE | in set_phy_reg()
270 struct pcilynx *tmp, *lynx = NULL; in nosy_open() local
275 lynx = lynx_get(tmp); in nosy_open()
279 if (lynx == NULL) in nosy_open()
287 client->lynx = lynx; in nosy_open()
298 lynx_put(lynx); in nosy_open()
307 struct pcilynx *lynx = client->lynx; in nosy_release() local
309 spin_lock_irq(&lynx->client_list_lock); in nosy_release()
311 spin_unlock_irq(&lynx->client_list_lock); in nosy_release()
315 lynx_put(lynx); in nosy_release()
331 if (list_empty(&client->lynx->link)) in nosy_poll()
349 spinlock_t *client_list_lock = &client->lynx->client_list_lock; in nosy_ioctl()
369 list_add_tail(&client->link, &client->lynx->client_list); in nosy_ioctl()
408 packet_irq_handler(struct pcilynx *lynx) in packet_irq_handler() argument
417 length = __le32_to_cpu(lynx->rcv_pcl->pcl_status) & 0x00001fff; in packet_irq_handler()
418 tcode = __le32_to_cpu(lynx->rcv_buffer[1]) >> 4 & 0xf; in packet_irq_handler()
422 lynx->rcv_buffer[0] = (__force __le32)timestamp; in packet_irq_handler()
429 spin_lock(&lynx->client_list_lock); in packet_irq_handler()
431 list_for_each_entry(client, &lynx->client_list, link) in packet_irq_handler()
434 lynx->rcv_buffer, length + 4); in packet_irq_handler()
436 spin_unlock(&lynx->client_list_lock); in packet_irq_handler()
440 bus_reset_irq_handler(struct pcilynx *lynx) in bus_reset_irq_handler() argument
449 spin_lock(&lynx->client_list_lock); in bus_reset_irq_handler()
451 list_for_each_entry(client, &lynx->client_list, link) in bus_reset_irq_handler()
454 spin_unlock(&lynx->client_list_lock); in bus_reset_irq_handler()
460 struct pcilynx *lynx = device; in irq_handler() local
463 pci_int_status = reg_read(lynx, PCI_INT_STATUS); in irq_handler()
476 link_int_status = reg_read(lynx, LINK_INT_STATUS); in irq_handler()
477 reg_write(lynx, LINK_INT_STATUS, link_int_status); in irq_handler()
480 bus_reset_irq_handler(lynx); in irq_handler()
487 reg_write(lynx, PCI_INT_STATUS, pci_int_status); in irq_handler()
490 packet_irq_handler(lynx); in irq_handler()
491 run_pcl(lynx, lynx->rcv_start_pcl_bus, 0); in irq_handler()
500 struct pcilynx *lynx = pci_get_drvdata(dev); in remove_card() local
504 list_del_init(&lynx->link); in remove_card()
505 misc_deregister(&lynx->misc); in remove_card()
508 reg_write(lynx, PCI_INT_ENABLE, 0); in remove_card()
509 free_irq(lynx->pci_device->irq, lynx); in remove_card()
511 spin_lock_irq(&lynx->client_list_lock); in remove_card()
512 list_for_each_entry(client, &lynx->client_list, link) in remove_card()
514 spin_unlock_irq(&lynx->client_list_lock); in remove_card()
516 dma_free_coherent(&lynx->pci_device->dev, sizeof(struct pcl), in remove_card()
517 lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus); in remove_card()
518 dma_free_coherent(&lynx->pci_device->dev, sizeof(struct pcl), in remove_card()
519 lynx->rcv_pcl, lynx->rcv_pcl_bus); in remove_card()
520 dma_free_coherent(&lynx->pci_device->dev, PAGE_SIZE, lynx->rcv_buffer, in remove_card()
521 lynx->rcv_buffer_bus); in remove_card()
523 iounmap(lynx->registers); in remove_card()
525 lynx_put(lynx); in remove_card()
533 struct pcilynx *lynx; in add_card() local
548 lynx = kzalloc(sizeof *lynx, GFP_KERNEL); in add_card()
549 if (lynx == NULL) { in add_card()
554 lynx->pci_device = dev; in add_card()
555 pci_set_drvdata(dev, lynx); in add_card()
557 spin_lock_init(&lynx->client_list_lock); in add_card()
558 INIT_LIST_HEAD(&lynx->client_list); in add_card()
559 kref_init(&lynx->kref); in add_card()
561 lynx->registers = ioremap(pci_resource_start(dev, 0), in add_card()
563 if (lynx->registers == NULL) { in add_card()
569 lynx->rcv_start_pcl = dma_alloc_coherent(&lynx->pci_device->dev, in add_card()
571 &lynx->rcv_start_pcl_bus, in add_card()
573 lynx->rcv_pcl = dma_alloc_coherent(&lynx->pci_device->dev, in add_card()
575 &lynx->rcv_pcl_bus, GFP_KERNEL); in add_card()
576 lynx->rcv_buffer = dma_alloc_coherent(&lynx->pci_device->dev, in add_card()
578 &lynx->rcv_buffer_bus, GFP_KERNEL); in add_card()
579 if (lynx->rcv_start_pcl == NULL || in add_card()
580 lynx->rcv_pcl == NULL || in add_card()
581 lynx->rcv_buffer == NULL) { in add_card()
586 lynx->rcv_start_pcl->next = cpu_to_le32(lynx->rcv_pcl_bus); in add_card()
587 lynx->rcv_pcl->next = cpu_to_le32(PCL_NEXT_INVALID); in add_card()
588 lynx->rcv_pcl->async_error_next = cpu_to_le32(PCL_NEXT_INVALID); in add_card()
590 lynx->rcv_pcl->buffer[0].control = in add_card()
592 lynx->rcv_pcl->buffer[0].pointer = in add_card()
593 cpu_to_le32(lynx->rcv_buffer_bus + 4); in add_card()
594 p = lynx->rcv_buffer_bus + 2048; in add_card()
595 end = lynx->rcv_buffer_bus + RCV_BUFFER_SIZE; in add_card()
597 lynx->rcv_pcl->buffer[i].control = in add_card()
599 lynx->rcv_pcl->buffer[i].pointer = cpu_to_le32(p); in add_card()
601 lynx->rcv_pcl->buffer[i - 1].control |= cpu_to_le32(PCL_LAST_BUFF); in add_card()
603 reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET); in add_card()
605 reg_write(lynx, DMA0_CHAN_CTRL, 0); in add_card()
606 reg_write(lynx, DMA_GLOBAL_REGISTER, 0x00 << 24); in add_card()
610 if ((get_phy_reg(lynx, 2) & 0xe0) == 0xe0) { in add_card()
611 lynx->phyic.reg_1394a = 1; in add_card()
612 PRINT(KERN_INFO, lynx->id, in add_card()
614 lynx->phyic.vendor = get_phy_vendorid(lynx); in add_card()
615 lynx->phyic.product = get_phy_productid(lynx); in add_card()
617 lynx->phyic.reg_1394a = 0; in add_card()
618 PRINT(KERN_INFO, lynx->id, "found old 1394 PHY"); in add_card()
623 reg_write(lynx, FIFO_SIZES, 255); in add_card()
625 reg_set_bits(lynx, PCI_INT_ENABLE, PCI_INT_DMA_ALL); in add_card()
627 reg_write(lynx, LINK_INT_ENABLE, in add_card()
635 set_phy_reg(lynx, 4, 0); in add_card()
638 reg_set_bits(lynx, LINK_CONTROL, LINK_CONTROL_SNOOP_ENABLE); in add_card()
640 run_pcl(lynx, lynx->rcv_start_pcl_bus, 0); in add_card()
643 driver_name, lynx)) { in add_card()
650 lynx->misc.parent = &dev->dev; in add_card()
651 lynx->misc.minor = MISC_DYNAMIC_MINOR; in add_card()
652 lynx->misc.name = "nosy"; in add_card()
653 lynx->misc.fops = &nosy_ops; in add_card()
656 ret = misc_register(&lynx->misc); in add_card()
662 list_add_tail(&lynx->link, &card_list); in add_card()
671 reg_write(lynx, PCI_INT_ENABLE, 0); in add_card()
672 free_irq(lynx->pci_device->irq, lynx); in add_card()
675 if (lynx->rcv_start_pcl) in add_card()
676 dma_free_coherent(&lynx->pci_device->dev, sizeof(struct pcl), in add_card()
677 lynx->rcv_start_pcl, in add_card()
678 lynx->rcv_start_pcl_bus); in add_card()
679 if (lynx->rcv_pcl) in add_card()
680 dma_free_coherent(&lynx->pci_device->dev, sizeof(struct pcl), in add_card()
681 lynx->rcv_pcl, lynx->rcv_pcl_bus); in add_card()
682 if (lynx->rcv_buffer) in add_card()
683 dma_free_coherent(&lynx->pci_device->dev, PAGE_SIZE, in add_card()
684 lynx->rcv_buffer, lynx->rcv_buffer_bus); in add_card()
685 iounmap(lynx->registers); in add_card()
688 kfree(lynx); in add_card()