Commit a1ae7810 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

kernel: fixed IRQ handling semantics:

- don't check EIC_ISR against CHANNEL_ENABLE bits. Disabling acquisition on a channel doesn't clear the interrupt if there's something in the buffer.
- use one interrupt handler at a time (no mixing of DMA with FIFO interrupts).
parent 0f094448
......@@ -507,21 +507,12 @@ static irqreturn_t ft_irq_handler_ts(int irq, void *dev_id)
{
struct fmc_device *fmc = dev_id;
struct fmctdc_dev *ft = fmc->mezzanine_data;
uint32_t irq_stat, chan_stat;
uint32_t irq_stat;
irq_stat = ft_ioread(ft, ft->ft_irq_base + TDC_EIC_REG_EIC_ISR);
if (!irq_stat)
return IRQ_NONE;
chan_stat = ft_readl(ft, TDC_REG_INPUT_ENABLE);
chan_stat &= TDC_INPUT_ENABLE_CH_ALL;
chan_stat >>= TDC_INPUT_ENABLE_CH1_SHIFT;
chan_stat = ft_chan_to_irq_mask(ft, chan_stat);
WARN((chan_stat & irq_stat) == 0,
"Received an unexpected interrupt: 0x%X 0x%X\n",
chan_stat, irq_stat);
/* Disable interrupts until we fetch all stored samples */
ft_irq_disable_save(ft);
......@@ -676,13 +667,17 @@ int ft_irq_init(struct fmctdc_dev *ft)
}
ft->fmc->irq = ft->ft_irq_base;
ret = fmc_irq_request(ft->fmc, ft_irq_handler_ts,
"fmc-tdc", 0);
if (ret < 0) {
dev_err(&ft->fmc->dev,
"Request interrupt failed: %d\n",
ret);
return ret;
if (ft->mode == FT_ACQ_TYPE_FIFO)
{
ret = fmc_irq_request(ft->fmc, ft_irq_handler_ts,
"fmc-tdc", 0);
if (ret < 0) {
dev_err(&ft->fmc->dev,
"Request interrupt failed: %d\n",
ret);
return ret;
}
}
if (ft->mode == FT_ACQ_TYPE_DMA) {
......@@ -695,9 +690,9 @@ int ft_irq_init(struct fmctdc_dev *ft)
"fmc-tdc-dma", 0);
}
/* kick off the interrupts (fixme: possible issue with the HDL) */
/* disable & kick off the interrupts (fixme: possible issue with the HDL) */
ft_iowrite(ft, ~0, ft->ft_irq_base + TDC_EIC_REG_EIC_IDR);
fmc_irq_ack(ft->fmc);
/*
* We enable interrupts on all channel. but if we do not enable
* the channel, we should not receive anything. So, even if ZIO is
......@@ -710,8 +705,11 @@ int ft_irq_init(struct fmctdc_dev *ft)
ft->ft_dma_eic_base + DMA_EIC_REG_EIC_IER);
}
ft_iowrite(ft, ft_chan_to_irq_mask(ft, 0x1F),
ft->ft_irq_base + TDC_EIC_REG_EIC_IER);
if (ft->mode == FT_ACQ_TYPE_FIFO) {
ft_iowrite(ft, ft_chan_to_irq_mask(ft, 0x1F),
ft->ft_irq_base + TDC_EIC_REG_EIC_IER);
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment