mbox series

[v2,00/12] NFC: nxp-nci: clean up and support new ID

Message ID 20190513104358.59716-1-andriy.shevchenko@linux.intel.com (mailing list archive)
Headers show
Series NFC: nxp-nci: clean up and support new ID | expand

Message

Andy Shevchenko May 13, 2019, 10:43 a.m. UTC
It has been reported that some laptops, equipped with NXP NFC300, have
different ID then mentioned in the driver.

While at it, I found that the driver has a lot of duplication and redundant
platform data. The rest of the series (11 out of 12 patches) is dedicated to
clean the driver up.

Sedat, would be nice if you can compile kernel with this patch series applied
and test on your laptop.

In v2:
- added new ID patch
- added new clean up patch
- Cc'ed to linux-wireless@ as well, since linux-nfc@ bounces my mails
- Cc'ed to the reported of the problem with T470 laptop

Andy Shevchenko (12):
  NFC: nxp-nci: Add NXP1001 to the ACPI ID table
  NFC: nxp-nci: Get rid of platform data
  NFC: nxp-nci: Convert to use GPIO descriptor
  NFC: nxp-nci: Add GPIO ACPI mapping table
  NFC: nxp-nci: Get rid of code duplication in ->probe()
  NFC: nxp-nci: Get rid of useless label
  NFC: nxp-nci: Constify acpi_device_id
  NFC: nxp-nci: Drop of_match_ptr() use
  NFC: nxp-nci: Drop comma in terminator lines
  NFC: nxp-nci: Remove unused macro pr_fmt()
  NFC: nxp-nci: Remove 'default n' for tests
  NFC: nxp-nci: Convert to SPDX license tags

 MAINTAINERS                           |   1 -
 drivers/nfc/nxp-nci/Kconfig           |   1 -
 drivers/nfc/nxp-nci/core.c            |  15 +--
 drivers/nfc/nxp-nci/firmware.c        |  13 +--
 drivers/nfc/nxp-nci/i2c.c             | 147 ++++++--------------------
 drivers/nfc/nxp-nci/nxp-nci.h         |   1 -
 include/linux/platform_data/nxp-nci.h |  27 -----
 7 files changed, 37 insertions(+), 168 deletions(-)
 delete mode 100644 include/linux/platform_data/nxp-nci.h

Comments

Sedat Dilek May 13, 2019, 11:43 a.m. UTC | #1
On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> It has been reported that some laptops, equipped with NXP NFC300, have
> different ID then mentioned in the driver.
>
> While at it, I found that the driver has a lot of duplication and redundant
> platform data. The rest of the series (11 out of 12 patches) is dedicated to
> clean the driver up.
>
> Sedat, would be nice if you can compile kernel with this patch series applied
> and test on your laptop.
>

Hi Andy, Hi Oleg,

I have tested Andy's v2 series on my ThinkPad T470 successfully with
Linux v5.1.1.

Additionally, I had the NFC patch "NFC: fix attrs checks in netlink
interface" from Andrey Konovalov (see [1]).

sdi@iniza:~/src/linux-kernel/linux$ git log --oneline v5.1.1..
729d291510c2 (HEAD -> 5.1.1-1-amd64-gcc8-ldbfd) Merge branch
'for-5.1/nfc-nxp-nci' into 5.1.1-1-amd64-gcc8-ldbfd
f083f056830c (for-5.1/nfc-nxp-nci-v2) NFC: nxp-nci: Convert to SPDX license tags
132b5681e074 NFC: nxp-nci: Remove 'default n' for tests
840b1df28cab NFC: nxp-nci: Remove unused macro pr_fmt()
5b55e26db0c2 NFC: nxp-nci: Drop comma in terminator lines
0a1edd5ce3bb NFC: nxp-nci: Drop of_match_ptr() use
acae10451393 NFC: nxp-nci: Constify acpi_device_id
07648528dae3 NFC: nxp-nci: Get rid of useless label
38b8c38f2187 NFC: nxp-nci: Get rid of code duplication in ->probe()
446f5aef4522 NFC: nxp-nci: Add GPIO ACPI mapping table
813d4243c563 NFC: nxp-nci: Convert to use GPIO descriptor
1e5187ddb944 NFC: nxp-nci: Get rid of platform data
775a4fa8fb68 NFC: nxp-nci: Add NXP1001 to the ACPI ID table
db79db400c5b Merge branch 'for-5.1/nfc' into 5.1.1-1-amd64-cbl-asmgoto
e1c37435140f (for-5.1/nfc) NFC: fix attrs checks in netlink interface

With neard (daemon) and neard-tools packages from Debian/buster AMD64
I am able to access, list and poll from my NFC (nfc0) device.

