Skip to content

Commit

Permalink
spi/pxa2xx: check status register as well to determine if the device …
Browse files Browse the repository at this point in the history
…is off

The current interrupt handler calls pm_runtime_suspended() to check if the
device is suspended or not. However, runtime PM status of the device is
only set to suspended once all PM runtime suspend hooks have executed.

In case of Intel Lynxpoint we have the device bound to the ACPI power
domain and its runtime suspend hook will put the device to D3hot (or D3cold
if possible). This means that the device is powered off before its state is
set to runtime suspended. While in this state the device might get an
interrupt that is meant for another device (as the interrupt line is
shared), and because the device is powered off accessing its registers will
return 0xffffffff that the driver misinterprets as an invalid state.

When this happens user will see messages like below on the console:

  pxa2xx-spi INT33C0:00: bad message state in interrupt handler

Fix this by checking the status register for ~0 and returning IRQ_NONE in
that case.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Mika Westerberg authored and Mark Brown committed Sep 4, 2013
1 parent 5787392 commit 269e4a4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/spi/spi-pxa2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,17 @@ static irqreturn_t ssp_int(int irq, void *dev_id)
if (pm_runtime_suspended(&drv_data->pdev->dev))
return IRQ_NONE;

sccr1_reg = read_SSCR1(reg);
/*
* If the device is not yet in RPM suspended state and we get an
* interrupt that is meant for another device, check if status bits
* are all set to one. That means that the device is already
* powered off.
*/
status = read_SSSR(reg);
if (status == ~0)
return IRQ_NONE;

sccr1_reg = read_SSCR1(reg);

/* Ignore possible writes if we don't need to write */
if (!(sccr1_reg & SSCR1_TIE))
Expand Down

0 comments on commit 269e4a4

Please sign in to comment.