]> git.baikalelectronics.ru Git - kernel.git/commit
nfc: pn544: Fix occasional HW initialization failure
authorDmitry Osipenko <digetx@gmail.com>
Wed, 19 Feb 2020 15:01:22 +0000 (18:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:32 +0000 (16:43 +0100)
commit6497a6253c1b64d8bf3d4b0dd2f131b9dd06477c
treed9e6fc43c4bf2f2216bf0c694a300820b7ca3680
parent4bdeb94e4b2cc73195b8dd706a9a74e67f932b1e
nfc: pn544: Fix occasional HW initialization failure

[ Upstream commit 6b8c6ea7a47e7f096ef3bed0c23ea5d755c3553f ]

The PN544 driver checks the "enable" polarity during of driver's probe and
it's doing that by turning ON and OFF NFC with different polarities until
enabling succeeds. It takes some time for the hardware to power-down, and
thus, to deassert the IRQ that is raised by turning ON the hardware.
Since the delay after last power-down of the polarity-checking process is
missed in the code, the interrupt may trigger immediately after installing
the IRQ handler (right after the checking is done), which results in IRQ
handler trying to touch the disabled HW and ends with marking NFC as
'DEAD' during of the driver's probe:

  pn544_hci_i2c 1-002a: NFC: nfc_en polarity : active high
  pn544_hci_i2c 1-002a: NFC: invalid len byte
  shdlc: llc_shdlc_recv_frame: NULL Frame -> link is dead

This patch fixes the occasional NFC initialization failure on Nexus 7
device.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nfc/pn544/i2c.c