root@iniza:~# systemctl status neard.service
● neard.service - LSB: NFC daemon
   Loaded: loaded (/etc/init.d/neard; generated)
   Active: active (running) since Mon 2019-05-13 13:14:12 CEST; 16min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 810 ExecStart=/etc/init.d/neard start (code=exited, status=0/SUCCESS)
    Tasks: 1 (limit: 4915)
   Memory: 1.6M
   CGroup: /system.slice/neard.service
           └─885 /usr/lib/neard/neard

Mai 13 13:14:12 iniza systemd[1]: Starting LSB: NFC daemon...
Mai 13 13:14:12 iniza neard[877]: NEAR daemon version 0.16
Mai 13 13:14:12 iniza neard[810]: Starting NFC daemon: neard.
Mai 13 13:14:12 iniza systemd[1]: Started LSB: NFC daemon.

root@iniza:~# nfctool --list
nfc0:
          Tags: [ tag0 ]
          Devices: [ ]
          Protocols: [ Felica MIFARE Jewel ISO-DEP NFC-DEP ]
          Powered: Yes
          RF Mode: Initiator
          lto: 150
          rw: 15
          miux: 2047

root@iniza:~# nfctool --poll -d nfc0
Start polling on nfc0 as initiator

Targets found for nfc0
  Tags: [ tag1 ]
  Devices: [ ]

Thanks to all involved people.

Please, feel free to add any credits you think are appropriate.

A big Thank you from North-West Germany.

Regards,
- Sedat -

[1] https://patchwork.kernel.org/patch/10339089/

> In v2:
> - added new ID patch
> - added new clean up patch
> - Cc'ed to linux-wireless@ as well, since linux-nfc@ bounces my mails
> - Cc'ed to the reported of the problem with T470 laptop
>
> Andy Shevchenko (12):
>   NFC: nxp-nci: Add NXP1001 to the ACPI ID table
>   NFC: nxp-nci: Get rid of platform data
>   NFC: nxp-nci: Convert to use GPIO descriptor
>   NFC: nxp-nci: Add GPIO ACPI mapping table
>   NFC: nxp-nci: Get rid of code duplication in ->probe()
>   NFC: nxp-nci: Get rid of useless label
>   NFC: nxp-nci: Constify acpi_device_id
>   NFC: nxp-nci: Drop of_match_ptr() use
>   NFC: nxp-nci: Drop comma in terminator lines
>   NFC: nxp-nci: Remove unused macro pr_fmt()
>   NFC: nxp-nci: Remove 'default n' for tests
>   NFC: nxp-nci: Convert to SPDX license tags
>
>  MAINTAINERS                           |   1 -
>  drivers/nfc/nxp-nci/Kconfig           |   1 -
>  drivers/nfc/nxp-nci/core.c            |  15 +--
>  drivers/nfc/nxp-nci/firmware.c        |  13 +--
>  drivers/nfc/nxp-nci/i2c.c             | 147 ++++++--------------------
>  drivers/nfc/nxp-nci/nxp-nci.h         |   1 -
>  include/linux/platform_data/nxp-nci.h |  27 -----
>  7 files changed, 37 insertions(+), 168 deletions(-)
>  delete mode 100644 include/linux/platform_data/nxp-nci.h
>
> --
> 2.20.1
>
Sedat Dilek May 13, 2019, 11:46 a.m. UTC | #2
On Mon, May 13, 2019 at 1:43 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
[...]

> root@iniza:~# nfctool --poll -d nfc0
> Start polling on nfc0 as initiator
>
> Targets found for nfc0
>   Tags: [ tag1 ]
>   Devices: [ ]
>

That "tag1" was my YubiKey after putting it on the NFC sticker on my
ThinkPad T470.

- Sedat -
Sedat Dilek May 13, 2019, 12:18 p.m. UTC | #3
On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> It has been reported that some laptops, equipped with NXP NFC300, have
> different ID then mentioned in the driver.
>
> While at it, I found that the driver has a lot of duplication and redundant
> platform data. The rest of the series (11 out of 12 patches) is dedicated to
> clean the driver up.
>
> Sedat, would be nice if you can compile kernel with this patch series applied
> and test on your laptop.
>
> In v2:
> - added new ID patch
> - added new clean up patch
> - Cc'ed to linux-wireless@ as well, since linux-nfc@ bounces my mails
> - Cc'ed to the reported of the problem with T470 laptop
>
> Andy Shevchenko (12):
>   NFC: nxp-nci: Add NXP1001 to the ACPI ID table
>   NFC: nxp-nci: Get rid of platform data
>   NFC: nxp-nci: Convert to use GPIO descriptor
>   NFC: nxp-nci: Add GPIO ACPI mapping table
>   NFC: nxp-nci: Get rid of code duplication in ->probe()
>   NFC: nxp-nci: Get rid of useless label
>   NFC: nxp-nci: Constify acpi_device_id
>   NFC: nxp-nci: Drop of_match_ptr() use
>   NFC: nxp-nci: Drop comma in terminator lines
>   NFC: nxp-nci: Remove unused macro pr_fmt()
>   NFC: nxp-nci: Remove 'default n' for tests
>   NFC: nxp-nci: Convert to SPDX license tags
>
>  MAINTAINERS                           |   1 -
>  drivers/nfc/nxp-nci/Kconfig           |   1 -
>  drivers/nfc/nxp-nci/core.c            |  15 +--
>  drivers/nfc/nxp-nci/firmware.c        |  13 +--
>  drivers/nfc/nxp-nci/i2c.c             | 147 ++++++--------------------
>  drivers/nfc/nxp-nci/nxp-nci.h         |   1 -
>  include/linux/platform_data/nxp-nci.h |  27 -----
>  7 files changed, 37 insertions(+), 168 deletions(-)
>  delete mode 100644 include/linux/platform_data/nxp-nci.h
>
> --
> 2.20.1
>

