AnsweredAssumed Answered

adi_nfc.c : rare hangs due to interrupts not being processed

Question asked by gpetrowitsch on Dec 17, 2010
Latest reply on Dec 20, 2010 by CraigG



I think there's a severe problem in the NAND flash driver (adi_nfc.c).

We are using it and in rare cases we see a hang of the system.

Debugging it we found out, that it is doing nothing else than trying

to process an interrupt - but none of the interrupt handlers did it.

Digging further in we found, that some NFC interrupt is enabled,

and it triggered, but the NFC interrupt handler did not process it.


We found, that the problem is in the member variable



This variable should acutally reflect the enabled NFC interrupt. It

normally does, but in rare cases it is 0, which interrupts are enabled.

So there must be some point, where there is an unprotected inconsistency

between NFCWaitStatus and the actual interrupt mask register. We did

not yet manage to nail this point down. Perhaps someone else already



The question is: What do we need this NFCWaitStatus for, when processing

the interrupt? In line 2934 in adi_nfc.c (which is the interrupt handler) it reads:

  if ((*pADI_NFC_IRQSTAT & pDevice->NFCAccess.NFCWaitStatus) == pDevice->NFCAccess.NFCWaitStatus)

Apart from the fact, that the 'if' will also be true, if there's no NFC interrupt at all

and the NFCWaitStatus is 0, it will not trigger, if there's an interrupt and

the NFCWaitStatus is 0 - which we saw sometimes happening.


As a workaround we added some code before this 'if' statement, that corrects

the NFCWaitStatus, when it doesn't match the (inverted) interrupt mask register.

Thus we never saw the hang nor any other problem with the driver again.