Skip to content

Commit

Permalink
spi: fsl-espi: improve and simplify interrupt handler
Browse files Browse the repository at this point in the history
Simplify the interrupt handler a little. In addition don't call
fsl_espi_cpu_irq() if no event bit is set.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Heiner Kallweit authored and Mark Brown committed Sep 14, 2016
1 parent d198ebf commit 35f5d71
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions drivers/spi/spi-fsl-espi.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,11 @@ static void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events)
&reg_base->event)) & SPIE_NF), 1000, 0);
if (!ret) {
dev_err(mspi->dev, "tired waiting for SPIE_NF\n");

/* Clear the SPIE bits */
mpc8xxx_spi_write_reg(&reg_base->event, events);
complete(&mspi->done);
return;
}
}

/* Clear the events */
mpc8xxx_spi_write_reg(&reg_base->event, events);

mspi->count -= 1;
if (mspi->count) {
u32 word = mspi->get_tx(mspi);
Expand All @@ -468,19 +462,21 @@ static irqreturn_t fsl_espi_irq(s32 irq, void *context_data)
{
struct mpc8xxx_spi *mspi = context_data;
struct fsl_espi_reg *reg_base = mspi->reg_base;
irqreturn_t ret = IRQ_NONE;
u32 events;

/* Get interrupt events(tx/rx) */
events = mpc8xxx_spi_read_reg(&reg_base->event);
if (events)
ret = IRQ_HANDLED;
if (!events)
return IRQ_NONE;

dev_vdbg(mspi->dev, "%s: events %x\n", __func__, events);

fsl_espi_cpu_irq(mspi, events);

return ret;
/* Clear the events */
mpc8xxx_spi_write_reg(&reg_base->event, events);

return IRQ_HANDLED;
}

#ifdef CONFIG_PM
Expand Down

0 comments on commit 35f5d71

Please sign in to comment.