Can we have NPC300 listed in the Kconfg help text?

Thanks.

- Sedat -

$ git diff
diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index a28c4265354d..f2173c1de745 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -2,8 +2,8 @@ config NFC_NXP_NCI
        tristate "NXP-NCI NFC driver"
        depends on NFC_NCI
        ---help---
-         Generic core driver for NXP NCI chips such as the NPC100
-         or PN7150 families.
+         Generic core driver for NXP NCI chips such as the NPC100,
+         NPC300 or PN7150 families.
          This is a driver based on the NCI NFC kernel layers and
          will thus not work with NXP libnfc library.
Andy Shevchenko May 13, 2019, 12:37 p.m. UTC | #4
On Mon, May 13, 2019 at 02:18:03PM +0200, Sedat Dilek wrote:
> On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > It has been reported that some laptops, equipped with NXP NFC300, have
> > different ID then mentioned in the driver.
> >
> > While at it, I found that the driver has a lot of duplication and redundant
> > platform data. The rest of the series (11 out of 12 patches) is dedicated to
> > clean the driver up.
> >
> > Sedat, would be nice if you can compile kernel with this patch series applied
> > and test on your laptop.
> >
> > In v2:
> > - added new ID patch
> > - added new clean up patch
> > - Cc'ed to linux-wireless@ as well, since linux-nfc@ bounces my mails
> > - Cc'ed to the reported of the problem with T470 laptop
> >
> > Andy Shevchenko (12):
> >   NFC: nxp-nci: Add NXP1001 to the ACPI ID table
> >   NFC: nxp-nci: Get rid of platform data
> >   NFC: nxp-nci: Convert to use GPIO descriptor
> >   NFC: nxp-nci: Add GPIO ACPI mapping table
> >   NFC: nxp-nci: Get rid of code duplication in ->probe()
> >   NFC: nxp-nci: Get rid of useless label
> >   NFC: nxp-nci: Constify acpi_device_id
> >   NFC: nxp-nci: Drop of_match_ptr() use
> >   NFC: nxp-nci: Drop comma in terminator lines
> >   NFC: nxp-nci: Remove unused macro pr_fmt()
> >   NFC: nxp-nci: Remove 'default n' for tests
> >   NFC: nxp-nci: Convert to SPDX license tags
> >
> >  MAINTAINERS                           |   1 -
> >  drivers/nfc/nxp-nci/Kconfig           |   1 -
> >  drivers/nfc/nxp-nci/core.c            |  15 +--
> >  drivers/nfc/nxp-nci/firmware.c        |  13 +--
> >  drivers/nfc/nxp-nci/i2c.c             | 147 ++++++--------------------
> >  drivers/nfc/nxp-nci/nxp-nci.h         |   1 -
> >  include/linux/platform_data/nxp-nci.h |  27 -----
> >  7 files changed, 37 insertions(+), 168 deletions(-)
> >  delete mode 100644 include/linux/platform_data/nxp-nci.h
> 
> Can we have NPC300 listed in the Kconfg help text?

Sure, it's good thing to do!

Either as a separate patch or I may incorporate in the next iteration.
Samuel, what do you prefer?
Oleg Zhurakivskyy May 13, 2019, 12:49 p.m. UTC | #5
On 5/13/19 2:46 PM, Sedat Dilek wrote:

> That "tag1" was my YubiKey after putting it on the NFC sticker on my ThinkPad T470.

:)

Sedat, Andy, thanks a lot and great job!

Regards,
Oleg
Andy Shevchenko May 13, 2019, 12:56 p.m. UTC | #6
On Mon, May 13, 2019 at 01:43:12PM +0200, Sedat Dilek wrote:
> On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

