Skip to content

Commit

Permalink
libertas: hack for PXA168 SDIO controller
Browse files Browse the repository at this point in the history
I don't know how safe this is to do on any SDIO controller. But on the
PXA168, we really need to ack the IRQ as soon as possible. Because
another one could come in, and if we're not looking for them by the time
they arrive, we lose the IRQ.

This hack ensures that we're ready to detect new interrupts immediately
after we have acknowledged the last one.

For some reason, it doesn't work perfectly unless I re-read the IRQ
status register in the libertas module after re-enabling host card
interrupts. This makes no sense to me, but it solves the problem and I
no longer lose host interrupts after doing that.
  • Loading branch information
dougg3 committed Jun 11, 2022
1 parent e0fb28e commit 854ce73
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/net/wireless/marvell/libertas/if_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,20 @@ static void if_sdio_interrupt(struct sdio_func *func)
if (ret)
return;

/* Hack for PXA168: the card interrupt is cleared, so we need to immediately tell
* the host controller that it can continue listening for SDIO interrupts at this point.
* Otherwise we miss some interrupts. I suspect this is a PXA168 silicon bug?
* It seems like it acts edge-triggered but the SDHCI code assumes level-triggered. */
if (!func->card->host->sdio_irq_pending && func->card->host->ops->ack_sdio_irq) {
func->card->host->ops->ack_sdio_irq(func->card->host);
}

/* One last piece of PXA168 hack: If I don't read the status register again
* (even though I'm discarding the readback), we miss some interrupts -- usually observed
* when downloading a big file. No idea why, but this extra read of the status register
* seems to avoid the problem. */
sdio_readb(card->func, IF_SDIO_H_INT_STATUS, &ret);

/*
* Ignore the define name, this really means the card has
* successfully received the command.
Expand Down

0 comments on commit 854ce73

Please sign in to comment.