Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

static irqreturn_t mxc_spi_isr ( int  irq,
void *  dev_id 
) [static]

This function is called when an interrupt occurs on the SPI modules. It is the interrupt handler for the SPI modules.

Parameters:
irq the irq number
dev_id the pointer on the device
Returns:
The function returns IRQ_HANDLED when handled.

Definition at line 708 of file mxc_spi.c.

References mxc_spi::base, mxc_spi_xfer::count, mxc_spi_unique_def::fifo_size, mxc_spi_unique_def::int_status_dif, IRQ_HANDLED, irqreturn_t, mxc_spi_xfer::rx_buf, mxc_spi_xfer::rx_count, mxc_spi_xfer::rx_get, spi_put_tx_data(), mxc_spi::spi_ver_def, mxc_spi::stat_addr, mxc_spi::transfer, mxc_spi_xfer::tx_buf, and mxc_spi::xfer_done.

Referenced by mxc_spi_probe().

{
      struct mxc_spi *master_drv_data = dev_id;
      irqreturn_t ret = IRQ_NONE;
      unsigned int status;
      int fifo_size;
      unsigned int pass_counter;

      fifo_size = master_drv_data->spi_ver_def->fifo_size;
      pass_counter = fifo_size;

      /* Read the interrupt status register to determine the source */
      status = __raw_readl(master_drv_data->stat_addr);
      do {
            u32 rx_tmp =
                __raw_readl(master_drv_data->base + MXC_CSPIRXDATA);

            if (master_drv_data->transfer.rx_buf)
                  master_drv_data->transfer.rx_get(master_drv_data,
                                           rx_tmp);
            (master_drv_data->transfer.count)--;
            (master_drv_data->transfer.rx_count)--;
            ret = IRQ_HANDLED;
            if (pass_counter-- == 0) {
                  break;
            }
            status = __raw_readl(master_drv_data->stat_addr);
      } while (status &
             (1 <<
              (MXC_CSPISTAT_RR +
               master_drv_data->spi_ver_def->int_status_dif)));

      if (master_drv_data->transfer.rx_count)
            return ret;

      if (master_drv_data->transfer.count) {
            if (master_drv_data->transfer.tx_buf) {
                  u32 count = (master_drv_data->transfer.count >
                             fifo_size) ? fifo_size :
                      master_drv_data->transfer.count;
                  master_drv_data->transfer.rx_count = count;
                  spi_put_tx_data(master_drv_data->base, count,
                              master_drv_data);
            }
      } else {
            complete(&master_drv_data->xfer_done);
      }

      return ret;
}


Generated by  Doxygen 1.6.0   Back to index