> > Sedat, would be nice if you can compile kernel with this patch series applied
> > and test on your laptop.

> I have tested Andy's v2 series on my ThinkPad T470 successfully with
> Linux v5.1.1.
> 
> Additionally, I had the NFC patch "NFC: fix attrs checks in netlink
> interface" from Andrey Konovalov (see [1]).
> 
> sdi@iniza:~/src/linux-kernel/linux$ git log --oneline v5.1.1..
> 729d291510c2 (HEAD -> 5.1.1-1-amd64-gcc8-ldbfd) Merge branch
> 'for-5.1/nfc-nxp-nci' into 5.1.1-1-amd64-gcc8-ldbfd
> f083f056830c (for-5.1/nfc-nxp-nci-v2) NFC: nxp-nci: Convert to SPDX license tags
> 132b5681e074 NFC: nxp-nci: Remove 'default n' for tests
> 840b1df28cab NFC: nxp-nci: Remove unused macro pr_fmt()
> 5b55e26db0c2 NFC: nxp-nci: Drop comma in terminator lines
> 0a1edd5ce3bb NFC: nxp-nci: Drop of_match_ptr() use
> acae10451393 NFC: nxp-nci: Constify acpi_device_id
> 07648528dae3 NFC: nxp-nci: Get rid of useless label
> 38b8c38f2187 NFC: nxp-nci: Get rid of code duplication in ->probe()
> 446f5aef4522 NFC: nxp-nci: Add GPIO ACPI mapping table
> 813d4243c563 NFC: nxp-nci: Convert to use GPIO descriptor
> 1e5187ddb944 NFC: nxp-nci: Get rid of platform data
> 775a4fa8fb68 NFC: nxp-nci: Add NXP1001 to the ACPI ID table
> db79db400c5b Merge branch 'for-5.1/nfc' into 5.1.1-1-amd64-cbl-asmgoto
> e1c37435140f (for-5.1/nfc) NFC: fix attrs checks in netlink interface
> 
> With neard (daemon) and neard-tools packages from Debian/buster AMD64
> I am able to access, list and poll from my NFC (nfc0) device.
> 
> root@iniza:~# systemctl status neard.service
> ● neard.service - LSB: NFC daemon
>    Loaded: loaded (/etc/init.d/neard; generated)
>    Active: active (running) since Mon 2019-05-13 13:14:12 CEST; 16min ago
>      Docs: man:systemd-sysv-generator(8)
>   Process: 810 ExecStart=/etc/init.d/neard start (code=exited, status=0/SUCCESS)
>     Tasks: 1 (limit: 4915)
>    Memory: 1.6M
>    CGroup: /system.slice/neard.service
>            └─885 /usr/lib/neard/neard
> 
> Mai 13 13:14:12 iniza systemd[1]: Starting LSB: NFC daemon...
> Mai 13 13:14:12 iniza neard[877]: NEAR daemon version 0.16
> Mai 13 13:14:12 iniza neard[810]: Starting NFC daemon: neard.
> Mai 13 13:14:12 iniza systemd[1]: Started LSB: NFC daemon.
> 
> root@iniza:~# nfctool --list
> nfc0:
>           Tags: [ tag0 ]
>           Devices: [ ]
>           Protocols: [ Felica MIFARE Jewel ISO-DEP NFC-DEP ]
>           Powered: Yes
>           RF Mode: Initiator
>           lto: 150
>           rw: 15
>           miux: 2047
> 
> root@iniza:~# nfctool --poll -d nfc0
> Start polling on nfc0 as initiator
> 
> Targets found for nfc0
>   Tags: [ tag1 ]
>   Devices: [ ]
> 
> Thanks to all involved people.
> 
> Please, feel free to add any credits you think are appropriate.
> 
> A big Thank you from North-West Germany.

Thank you for testing. I hope Samuel will take this soon to his tree.

