Lines Matching refs:mite

206 static unsigned int mite_fifo_size(struct mite *mite, unsigned int channel)  in mite_fifo_size()  argument
208 unsigned int fcr_bits = readl(mite->mmio + MITE_FCR(channel)); in mite_fifo_size()
217 struct mite *mite = mite_chan->mite; in mite_device_bytes_transferred() local
219 return readl(mite->mmio + MITE_DAR(mite_chan->channel)); in mite_device_bytes_transferred()
228 struct mite *mite = mite_chan->mite; in mite_bytes_in_transit() local
230 return readl(mite->mmio + MITE_FCR(mite_chan->channel)) & 0xff; in mite_bytes_in_transit()
362 struct mite *mite = mite_chan->mite; in mite_get_status() local
366 spin_lock_irqsave(&mite->lock, flags); in mite_get_status()
367 status = readl(mite->mmio + MITE_CHSR(mite_chan->channel)); in mite_get_status()
371 mite->mmio + MITE_CHOR(mite_chan->channel)); in mite_get_status()
373 spin_unlock_irqrestore(&mite->lock, flags); in mite_get_status()
389 struct mite *mite = mite_chan->mite; in mite_ack_linkc() local
394 writel(CHOR_CLRLC, mite->mmio + MITE_CHOR(mite_chan->channel)); in mite_ack_linkc()
416 struct mite *mite = mite_chan->mite; in mite_done() local
421 spin_lock_irqsave(&mite->lock, flags); in mite_done()
423 spin_unlock_irqrestore(&mite->lock, flags); in mite_done()
431 mite_chan->mite->mmio + MITE_CHOR(mite_chan->channel)); in mite_dma_reset()
440 struct mite *mite = mite_chan->mite; in mite_dma_arm() local
448 spin_lock_irqsave(&mite->lock, flags); in mite_dma_arm()
451 writel(CHOR_START, mite->mmio + MITE_CHOR(mite_chan->channel)); in mite_dma_arm()
452 spin_unlock_irqrestore(&mite->lock, flags); in mite_dma_arm()
462 struct mite *mite = mite_chan->mite; in mite_dma_disarm() local
465 writel(CHOR_ABORT, mite->mmio + MITE_CHOR(mite_chan->channel)); in mite_dma_disarm()
478 struct mite *mite = mite_chan->mite; in mite_prep_dma() local
508 writel(chcr, mite->mmio + MITE_CHCR(mite_chan->channel)); in mite_prep_dma()
526 writel(mcr, mite->mmio + MITE_MCR(mite_chan->channel)); in mite_prep_dma()
545 writel(dcr, mite->mmio + MITE_DCR(mite_chan->channel)); in mite_prep_dma()
548 writel(0, mite->mmio + MITE_DAR(mite_chan->channel)); in mite_prep_dma()
552 writel(lkcr, mite->mmio + MITE_LKCR(mite_chan->channel)); in mite_prep_dma()
556 mite->mmio + MITE_LKAR(mite_chan->channel)); in mite_prep_dma()
567 struct mite_channel *mite_request_channel_in_range(struct mite *mite, in mite_request_channel_in_range() argument
580 spin_lock_irqsave(&mite->lock, flags); in mite_request_channel_in_range()
582 mite_chan = &mite->channels[i]; in mite_request_channel_in_range()
589 spin_unlock_irqrestore(&mite->lock, flags); in mite_request_channel_in_range()
599 struct mite_channel *mite_request_channel(struct mite *mite, in mite_request_channel() argument
602 return mite_request_channel_in_range(mite, ring, 0, in mite_request_channel()
603 mite->num_channels - 1); in mite_request_channel()
613 struct mite *mite = mite_chan->mite; in mite_release_channel() local
617 spin_lock_irqsave(&mite->lock, flags); in mite_release_channel()
629 mite->mmio + MITE_CHCR(mite_chan->channel)); in mite_release_channel()
632 spin_unlock_irqrestore(&mite->lock, flags); in mite_release_channel()
748 struct mite_ring *mite_alloc_ring(struct mite *mite) in mite_alloc_ring() argument
755 ring->hw_dev = get_device(&mite->pcidev->dev); in mite_alloc_ring()
781 static int mite_setup(struct comedi_device *dev, struct mite *mite, in mite_setup() argument
791 pci_set_master(mite->pcidev); in mite_setup()
793 mite->mmio = pci_ioremap_bar(mite->pcidev, 0); in mite_setup()
794 if (!mite->mmio) in mite_setup()
797 dev->mmio = pci_ioremap_bar(mite->pcidev, 1); in mite_setup()
800 daq_phys_addr = pci_resource_start(mite->pcidev, 1); in mite_setup()
801 length = pci_resource_len(mite->pcidev, 1); in mite_setup()
804 writel(0, mite->mmio + MITE_IODWBSR); in mite_setup()
809 mite->mmio + MITE_IODWBSR_1); in mite_setup()
810 writel(0, mite->mmio + MITE_IODWCR_1); in mite_setup()
812 writel(daq_phys_addr | WENAB, mite->mmio + MITE_IODWBSR); in mite_setup()
825 unknown_dma_burst_bits = readl(mite->mmio + MITE_UNKNOWN_DMA_BURST_REG); in mite_setup()
827 writel(unknown_dma_burst_bits, mite->mmio + MITE_UNKNOWN_DMA_BURST_REG); in mite_setup()
829 csigr_bits = readl(mite->mmio + MITE_CSIGR); in mite_setup()
830 mite->num_channels = CSIGR_TO_DMAC(csigr_bits); in mite_setup()
831 if (mite->num_channels > MAX_MITE_DMA_CHANNELS) { in mite_setup()
834 mite->num_channels, MAX_MITE_DMA_CHANNELS); in mite_setup()
835 mite->num_channels = MAX_MITE_DMA_CHANNELS; in mite_setup()
852 for (i = 0; i < mite->num_channels; i++) { in mite_setup()
853 writel(CHOR_DMARESET, mite->mmio + MITE_CHOR(i)); in mite_setup()
858 mite->mmio + MITE_CHCR(i)); in mite_setup()
860 mite->fifo_size = mite_fifo_size(mite, 0); in mite_setup()
861 dev_dbg(dev->class_dev, "mite: fifo size is %i.\n", mite->fifo_size); in mite_setup()
875 struct mite *mite_attach(struct comedi_device *dev, bool use_win1) in mite_attach()
878 struct mite *mite; in mite_attach() local
882 mite = kzalloc(sizeof(*mite), GFP_KERNEL); in mite_attach()
883 if (!mite) in mite_attach()
886 spin_lock_init(&mite->lock); in mite_attach()
887 mite->pcidev = pcidev; in mite_attach()
889 mite->channels[i].mite = mite; in mite_attach()
890 mite->channels[i].channel = i; in mite_attach()
891 mite->channels[i].done = 1; in mite_attach()
894 ret = mite_setup(dev, mite, use_win1); in mite_attach()
896 if (mite->mmio) in mite_attach()
897 iounmap(mite->mmio); in mite_attach()
898 kfree(mite); in mite_attach()
902 return mite; in mite_attach()
912 void mite_detach(struct mite *mite) in mite_detach() argument
914 if (!mite) in mite_detach()
917 if (mite->mmio) in mite_detach()
918 iounmap(mite->mmio); in mite_detach()
920 kfree(mite); in mite_detach()