netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC net 0/2] nfc: nxp-nci: Fix i2c read on ThinkPad hardware
@ 2023-06-07 17:00 Marco Giorgi
  2023-06-07 17:00 ` [PATCH RFC net 1/2] " Marco Giorgi
  2023-06-07 17:00 ` [PATCH RFC net 2/2] " Marco Giorgi
  0 siblings, 2 replies; 8+ messages in thread
From: Marco Giorgi @ 2023-06-07 17:00 UTC (permalink / raw)
  To: netdev
  Cc: krzysztof.kozlowski, u.kleine-koenig, davem, michael, kuba,
	linux-kernel, Marco Giorgi

This patch addresses issues with "I2C" read on ThinkPad hardware.

My machine (ThinkPad T590) is equipped with an NXP1001 NFC reader, although
working flawlessly with Lenovo's Windows drivers, on Linux the driver
implementation doesn't work.

My speculation on the error is that the IRQ which is associated with the device
doesn't take into account the device's IRQ GPIO value. This patch addresses
that by exiting from the IRQ if the GPIO is low.

With this, I've been able to read a tag with neard's nfctool.

This is the behavior of the mainline `nxp_nci_i2c` driver:

# nfctool -d nfc0 -1 
Connection timed out
# dmesg -Wtd 
[<   0.000000>] nxp-nci_i2c i2c-NXP1001:00: NFC: Read failed with error -121 
[<   5.142581>] nci: __nci_request: wait_for_completion_interruptible_timeout failed 0 
[<   0.013474>] nxp-nci_i2c i2c-NXP1001:00: NFC: Read failed with error -121 

This is the patched `nxp_nci_i2c` driver:

# nfctool -d nfc0 -1 
nfc0: 
         Tags: [ ] 
         Devices: [ ] 
         Protocols: [ Felica MIFARE Jewel ISO-DEP NFC-DEP ] 
         Powered: Yes 
         RF Mode: None 
         lto: 0 
         rw: 0 
         miux: 0 
 
# nfctool -d nfc0 -p 
Start polling on nfc0 as initiator 
 
Targets found for nfc0 
 Tags: [ tag0 ] 
 Devices: [ ] 


No output from `dmesg`

Marco Giorgi (2):
  nfc: nxp-nci: Fix i2c read on ThinkPad hardware
  nfc: nxp-nci: Fix i2c read on ThinkPad hardware

 drivers/nfc/nxp-nci/i2c.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)


base-commit: 44f8baaf230c655c249467ca415b570deca8df77
-- 
2.41.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-12  7:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 17:00 [PATCH RFC net 0/2] nfc: nxp-nci: Fix i2c read on ThinkPad hardware Marco Giorgi
2023-06-07 17:00 ` [PATCH RFC net 1/2] " Marco Giorgi
2023-06-07 17:45   ` Krzysztof Kozlowski
2023-06-11 16:25     ` Marco Giorgi
2023-06-12  7:15       ` Krzysztof Kozlowski
2023-06-07 17:00 ` [PATCH RFC net 2/2] " Marco Giorgi
2023-06-07 17:46   ` Krzysztof Kozlowski
2023-06-11 16:43     ` Marco Giorgi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).