> [1] https://patchwork.kernel.org/patch/10339089/
Sedat Dilek May 13, 2019, 7:48 p.m. UTC | #7
On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> It has been reported that some laptops, equipped with NXP NFC300, have
> different ID then mentioned in the driver.
>
> While at it, I found that the driver has a lot of duplication and redundant
> platform data. The rest of the series (11 out of 12 patches) is dedicated to
> clean the driver up.
>
> Sedat, would be nice if you can compile kernel with this patch series applied
> and test on your laptop.
>
> In v2:
> - added new ID patch
> - added new clean up patch
> - Cc'ed to linux-wireless@ as well, since linux-nfc@ bounces my mails
> - Cc'ed to the reported of the problem with T470 laptop
>
> Andy Shevchenko (12):
>   NFC: nxp-nci: Add NXP1001 to the ACPI ID table
>   NFC: nxp-nci: Get rid of platform data
>   NFC: nxp-nci: Convert to use GPIO descriptor
>   NFC: nxp-nci: Add GPIO ACPI mapping table
>   NFC: nxp-nci: Get rid of code duplication in ->probe()
>   NFC: nxp-nci: Get rid of useless label
>   NFC: nxp-nci: Constify acpi_device_id
>   NFC: nxp-nci: Drop of_match_ptr() use
>   NFC: nxp-nci: Drop comma in terminator lines
>   NFC: nxp-nci: Remove unused macro pr_fmt()
>   NFC: nxp-nci: Remove 'default n' for tests
>   NFC: nxp-nci: Convert to SPDX license tags
>
>  MAINTAINERS                           |   1 -
>  drivers/nfc/nxp-nci/Kconfig           |   1 -
>  drivers/nfc/nxp-nci/core.c            |  15 +--
>  drivers/nfc/nxp-nci/firmware.c        |  13 +--
>  drivers/nfc/nxp-nci/i2c.c             | 147 ++++++--------------------
>  drivers/nfc/nxp-nci/nxp-nci.h         |   1 -
>  include/linux/platform_data/nxp-nci.h |  27 -----
>  7 files changed, 37 insertions(+), 168 deletions(-)
>  delete mode 100644 include/linux/platform_data/nxp-nci.h
>
> --
> 2.20.1
>

Is it possible to have an info in dmesg log when nxp-nci_i2c kernel
module is loaded?

- Sedat -
Sedat Dilek May 14, 2019, 8:34 a.m. UTC | #8
On Mon, May 13, 2019 at 2:37 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, May 13, 2019 at 02:18:03PM +0200, Sedat Dilek wrote:
> > On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > It has been reported that some laptops, equipped with NXP NFC300, have
> > > different ID then mentioned in the driver.
> > >
> > > While at it, I found that the driver has a lot of duplication and redundant
> > > platform data. The rest of the series (11 out of 12 patches) is dedicated to
> > > clean the driver up.
> > >
> > > Sedat, would be nice if you can compile kernel with this patch series applied
> > > and test on your laptop.
> > >
> > > In v2:
> > > - added new ID patch
> > > - added new clean up patch
> > > - Cc'ed to linux-wireless@ as well, since linux-nfc@ bounces my mails
> > > - Cc'ed to the reported of the problem with T470 laptop
> > >
> > > Andy Shevchenko (12):
> > >   NFC: nxp-nci: Add NXP1001 to the ACPI ID table
> > >   NFC: nxp-nci: Get rid of platform data
> > >   NFC: nxp-nci: Convert to use GPIO descriptor
> > >   NFC: nxp-nci: Add GPIO ACPI mapping table
> > >   NFC: nxp-nci: Get rid of code duplication in ->probe()
> > >   NFC: nxp-nci: Get rid of useless label
> > >   NFC: nxp-nci: Constify acpi_device_id
> > >   NFC: nxp-nci: Drop of_match_ptr() use
> > >   NFC: nxp-nci: Drop comma in terminator lines
> > >   NFC: nxp-nci: Remove unused macro pr_fmt()
> > >   NFC: nxp-nci: Remove 'default n' for tests
> > >   NFC: nxp-nci: Convert to SPDX license tags
> > >
> > >  MAINTAINERS                           |   1 -
> > >  drivers/nfc/nxp-nci/Kconfig           |   1 -
> > >  drivers/nfc/nxp-nci/core.c            |  15 +--
> > >  drivers/nfc/nxp-nci/firmware.c        |  13 +--
> > >  drivers/nfc/nxp-nci/i2c.c             | 147 ++++++--------------------
> > >  drivers/nfc/nxp-nci/nxp-nci.h         |   1 -
> > >  include/linux/platform_data/nxp-nci.h |  27 -----
> > >  7 files changed, 37 insertions(+), 168 deletions(-)
> > >  delete mode 100644 include/linux/platform_data/nxp-nci.h
> >
> > Can we have NPC300 listed in the Kconfg help text?
>
> Sure, it's good thing to do!
>
> Either as a separate patch or I may incorporate in the next iteration.
> Samuel, what do you prefer?
>

Am I correct that "NPC100" is "PN547" and "NPC300" is "PN548"?

- Sedat -
Andy Shevchenko May 14, 2019, 10:03 a.m. UTC | #9
On Mon, May 13, 2019 at 09:48:15PM +0200, Sedat Dilek wrote:
> On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

> Is it possible to have an info in dmesg log when nxp-nci_i2c kernel
> module is loaded?

We have 'initcall_debug' for such purposes.
Oleg Zhurakivskyy May 14, 2019, 11:44 a.m. UTC | #10
On 5/14/19 11:34 AM, Sedat Dilek wrote:
  
