Searched refs:mite (Results 1 - 13 of 13) sorted by relevance

/linux-4.1.27/drivers/staging/comedi/drivers/
H A Dmite.c2 comedi/drivers/mite.c
53 #include "mite.h"
59 struct mite_struct *mite; mite_alloc() local
62 mite = kzalloc(sizeof(*mite), GFP_KERNEL); mite_alloc()
63 if (mite) { mite_alloc()
64 spin_lock_init(&mite->lock); mite_alloc()
65 mite->pcidev = pcidev; mite_alloc()
67 mite->channels[i].mite = mite; mite_alloc()
68 mite->channels[i].channel = i; mite_alloc()
69 mite->channels[i].done = 1; mite_alloc()
72 return mite; mite_alloc()
78 pr_info("version = %i, type = %i, mite mode = %i, interface mode = %i\n", dump_chip_signature()
86 static unsigned mite_fifo_size(struct mite_struct *mite, unsigned channel) mite_fifo_size() argument
88 unsigned fcr_bits = readl(mite->mite_io_addr + MITE_FCR(channel)); mite_fifo_size()
96 struct mite_struct *mite, bool use_win1) mite_setup2()
103 pci_set_master(mite->pcidev); mite_setup2()
105 mite->mite_io_addr = pci_ioremap_bar(mite->pcidev, 0); mite_setup2()
106 if (!mite->mite_io_addr) { mite_setup2()
108 "Failed to remap mite io memory address\n"); mite_setup2()
111 mite->mite_phys_addr = pci_resource_start(mite->pcidev, 0); mite_setup2()
113 dev->mmio = pci_ioremap_bar(mite->pcidev, 1); mite_setup2()
119 mite->daq_phys_addr = pci_resource_start(mite->pcidev, 1); mite_setup2()
120 length = pci_resource_len(mite->pcidev, 1); mite_setup2()
123 writel(0, mite->mite_io_addr + MITE_IODWBSR); mite_setup2()
126 writel(mite->daq_phys_addr | WENAB | mite_setup2()
128 mite->mite_io_addr + MITE_IODWBSR_1); mite_setup2()
129 writel(0, mite->mite_io_addr + MITE_IODWCR_1); mite_setup2()
131 writel(mite->daq_phys_addr | WENAB, mite_setup2()
132 mite->mite_io_addr + MITE_IODWBSR); mite_setup2()
142 readl(mite->mite_io_addr + MITE_UNKNOWN_DMA_BURST_REG); mite_setup2()
145 mite->mite_io_addr + MITE_UNKNOWN_DMA_BURST_REG); mite_setup2()
147 csigr_bits = readl(mite->mite_io_addr + MITE_CSIGR); mite_setup2()
148 mite->num_channels = mite_csigr_dmac(csigr_bits); mite_setup2()
149 if (mite->num_channels > MAX_MITE_DMA_CHANNELS) { mite_setup2()
151 "mite: bug? chip claims to have %i dma channels. Setting to %i.\n", mite_setup2()
152 mite->num_channels, MAX_MITE_DMA_CHANNELS); mite_setup2()
153 mite->num_channels = MAX_MITE_DMA_CHANNELS; mite_setup2()
156 for (i = 0; i < mite->num_channels; i++) { mite_setup2()
157 writel(CHOR_DMARESET, mite->mite_io_addr + MITE_CHOR(i)); mite_setup2()
162 mite->mite_io_addr + MITE_CHCR(i)); mite_setup2()
164 mite->fifo_size = mite_fifo_size(mite, 0); mite_setup2()
165 dev_info(dev->class_dev, "fifo size is %i.\n", mite->fifo_size); mite_setup2()
170 void mite_detach(struct mite_struct *mite) mite_detach() argument
172 if (!mite) mite_detach()
175 if (mite->mite_io_addr) mite_detach()
176 iounmap(mite->mite_io_addr); mite_detach()
178 kfree(mite); mite_detach()
182 struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite_struct *mite) mite_alloc_ring() argument
189 ring->hw_dev = get_device(&mite->pcidev->dev); mite_alloc_ring()
217 struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite, mite_request_channel_in_range() argument
230 spin_lock_irqsave(&mite->lock, flags); mite_request_channel_in_range()
232 if (mite->channel_allocated[i] == 0) { mite_request_channel_in_range()
233 mite->channel_allocated[i] = 1; mite_request_channel_in_range()
234 channel = &mite->channels[i]; mite_request_channel_in_range()
239 spin_unlock_irqrestore(&mite->lock, flags); mite_request_channel_in_range()
246 struct mite_struct *mite = mite_chan->mite; mite_release_channel() local
250 spin_lock_irqsave(&mite->lock, flags); mite_release_channel()
251 if (mite->channel_allocated[mite_chan->channel]) { mite_release_channel()
262 mite->mite_io_addr + MITE_CHCR(mite_chan->channel)); mite_release_channel()
263 mite->channel_allocated[mite_chan->channel] = 0; mite_release_channel()
267 spin_unlock_irqrestore(&mite->lock, flags); mite_release_channel()
273 struct mite_struct *mite = mite_chan->mite; mite_dma_arm() local
279 * is done before writing to the mite to arm dma transfer mite_dma_arm()
284 spin_lock_irqsave(&mite->lock, flags); mite_dma_arm()
286 writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); mite_dma_arm()
288 spin_unlock_irqrestore(&mite->lock, flags); mite_dma_arm()
289 /* mite_dma_tcr(mite, channel); */ mite_dma_arm()
324 "mite: ring buffer allocation failed\n"); mite_buf_change()
353 struct mite_struct *mite = mite_chan->mite; mite_prep_dma() local
357 writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); mite_prep_dma()
376 * pxi-6281, which has mite version = 1, type = 4. This also mite_prep_dma()
384 writel(chcr, mite->mite_io_addr + MITE_CHCR(mite_chan->channel)); mite_prep_dma()
402 writel(mcr, mite->mite_io_addr + MITE_MCR(mite_chan->channel)); mite_prep_dma()
421 writel(dcr, mite->mite_io_addr + MITE_DCR(mite_chan->channel)); mite_prep_dma()
424 writel(0, mite->mite_io_addr + MITE_DAR(mite_chan->channel)); mite_prep_dma()
428 writel(lkcr, mite->mite_io_addr + MITE_LKCR(mite_chan->channel)); mite_prep_dma()
432 mite->mite_io_addr + MITE_LKAR(mite_chan->channel)); mite_prep_dma()
438 struct mite_struct *mite = mite_chan->mite; mite_device_bytes_transferred() local
440 return readl(mite->mite_io_addr + MITE_DAR(mite_chan->channel)); mite_device_bytes_transferred()
445 struct mite_struct *mite = mite_chan->mite; mite_bytes_in_transit() local
447 return readl(mite->mite_io_addr + mite_bytes_in_transit()
494 struct mite_struct *mite = mite_chan->mite; mite_dma_tcr() local
496 return readl(mite->mite_io_addr + MITE_TCR(mite_chan->channel)); mite_dma_tcr()
502 struct mite_struct *mite = mite_chan->mite; mite_dma_disarm() local
507 writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); mite_dma_disarm()
526 "mite: DMA overwrite of free area\n"); mite_sync_input_dma()
563 dev_warn(s->device->class_dev, "mite: DMA underrun\n"); mite_sync_output_dma()
581 struct mite_struct *mite = mite_chan->mite; mite_get_status() local
585 spin_lock_irqsave(&mite->lock, flags); mite_get_status()
586 status = readl(mite->mite_io_addr + MITE_CHSR(mite_chan->channel)); mite_get_status()
590 mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); mite_get_status()
593 spin_unlock_irqrestore(&mite->lock, flags); mite_get_status()
600 struct mite_struct *mite = mite_chan->mite; mite_done() local
605 spin_lock_irqsave(&mite->lock, flags); mite_done()
607 spin_unlock_irqrestore(&mite->lock, flags); mite_done()
95 mite_setup2(struct comedi_device *dev, struct mite_struct *mite, bool use_win1) mite_setup2() argument
H A Dmite.h2 module/mite.h
45 struct mite_struct *mite; member in struct:mite_channel
69 struct mite_struct *mite) mite_setup()
71 return mite_setup2(dev, mite, false); mite_setup()
74 void mite_detach(struct mite_struct *mite);
75 struct mite_dma_descriptor_ring *mite_alloc_ring(struct mite_struct *mite);
77 struct mite_channel *mite_request_channel_in_range(struct mite_struct *mite,
83 *mite, mite_request_channel()
88 return mite_request_channel_in_range(mite, ring, 0, mite_request_channel()
89 mite->num_channels - 1); mite_request_channel()
169 { /* original mite = 0, minimite = 1 */
174 { /* mite mode, minimite = 1 */ mite_csigr_mmode()
344 mite_chan->mite->mite_io_addr + MITE_CHOR(mite_chan->channel)); mite_dma_reset()
68 mite_setup(struct comedi_device *dev, struct mite_struct *mite) mite_setup() argument
82 mite_request_channel(struct mite_struct *mite, struct mite_dma_descriptor_ring *ring) mite_request_channel() argument
H A Dni_pcimio.c117 #include "mite.h"
1056 old_iodwbsr_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWBSR); m_series_init_eeprom_buffer()
1057 old_iodwbsr1_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWBSR_1); m_series_init_eeprom_buffer()
1058 old_iodwcr1_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWCR_1); m_series_init_eeprom_buffer()
1059 writel(0x0, devpriv->mite->mite_io_addr + MITE_IODWBSR); m_series_init_eeprom_buffer()
1060 writel(((0x80 | window_size) | devpriv->mite->daq_phys_addr), m_series_init_eeprom_buffer()
1061 devpriv->mite->mite_io_addr + MITE_IODWBSR_1); m_series_init_eeprom_buffer()
1063 devpriv->mite->mite_io_addr + MITE_IODWCR_1); m_series_init_eeprom_buffer()
1064 writel(0xf, devpriv->mite->mite_io_addr + 0x30); m_series_init_eeprom_buffer()
1076 writel(old_iodwbsr1_bits, devpriv->mite->mite_io_addr + MITE_IODWBSR_1); m_series_init_eeprom_buffer()
1077 writel(old_iodwbsr_bits, devpriv->mite->mite_io_addr + MITE_IODWBSR); m_series_init_eeprom_buffer()
1078 writel(old_iodwcr1_bits, devpriv->mite->mite_io_addr + MITE_IODWCR_1); m_series_init_eeprom_buffer()
1079 writel(0x0, devpriv->mite->mite_io_addr + 0x30); m_series_init_eeprom_buffer()
1123 mite_detach(devpriv->mite); pcimio_detach()
1155 devpriv->mite = mite_alloc(pcidev); pcimio_auto_attach()
1156 if (!devpriv->mite) pcimio_auto_attach()
1180 ret = mite_setup(dev, devpriv->mite); pcimio_auto_attach()
1184 devpriv->ai_mite_ring = mite_alloc_ring(devpriv->mite); pcimio_auto_attach()
1187 devpriv->ao_mite_ring = mite_alloc_ring(devpriv->mite); pcimio_auto_attach()
1190 devpriv->cdo_mite_ring = mite_alloc_ring(devpriv->mite); pcimio_auto_attach()
1193 devpriv->gpct_mite_ring[0] = mite_alloc_ring(devpriv->mite); pcimio_auto_attach()
1196 devpriv->gpct_mite_ring[1] = mite_alloc_ring(devpriv->mite); pcimio_auto_attach()
H A Dni_pcidio.c58 #include "mite.h"
287 struct mite_struct *mite; member in struct:nidio96_private
304 mite_request_channel_in_range(devpriv->mite, ni_pcidio_request_di_mite_channel()
308 dev_err(dev->class_dev, "failed to reserve mite dma channel\n"); ni_pcidio_request_di_mite_channel()
386 struct mite_struct *mite = devpriv->mite; nidio_interrupt() local
412 mite->mite_io_addr + nidio_interrupt()
420 "unknown mite interrupt, disabling IRQ\n"); nidio_interrupt()
871 ret = comedi_load_firmware(dev, &devpriv->mite->pcidev->dev, pci_6534_upload_firmware()
919 devpriv->mite = mite_alloc(pcidev); nidio_auto_attach()
920 if (!devpriv->mite) nidio_auto_attach()
923 ret = mite_setup(dev, devpriv->mite); nidio_auto_attach()
927 devpriv->di_mite_ring = mite_alloc_ring(devpriv->mite); nidio_auto_attach()
988 mite_detach(devpriv->mite); nidio_detach()
H A Dni_labpc_pci.c53 /* ripped from mite.h and mite_setup2() to avoid mite dependency */
H A Dni_tiocmd.c33 * module depending on the 'mite' module.
48 #include "mite.h"
453 counter->mite_chan->mite->mite_io_addr + ni_tio_handle_interrupt()
H A Dni_660x.c42 #include "mite.h"
418 struct mite_struct *mite; member in struct:ni_660x_private
700 mite_chan = mite_request_channel(devpriv->mite, ni_660x_request_mite_channel()
705 "failed to reserve mite dma channel for counter\n"); ni_660x_request_mite_channel()
860 mite_alloc_ring(devpriv->mite); ni_660x_alloc_mite_rings()
1068 devpriv->mite = mite_alloc(pcidev); ni_660x_auto_attach()
1069 if (!devpriv->mite) ni_660x_auto_attach()
1072 ret = mite_setup2(dev, devpriv->mite, true); ni_660x_auto_attach()
1182 mite_detach(devpriv->mite); ni_660x_detach()
H A D8255_pci.c180 /* ripped from mite.h and mite_setup2() to avoid mite dependency */
H A Dni_670x.c148 /* ripped from mite.h and mite_setup2() to avoid mite dependency */
H A Dni_mio_common.c59 #include "mite.h"
304 * is detected (devpriv->mite has been initialized).
578 if (!devpriv->mite && reg < 8) { ni_stc_writew()
610 if (!devpriv->mite && reg < 8) { ni_stc_readw()
756 mite_request_channel(devpriv->mite, devpriv->ai_mite_ring); ni_request_ai_mite_channel()
760 "failed to reserve mite dma channel for analog input\n"); ni_request_ai_mite_channel()
777 mite_request_channel(devpriv->mite, devpriv->ao_mite_ring); ni_request_ao_mite_channel()
781 "failed to reserve mite dma channel for analog outut\n"); ni_request_ao_mite_channel()
802 mite_request_channel(devpriv->mite, ni_request_gpct_mite_channel()
807 "failed to reserve mite dma channel for counter\n"); ni_request_gpct_mite_channel()
829 mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring); ni_request_cdo_mite_channel()
833 "failed to reserve mite dma channel for correlated digital output\n"); ni_request_cdo_mite_channel()
1085 static void mite_handle_b_linkc(struct mite_struct *mite, mite_handle_b_linkc() argument
1478 "unknown mite interrupt (ai_mite_status=%08x)\n", handle_a_interrupt()
1567 /* Currently, mite.c requires us to handle LINKC */ handle_b_interrupt()
1571 mite_handle_b_linkc(devpriv->mite, dev); handle_b_interrupt()
1578 "unknown mite interrupt (ao_mite_status=%08x)\n", handle_b_interrupt()
1698 makes the mite do 32 bit pci transfers, doubling pci bandwidth. */ ni_ao_setup_MITE_dma()
2962 if (devpriv->mite) ni_ao_insn_config()
2963 data[2] += devpriv->mite->fifo_size; ni_ao_insn_config()
3546 dev_err(dev->class_dev, "BUG: no cdo mite channel?\n"); ni_cdo_inttrig()
3645 devpriv->mite->mite_io_addr + handle_cdio_interrupt()
5294 struct mite_struct *mite = devpriv->mite; ni_E_interrupt() local
5306 if (mite) { ni_E_interrupt()
5315 devpriv->mite->mite_io_addr + ni_E_interrupt()
5323 mite->mite_io_addr + ni_E_interrupt()
5415 if (devpriv->mite) ni_E_init()
5446 if (dev->irq && (board->ao_fifo_depth || devpriv->mite)) { ni_E_init()
5456 if (devpriv->mite) ni_E_init()
5641 if (dev->irq && devpriv->mite) { ni_E_init()
H A Dni_65xx.c614 /* ripped from mite.h and mite_setup2() to avoid mite dependency */
H A Dni_stc.h1469 struct mite_struct *mite; member in struct:ni_private
H A Drtd520.c68 * I borrowed heavily from the ni_mio_common, ni_atmio16d, mite, and

Completed in 277 milliseconds