Skip to contentSkip to conversation

NFC: nxp-nci: clean up and support new ID

PATCH In review Andy Shevchenko 3 participants 33 messages May 13, 2019 – May 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover NFC: nxp-nci: clean up and support new ID

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
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/12 NFC: nxp-nci: Add NXP1001 to the ACPI ID table

It seems a lot of laptops are equipped with NXP NFC300 chip with the ACPI ID NXP1001 as per DSDT.

Append it to the driver's ACPI ID table.

---
 drivers/nfc/nxp-nci/i2c.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nfc/nxp-nci/i2c.c +1 -0
index ba695e392c3b..fec904ad624b 100644
@@ -407,6 +407,7 @@ MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
 
 #ifdef CONFIG_ACPI
 static struct acpi_device_id acpi_id[] = {
+	{ "NXP1001" },
 	{ "NXP7471" },
 	{ },
 };
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/12 NFC: nxp-nci: Get rid of platform data

In reply to Andy Shevchenko

Legacy platform data must go away. We are on the safe side here since there are no users of it in the kernel.

If anyone by any odd reason needs it the GPIO lookup tables and built-in device properties at your service.

---
 MAINTAINERS                           |  1 -
 drivers/nfc/nxp-nci/core.c            |  1 -
 drivers/nfc/nxp-nci/i2c.c             |  9 +--------
 drivers/nfc/nxp-nci/nxp-nci.h         |  1 -
 include/linux/platform_data/nxp-nci.h | 27 ---------------------------
 5 files changed, 1 insertion(+), 38 deletions(-)
 delete mode 100644 include/linux/platform_data/nxp-nci.h
MAINTAINERS +0 -1
index 7707c28628b9..faa7493933de 100644
@@ -11068,7 +11068,6 @@ F:	include/net/nfc/
 F:	include/uapi/linux/nfc.h
 F:	drivers/nfc/
 F:	include/linux/platform_data/nfcmrvl.h
-F:	include/linux/platform_data/nxp-nci.h
 F:	Documentation/devicetree/bindings/net/nfc/
 
 NFS, SUNRPC, AND LOCKD CLIENTS
drivers/nfc/nxp-nci/core.c +0 -1
index 2e4b004a96aa..1907b1fd57a7 100644
@@ -25,7 +25,6 @@
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/nfc.h>
-#include <linux/platform_data/nxp-nci.h>
 
 #include <net/nfc/nci_core.h>
 
drivers/nfc/nxp-nci/i2c.c +1 -8
index fec904ad624b..549e09deb92f 100644
@@ -34,7 +34,6 @@
 #include <linux/gpio/consumer.h>
 #include <linux/of_gpio.h>
 #include <linux/of_irq.h>
-#include <linux/platform_data/nxp-nci.h>
 #include <asm/unaligned.h>
 
 #include <net/nfc/nfc.h>