> Am I correct that "NPC100" is "PN547" and "NPC300" is "PN548"?

Yes, NPC100 is PN547.

Don’t know on NPC300, but a quick web search reveals it’s PN548.

Might it make sense to drop NPC... and to keep just the chip names in Kconfig?

Regards,
Oleg
Sedat Dilek May 14, 2019, 12:03 p.m. UTC | #11
On Tue, May 14, 2019 at 1:45 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> On 5/14/19 11:34 AM, Sedat Dilek wrote:
>
> > Am I correct that "NPC100" is "PN547" and "NPC300" is "PN548"?
>
> Yes, NPC100 is PN547.
>
> Don’t know on NPC300, but a quick web search reveals it’s PN548.
>
> Might it make sense to drop NPC... and to keep just the chip names in Kconfig?
>

Thanks for the clarification.

I found NXP NPC300 windows driver from Lenovo's support website - not
on the support websites for ThinkPad T470 but for other ThinkPads like
T480.
It's the same driver and by accident I could update via Microsoft
device-manager to version 12.0.4.0.

So if you search in the Wild Wild Web for a Linux driver and have the
information "NXP NPC300", you will find it.
It's good to keep both informations - preferable put them into the
Kconfig help text?

- Sedat -
Sedat Dilek May 14, 2019, 12:12 p.m. UTC | #12
On Tue, May 14, 2019 at 12:03 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, May 13, 2019 at 09:48:15PM +0200, Sedat Dilek wrote:
> > On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
>
> > Is it possible to have an info in dmesg log when nxp-nci_i2c kernel
> > module is loaded?
>
> We have 'initcall_debug' for such purposes.
>

Thanks.

That's nice for retrieving helpful informations, especially the proble
line (see below).

Unload nxp_nci_i2c module...

[  277.362813] NET: Unregistered protocol family 39

...and reload nxp_nci_i2c module...

[  291.640491] calling  nfc_init+0x0/0x8e [nfc] @ 2998
[  291.640499] nfc: nfc_init: NFC Core ver 0.1
[  291.640603] NET: Registered protocol family 39
[  291.640651] initcall nfc_init+0x0/0x8e [nfc] returned 0 after 111 usecs
[  291.653179] calling  nxp_nci_i2c_driver_init+0x0/0x1000 [nxp_nci_i2c] @ 2998
[  291.669584] probe of i2c-NXP1001:00 returned 1 after 16364 usecs
[  291.669841] initcall nxp_nci_i2c_driver_init+0x0/0x1000
[nxp_nci_i2c] returned 0 after 16244 usecs

What I mean is (here: btrfs and vboxdrv built as modules)...

[   21.285569] Btrfs loaded, crc32c=crc32c-intel
[   28.823902] vboxdrv: Successfully loaded version 6.0.6_Debian
(interface 0x00290008)

- Sedat -
Oleg Zhurakivskyy May 14, 2019, 1:30 p.m. UTC | #13
OK, thanks!

On 5/14/19 3:03 PM, Sedat Dilek wrote:

> It's good to keep both informations - preferable put them into the
> Kconfig help text?

Sure, it's best to keep them both.

Regards,
Oleg
Sedat Dilek May 14, 2019, 1:44 p.m. UTC | #14
On Tue, May 14, 2019 at 3:30 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> OK, thanks!
>
> On 5/14/19 3:03 PM, Sedat Dilek wrote:
>
> > It's good to keep both informations - preferable put them into the
> > Kconfig help text?
>
> Sure, it's best to keep them both.
>

While looking at the Kconfig help text; I wonder why...

config NFC_NXP_NCI_I2C
        tristate "NXP-NCI I2C support"
        depends on NFC_NXP_NCI && I2C
        ---help---
          This module adds support for an I2C interface to the NXP NCI
          chips.
          Select this if your platform is using the I2C bus.

          To compile this driver as a module, choose m here. The module will
          be called nxp_nci_i2c.
          Say Y if unsure.

Shouldn't that be "Say N if unsure"?
Or Say Yes If Sure :-).

- Sedat -
Oleg Zhurakivskyy May 14, 2019, 1:56 p.m. UTC | #15
On 5/14/19 4:44 PM, Sedat Dilek wrote:

>            Say Y if unsure.
> 
> Shouldn't that be "Say N if unsure"?
> Or Say Yes If Sure :-).

:)

Must be a typo.

As to me, the last 5 lines in the description are extra, but this is just a matter of taste.

Regards,
Oleg
Sedat Dilek May 14, 2019, 2:53 p.m. UTC | #16
On Tue, May 14, 2019 at 3:57 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> On 5/14/19 4:44 PM, Sedat Dilek wrote:
>
> >            Say Y if unsure.
> >
> > Shouldn't that be "Say N if unsure"?
> > Or Say Yes If Sure :-).
>
> :)
>
> Must be a typo.
>
> As to me, the last 5 lines in the description are extra, but this is just a matter of taste.
>

What about this one?

diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index a28c4265354d..b9e6486aa8fe 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -2,8 +2,8 @@ config NFC_NXP_NCI
        tristate "NXP-NCI NFC driver"
        depends on NFC_NCI
        ---help---
-         Generic core driver for NXP NCI chips such as the NPC100
-         or PN7150 families.
+         Generic core driver for NXP NCI chips such as the NPC100 (PN547),
+         NPC300 (PN548) or PN7150 families.
          This is a driver based on the NCI NFC kernel layers and
          will thus not work with NXP libnfc library.

@@ -19,6 +19,11 @@ config NFC_NXP_NCI_I2C
          chips.
          Select this if your platform is using the I2C bus.

+          Furthermore, the pin control and GPIO driver of the actual SoC or
+          PCH is needed.
+          For example set CONFIG_PINCTRL_SUNRISEPOINT=y to activate the
+          Intel Sunrisepoint (PCH of Intel Skylake) pinctrl and GPIO driver.
+
          To compile this driver as a module, choose m here. The module will
          be called nxp_nci_i2c.
-         Say Y if unsure.
+         Say N if unsure.

- Sedat -
Andy Shevchenko May 14, 2019, 5:01 p.m. UTC | #17
On Tue, May 14, 2019 at 04:53:10PM +0200, Sedat Dilek wrote:
> On Tue, May 14, 2019 at 3:57 PM Oleg Zhurakivskyy
> <oleg.zhurakivskyy@intel.com> wrote:

> What about this one?
> 
> diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
> index a28c4265354d..b9e6486aa8fe 100644
> --- a/drivers/nfc/nxp-nci/Kconfig
> +++ b/drivers/nfc/nxp-nci/Kconfig
> @@ -2,8 +2,8 @@ config NFC_NXP_NCI
>         tristate "NXP-NCI NFC driver"
>         depends on NFC_NCI
>         ---help---
> -         Generic core driver for NXP NCI chips such as the NPC100
> -         or PN7150 families.
> +         Generic core driver for NXP NCI chips such as the NPC100 (PN547),
> +         NPC300 (PN548) or PN7150 families.
>           This is a driver based on the NCI NFC kernel layers and
>           will thus not work with NXP libnfc library.
> 
> @@ -19,6 +19,11 @@ config NFC_NXP_NCI_I2C
>           chips.
>           Select this if your platform is using the I2C bus.
> 
> +          Furthermore, the pin control and GPIO driver of the actual SoC or
> +          PCH is needed.
> +          For example set CONFIG_PINCTRL_SUNRISEPOINT=y to activate the
> +          Intel Sunrisepoint (PCH of Intel Skylake) pinctrl and GPIO driver.
> +

Besides some indentation problems (the help lines should be prefixed with
'TAB + 2 spaces'), this is not needed — it's obvious and usually distros
provide all of pin control drivers anyway.

For debugging one may check deferred devices via DebugFS, or use
'initcall_debug', or other facilities.

>           To compile this driver as a module, choose m here. The module will
>           be called nxp_nci_i2c.
> -         Say Y if unsure.
> +         Say N if unsure.
Sedat Dilek May 15, 2019, 8:32 a.m. UTC | #18
On Tue, May 14, 2019 at 7:01 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Tue, May 14, 2019 at 04:53:10PM +0200, Sedat Dilek wrote:
> > On Tue, May 14, 2019 at 3:57 PM Oleg Zhurakivskyy
> > <oleg.zhurakivskyy@intel.com> wrote:
>
> > What about this one?
> >
> > diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
> > index a28c4265354d..b9e6486aa8fe 100644
> > --- a/drivers/nfc/nxp-nci/Kconfig
> > +++ b/drivers/nfc/nxp-nci/Kconfig
> > @@ -2,8 +2,8 @@ config NFC_NXP_NCI
> >         tristate "NXP-NCI NFC driver"
> >         depends on NFC_NCI
> >         ---help---
> > -         Generic core driver for NXP NCI chips such as the NPC100
> > -         or PN7150 families.
> > +         Generic core driver for NXP NCI chips such as the NPC100 (PN547),
> > +         NPC300 (PN548) or PN7150 families.
> >           This is a driver based on the NCI NFC kernel layers and
> >           will thus not work with NXP libnfc library.
> >
> > @@ -19,6 +19,11 @@ config NFC_NXP_NCI_I2C
> >           chips.
> >           Select this if your platform is using the I2C bus.
> >
> > +          Furthermore, the pin control and GPIO driver of the actual SoC or
> > +          PCH is needed.
> > +          For example set CONFIG_PINCTRL_SUNRISEPOINT=y to activate the
> > +          Intel Sunrisepoint (PCH of Intel Skylake) pinctrl and GPIO driver.
> > +
>
> Besides some indentation problems (the help lines should be prefixed with
> 'TAB + 2 spaces'), this is not needed — it's obvious and usually distros
> provide all of pin control drivers anyway.
>
> For debugging one may check deferred devices via DebugFS, or use
> 'initcall_debug', or other facilities.
>
> >           To compile this driver as a module, choose m here. The module will
> >           be called nxp_nci_i2c.
> > -         Say Y if unsure.
> > +         Say N if unsure.
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Excellent eyes (TAB + 2 spaces)!