@@ -315,7 +314,6 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
 			    const struct i2c_device_id *id)
 {
 	struct nxp_nci_i2c_phy *phy;
-	struct nxp_nci_nfc_platform_data *pdata;
 	int r;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -334,17 +332,12 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
 	phy->i2c_dev = client;
 	i2c_set_clientdata(client, phy);
 
-	pdata = client->dev.platform_data;
-
-	if (!pdata && client->dev.of_node) {
+	if (client->dev.of_node) {
 		r = nxp_nci_i2c_parse_devtree(client);
 		if (r < 0) {
 			nfc_err(&client->dev, "Failed to get DT data\n");
 			goto probe_exit;
 		}
-	} else if (pdata) {
-		phy->gpio_en = pdata->gpio_en;
-		phy->gpio_fw = pdata->gpio_fw;
 	} else if (ACPI_HANDLE(&client->dev)) {
 		r = nxp_nci_i2c_acpi_config(phy);
 		if (r < 0)
drivers/nfc/nxp-nci/nxp-nci.h +0 -1
index 20408cbff4f1..e584c92fad49 100644
@@ -25,7 +25,6 @@
 #include <linux/completion.h>
 #include <linux/firmware.h>
 #include <linux/nfc.h>
-#include <linux/platform_data/nxp-nci.h>
 
 #include <net/nfc/nci_core.h>
 
include/linux/platform_data/nxp-nci.h deleted +0 -27
deleted file mode 100644
index d6ed28679bb2..000000000000
@@ -1,27 +0,0 @@
-/*
- * Generic platform data for the NXP NCI NFC chips.
- *
- * Copyright (C) 2014  NXP Semiconductors  All rights reserved.
- *
- * Authors: Clément Perrochaud <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef _NXP_NCI_H_
-#define _NXP_NCI_H_
-
-struct nxp_nci_nfc_platform_data {
-	unsigned int gpio_en;
-	unsigned int gpio_fw;
-	unsigned int irq;
-};
-
-#endif /* _NXP_NCI_H_ */
Signature · 1 line
2.20.1
#3 lore raw

PATCH v2 3/12 NFC: nxp-nci: Convert to use GPIO descriptor

In reply to Andy Shevchenko

Since we got rid of platform data, the driver may use GPIO descriptor directly.

---
 drivers/nfc/nxp-nci/core.c |  1 -
 drivers/nfc/nxp-nci/i2c.c  | 60 ++++++++++----------------------------
 2 files changed, 15 insertions(+), 46 deletions(-)
drivers/nfc/nxp-nci/core.c +0 -1
index 1907b1fd57a7..b0b6db81a5e8 100644
@@ -22,7 +22,6 @@
  */
 
 #include <linux/delay.h>
-#include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/nfc.h>
 
drivers/nfc/nxp-nci/i2c.c +15 -45

112 lines not on this page · raw message

Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 4/12 NFC: nxp-nci: Add GPIO ACPI mapping table

In reply to Andy Shevchenko

In order to unify GPIO resource request prepare gpiod_get_index() to behave correctly when there is no mapping provided by firmware.

Here we add explicit mapping between _CRS GpioIo() resources and their names used in the driver.

---
 drivers/nfc/nxp-nci/i2c.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/nfc/nxp-nci/i2c.c +16 -2
index 6f61368ae065..9a65dd6cd405 100644
@@ -258,6 +258,15 @@ static irqreturn_t nxp_nci_i2c_irq_thread_fn(int irq, void *phy_id)
 	return IRQ_NONE;
 }
 
+static const struct acpi_gpio_params firmware_gpios = { 1, 0, false };
+static const struct acpi_gpio_params enable_gpios = { 2, 0, false };
+
+static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = {
+	{ "enable-gpios", &enable_gpios, 1 },
+	{ "firmware-gpios", &firmware_gpios, 1 },
+	{ }
+};
+
 static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
 {
 	struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
@@ -280,9 +289,14 @@ static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
 static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
 {
 	struct i2c_client *client = phy->i2c_dev;
+	int r;
 
-	phy->gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
-	phy->gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
+	r = devm_acpi_dev_add_driver_gpios(&client->dev, acpi_nxp_nci_gpios);
+	if (r)
+		return r;
+
+	phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
+	phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
 
 	if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
 		nfc_err(&client->dev, "No GPIOs\n");
Signature · 1 line
2.20.1
#5 lore raw

PATCH v2 5/12 NFC: nxp-nci: Get rid of code duplication in ->probe()

In reply to Andy Shevchenko

Since OF and ACPI case almost the same get rid of code duplication by moving gpiod_get() calls directly to ->probe().

---
 drivers/nfc/nxp-nci/i2c.c | 68 +++++++++------------------------------
 1 file changed, 15 insertions(+), 53 deletions(-)
drivers/nfc/nxp-nci/i2c.c +15 -53
index 9a65dd6cd405..9eeb59d1199a 100644
@@ -267,48 +267,10 @@ static const struct acpi_gpio_mapping acpi_nxp_nci_gpios[] = {
 	{ }
 };
 
-static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
-{
-	struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
-
-	phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
-	if (IS_ERR(phy->gpiod_en)) {
-		nfc_err(&client->dev, "Failed to get EN gpio\n");
-		return PTR_ERR(phy->gpiod_en);
-	}
-
-	phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
-	if (IS_ERR(phy->gpiod_fw)) {
-		nfc_err(&client->dev, "Failed to get FW gpio\n");
-		return PTR_ERR(phy->gpiod_fw);
-	}
-
-	return 0;
-}
-
-static int nxp_nci_i2c_acpi_config(struct nxp_nci_i2c_phy *phy)
-{
-	struct i2c_client *client = phy->i2c_dev;
-	int r;
-
-	r = devm_acpi_dev_add_driver_gpios(&client->dev, acpi_nxp_nci_gpios);
-	if (r)
-		return r;
-
-	phy->gpiod_en = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
-	phy->gpiod_fw = devm_gpiod_get(&client->dev, "firmware", GPIOD_OUT_LOW);
-
-	if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
-		nfc_err(&client->dev, "No GPIOs\n");
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int nxp_nci_i2c_probe(struct i2c_client *client,
 			    const struct i2c_device_id *id)
 {
+	struct device *dev = &client->dev;
 	struct nxp_nci_i2c_phy *phy;
 	int r;
 
@@ -328,20 +290,20 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
 	phy->i2c_dev = client;
 	i2c_set_clientdata(client, phy);
 
-	if (client->dev.of_node) {
-		r = nxp_nci_i2c_parse_devtree(client);
-		if (r < 0) {
-			nfc_err(&client->dev, "Failed to get DT data\n");
-			goto probe_exit;
-		}
-	} else if (ACPI_HANDLE(&client->dev)) {
-		r = nxp_nci_i2c_acpi_config(phy);
-		if (r < 0)
-			goto probe_exit;
-	} else {
-		nfc_err(&client->dev, "No platform data\n");
-		r = -EINVAL;
-		goto probe_exit;
+	r = devm_acpi_dev_add_driver_gpios(dev, acpi_nxp_nci_gpios);
+	if (r)
+		return r;
+
+	phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
+	if (IS_ERR(phy->gpiod_en)) {
+		nfc_err(dev, "Failed to get EN gpio\n");
+		return PTR_ERR(phy->gpiod_en);
+	}
+
+	phy->gpiod_fw = devm_gpiod_get(dev, "firmware", GPIOD_OUT_LOW);
+	if (IS_ERR(phy->gpiod_fw)) {
+		nfc_err(dev, "Failed to get FW gpio\n");
+		return PTR_ERR(phy->gpiod_fw);
 	}
 
 	r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
Signature · 1 line
2.20.1
#6 lore raw

PATCH v2 6/12 NFC: nxp-nci: Get rid of useless label

In reply to Andy Shevchenko

Return directly in ->probe() since there no special cleaning is needed.

---
 drivers/nfc/nxp-nci/i2c.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/nfc/nxp-nci/i2c.c +4 -8
index 9eeb59d1199a..6379f2198524 100644
@@ -276,16 +276,13 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
-		r = -ENODEV;
-		goto probe_exit;
+		return -ENODEV;
 	}
 
 	phy = devm_kzalloc(&client->dev, sizeof(struct nxp_nci_i2c_phy),
 			   GFP_KERNEL);
-	if (!phy) {
-		r = -ENOMEM;
-		goto probe_exit;
-	}
+	if (!phy)
+		return -ENOMEM;
 
 	phy->i2c_dev = client;
 	i2c_set_clientdata(client, phy);
@@ -309,7 +306,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
 	r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
 			  NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev);
 	if (r < 0)
-		goto probe_exit;
+		return r;
 
 	r = request_threaded_irq(client->irq, NULL,
 				 nxp_nci_i2c_irq_thread_fn,
@@ -318,7 +315,6 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
 	if (r < 0)
 		nfc_err(&client->dev, "Unable to register IRQ handler\n");
 
-probe_exit:
 	return r;
 }
 
Signature · 1 line
2.20.1
#7 lore raw

PATCH v2 7/12 NFC: nxp-nci: Constify acpi_device_id

In reply to Andy Shevchenko

The content of acpi_device_id is not supposed to change at runtime. All functions working with acpi_device_id provided by <linux/acpi.h> work with const acpi_device_id. So mark the non-const structs as const.

---
 drivers/nfc/nxp-nci/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +1 -1
index 6379f2198524..472bedbeb5d8 100644
@@ -341,7 +341,7 @@ static const struct of_device_id of_nxp_nci_i2c_match[] = {
 MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
 
 #ifdef CONFIG_ACPI
-static struct acpi_device_id acpi_id[] = {
+static const struct acpi_device_id acpi_id[] = {
 	{ "NXP1001" },
 	{ "NXP7471" },
 	{ },
Signature · 1 line
2.20.1
#8 lore raw

PATCH v2 8/12 NFC: nxp-nci: Drop of_match_ptr() use

In reply to Andy Shevchenko

There is no need to guard OF device ID table with of_match_ptr(). Otherwise we would get a defined but not used data.

---
 drivers/nfc/nxp-nci/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/nxp-nci/i2c.c +1 -1
index 472bedbeb5d8..69c98f2018e3 100644
@@ -353,7 +353,7 @@ static struct i2c_driver nxp_nci_i2c_driver = {
 	.driver = {
 		   .name = NXP_NCI_I2C_DRIVER_NAME,
 		   .acpi_match_table = ACPI_PTR(acpi_id),
-		   .of_match_table = of_match_ptr(of_nxp_nci_i2c_match),
+		   .of_match_table = of_nxp_nci_i2c_match,
 		  },
 	.probe = nxp_nci_i2c_probe,
 	.id_table = nxp_nci_i2c_id_table,
Signature · 1 line
2.20.1
#9 lore raw

PATCH v2 9/12 NFC: nxp-nci: Drop comma in terminator lines

In reply to Andy Shevchenko

There is no need to have a comma after terminator entry in the arrays of IDs.

This may prevent the misguided addition behind the terminator without compiler notice.

Drop the comma in terminator lines for good.

---
 drivers/nfc/nxp-nci/i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nfc/nxp-nci/i2c.c +2 -2
index 69c98f2018e3..6114787e13a3 100644
@@ -336,7 +336,7 @@ MODULE_DEVICE_TABLE(i2c, nxp_nci_i2c_id_table);
 
 static const struct of_device_id of_nxp_nci_i2c_match[] = {
 	{ .compatible = "nxp,nxp-nci-i2c", },
-	{},
+	{}
 };
 MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
 
@@ -344,7 +344,7 @@ MODULE_DEVICE_TABLE(of, of_nxp_nci_i2c_match);
 static const struct acpi_device_id acpi_id[] = {
 	{ "NXP1001" },
 	{ "NXP7471" },
-	{ },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, acpi_id);
 #endif
Signature · 1 line
2.20.1
#10 lore raw

PATCH v2 10/12 NFC: nxp-nci: Remove unused macro pr_fmt()

In reply to Andy Shevchenko

The macro had never been used.

---
 drivers/nfc/nxp-nci/i2c.c | 2 --
 1 file changed, 2 deletions(-)
drivers/nfc/nxp-nci/i2c.c +0 -2
index 6114787e13a3..703f4c8fa751 100644
@@ -23,8 +23,6 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
 #include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
Signature · 1 line
2.20.1
#11 lore raw

PATCH v2 11/12 NFC: nxp-nci: Remove 'default n' for tests

In reply to Andy Shevchenko

It seems contributors follow the style of Kconfig entries where explicit 'default n' is present. The default 'default' is 'n' already, thus, drop these lines from Kconfig to make it more clear.

---
 drivers/nfc/nxp-nci/Kconfig | 1 -
 1 file changed, 1 deletion(-)
drivers/nfc/nxp-nci/Kconfig +0 -1
index 37b40612520d..a28c4265354d 100644
@@ -1,7 +1,6 @@
 config NFC_NXP_NCI
 	tristate "NXP-NCI NFC driver"
 	depends on NFC_NCI
-	default n
 	---help---
 	  Generic core driver for NXP NCI chips such as the NPC100
 	  or PN7150 families.
Signature · 1 line
2.20.1
#12 lore raw

PATCH v2 12/12 NFC: nxp-nci: Convert to SPDX license tags

In reply to Andy Shevchenko

Replace boiler plate licenses texts with the SPDX license identifiers in the mei nfc files header.

---
 drivers/nfc/nxp-nci/core.c     | 13 +------------
 drivers/nfc/nxp-nci/firmware.c | 13 +------------
 drivers/nfc/nxp-nci/i2c.c      | 13 +------------
 3 files changed, 3 insertions(+), 36 deletions(-)
drivers/nfc/nxp-nci/core.c +1 -12
index b0b6db81a5e8..643347cac007 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Generic driver for NXP NCI NFC chips
  *
@@ -7,18 +8,6 @@
  *
  * Derived from PN544 device driver:
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/delay.h>
drivers/nfc/nxp-nci/firmware.c +1 -12
index e50c6f67bb39..231c93b3dc5f 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Generic driver for NXP NCI NFC chips
  *
@@ -7,18 +8,6 @@
  *
  * Derived from PN544 device driver:
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/completion.h>
drivers/nfc/nxp-nci/i2c.c +1 -12
index 703f4c8fa751..69ab576ef438 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * I2C link layer for the NXP NCI driver
  *
@@ -9,18 +10,6 @@
  *
  * Derived from PN544 device driver:
  * Copyright (C) 2012  Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <linux/acpi.h>
Signature · 1 line
2.20.1
#13 lore raw
In reply to Andy Shevchenko
Quoted 11 lines · Andy Shevchenko

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/

Quoted 33 lines

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

#14 lore raw

On Mon, May 13, 2019 at 1:43 PM Sedat Dilek <[email protected]> wrote:
[...]

Quoted 7 lines
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 -

#15 lore raw
Quoted 1 line · Sedat Dilek

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

#16 lore raw
In reply to Sedat Dilek
Quoted 67 lines · Sedat Dilek
Quoted 2 lines · Andy Shevchenko

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: [ ]

Quoted 5 lines

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.

Quoted 1 line

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

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#17 lore raw
In reply to Andy Shevchenko
Quoted 41 lines · Andy Shevchenko

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
Quoted 3 lines

--
2.20.1

Can we have NPC300 listed in the Kconfg help text?

Thanks.

- Sedat -

$ git diff
drivers/nfc/nxp-nci/Kconfig +2 -2
index a28c4265354d..f2173c1de745 100644
@@ -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.
#18 lore raw
Quoted 43 lines · Sedat Dilek
Quoted 31 lines · Andy Shevchenko

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

Quoted 9 lines
 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
Quoted 1 line

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?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#19 lore raw
Quoted 45 lines · Andy Shevchenko
Quoted 43 lines · Sedat Dilek
Quoted 40 lines · Andy Shevchenko

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
Quoted 7 lines
Quoted 1 line

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 -

#20 lore raw
Quoted 1 line · Sedat Dilek

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

#21 lore raw
Quoted 4 lines · Oleg Zhurakivskyy

On 5/14/19 11:34 AM, Sedat Dilek wrote:

Quoted 8 lines
Quoted 1 line

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 -

#22 lore raw

OK, thanks!

Quoted 2 lines · Sedat Dilek

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

#23 lore raw
Quoted 11 lines · Oleg Zhurakivskyy

OK, thanks!

Quoted 2 lines · Sedat Dilek

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 -

#24 lore raw
Quoted 4 lines · Sedat Dilek

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

#25 lore raw
Quoted 6 lines · Oleg Zhurakivskyy
Quoted 2 lines · Sedat Dilek

Say Y if unsure.

Quoted 9 lines
Quoted 2 lines

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?

drivers/nfc/nxp-nci/Kconfig +8 -3
index a28c4265354d..b9e6486aa8fe 100644
@@ -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 -

#26 lore raw
Quoted 21 lines · Sedat Dilek

On Tue, May 14, 2019 at 3:57 PM Oleg Zhurakivskyy
<[email protected]> wrote:

What about this one?

drivers/nfc/nxp-nci/Kconfig +2 -2
index a28c4265354d..b9e6486aa8fe 100644
@@ -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.
 

drivers/nfc/nxp-nci/Kconfig config NFC_NXP_NCI_I2C · line 26

Quoted 8 lines
drivers/nfc/nxp-nci/Kconfig +5 -0
@@ -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.

Quoted 4 lines
drivers/nfc/nxp-nci/Kconfig +1 -1
          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.
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#27 lore raw
Quoted 45 lines · Andy Shevchenko
Quoted 21 lines · Sedat Dilek

On Tue, May 14, 2019 at 3:57 PM Oleg Zhurakivskyy
<[email protected]> wrote:

What about this one?

drivers/nfc/nxp-nci/Kconfig +2 -2
index a28c4265354d..b9e6486aa8fe 100644
@@ -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.
 

drivers/nfc/nxp-nci/Kconfig config NFC_NXP_NCI_I2C · line 26

Quoted 8 lines
drivers/nfc/nxp-nci/Kconfig +5 -0
@@ -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.

drivers/nfc/nxp-nci/Kconfig config NFC_NXP_NCI_I2C · line 29

Quoted 4 lines
drivers/nfc/nxp-nci/Kconfig +1 -1
          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.
Quoted 5 lines

--
With Best Regards,
Andy Shevchenko

Excellent eyes (TAB + 2 spaces)!

So, this is enough?

$ git diff
drivers/nfc/nxp-nci/Kconfig +3 -3
index a28c4265354d..d85a4761e271 100644
@@ -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 -

#28 lore raw
Quoted 4 lines · Sedat Dilek

On Tue, May 14, 2019 at 7:01 PM Andy Shevchenko
<[email protected]> 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.

Quoted 28 lines
$ git diff
drivers/nfc/nxp-nci/Kconfig +3 -3
index a28c4265354d..d85a4761e271 100644
@@ -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 -

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#29 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 4 lines · Sedat Dilek

On Tue, May 14, 2019 at 7:01 PM Andy Shevchenko
<[email protected]> 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 -

Quoted 34 lines
Quoted 23 lines
$ git diff
drivers/nfc/nxp-nci/Kconfig +3 -3
index a28c4265354d..d85a4761e271 100644
@@ -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.
Quoted 5 lines

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

Thanks.

- Sedat -

--
With Best Regards,
Andy Shevchenko

#30 lore raw
In reply to Andy Shevchenko
Quoted 41 lines · Andy Shevchenko

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
Quoted 3 lines

--
2.20.1

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

- Sedat -

#31 lore raw
Quoted 5 lines · Sedat Dilek

On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
<[email protected]> 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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#32 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 5 lines · Sedat Dilek

On Mon, May 13, 2019 at 12:44 PM Andy Shevchenko
<[email protected]> 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 -