So, this is enough?

$ git diff
diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index a28c4265354d..d85a4761e271 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -2,8 +2,8 @@ config NFC_NXP_NCI
        tristate "NXP-NCI NFC driver"
        depends on NFC_NCI
        ---help---
-         Generic core driver for NXP NCI chips such as the NPC100
-         or PN7150 families.
+         Generic core driver for NXP NCI chips such as the PN547 (NPC100),
+         PN548 (NPC300) or PN7150 families.
          This is a driver based on the NCI NFC kernel layers and
          will thus not work with NXP libnfc library.

@@ -21,4 +21,4 @@ config NFC_NXP_NCI_I2C

          To compile this driver as a module, choose m here. The module will
          be called nxp_nci_i2c.
-         Say Y if unsure.
+         Say N if unsure.

Shall I sent a patch for this, or do you want to that yourself?

Thanks.

- Sedat -
Andy Shevchenko May 15, 2019, 10:09 a.m. UTC | #19
On Wed, May 15, 2019 at 10:32:36AM +0200, Sedat Dilek wrote:
> On Tue, May 14, 2019 at 7:01 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

> So, this is enough?

Yes, please send it as a formal patch, I will chain it to my series and resend
in a bunch of v3.

> $ git diff
> diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
> index a28c4265354d..d85a4761e271 100644
> --- a/drivers/nfc/nxp-nci/Kconfig
> +++ b/drivers/nfc/nxp-nci/Kconfig
> @@ -2,8 +2,8 @@ config NFC_NXP_NCI
>         tristate "NXP-NCI NFC driver"
>         depends on NFC_NCI
>         ---help---
> -         Generic core driver for NXP NCI chips such as the NPC100
> -         or PN7150 families.
> +         Generic core driver for NXP NCI chips such as the PN547 (NPC100),
> +         PN548 (NPC300) or PN7150 families.
>           This is a driver based on the NCI NFC kernel layers and
>           will thus not work with NXP libnfc library.
> 
> @@ -21,4 +21,4 @@ config NFC_NXP_NCI_I2C
> 
>           To compile this driver as a module, choose m here. The module will
>           be called nxp_nci_i2c.
> -         Say Y if unsure.
> +         Say N if unsure.
> 
> Shall I sent a patch for this, or do you want to that yourself?
> 
> Thanks.
> 
> - Sedat -
Sedat Dilek May 15, 2019, 10:22 a.m. UTC | #20
On Wed, May 15, 2019 at 12:09 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, May 15, 2019 at 10:32:36AM +0200, Sedat Dilek wrote:
> > On Tue, May 14, 2019 at 7:01 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
>
> > So, this is enough?
>
> Yes, please send it as a formal patch, I will chain it to my series and resend
> in a bunch of v3.
>

Will do after rebooting into Linux v5.1.2 stable :-).

- Sedat -

> > $ git diff
> > diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
> > index a28c4265354d..d85a4761e271 100644
> > --- a/drivers/nfc/nxp-nci/Kconfig
> > +++ b/drivers/nfc/nxp-nci/Kconfig
> > @@ -2,8 +2,8 @@ config NFC_NXP_NCI
> >         tristate "NXP-NCI NFC driver"
> >         depends on NFC_NCI
> >         ---help---
> > -         Generic core driver for NXP NCI chips such as the NPC100
> > -         or PN7150 families.
> > +         Generic core driver for NXP NCI chips such as the PN547 (NPC100),
> > +         PN548 (NPC300) or PN7150 families.
> >           This is a driver based on the NCI NFC kernel layers and
> >           will thus not work with NXP libnfc library.
> >
> > @@ -21,4 +21,4 @@ config NFC_NXP_NCI_I2C
> >
> >           To compile this driver as a module, choose m here. The module will
> >           be called nxp_nci_i2c.
> > -         Say Y if unsure.
> > +         Say N if unsure.
> >
> > Shall I sent a patch for this, or do you want to that yourself?
> >
> > Thanks.
> >
> > - Sedat -
>
> --
> With Best Regards,
> Andy Shevchenko
>
>