* Re: KASAN: use-after-free Read in p54u_load_firmware_cb
From: syzbot @ 2019-05-13 10:23 UTC (permalink / raw)
To: andreyknvl, chunkeey, davem, kvalo, linux-kernel, linux-usb,
linux-wireless, netdev, syzkaller-bugs
In-Reply-To: <000000000000050c5f0588363ad6@google.com>
syzbot has found a reproducer for the following crash on:
HEAD commit: 43151d6c usb-fuzzer: main usb gadget fuzzer driver
git tree: https://github.com/google/kasan.git usb-fuzzer
console output: https://syzkaller.appspot.com/x/log.txt?x=16b64110a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=4183eeef650d1234
dashboard link: https://syzkaller.appspot.com/bug?extid=200d4bb11b23d929335f
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1634c900a00000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+200d4bb11b23d929335f@syzkaller.appspotmail.com
usb 1-1: config 0 descriptor??
usb 1-1: reset high-speed USB device number 2 using dummy_hcd
usb 1-1: device descriptor read/64, error -71
usb 1-1: Using ep0 maxpacket: 8
usb 1-1: Loading firmware file isl3887usb
usb 1-1: Direct firmware load for isl3887usb failed with error -2
usb 1-1: Firmware not found.
==================================================================
BUG: KASAN: use-after-free in p54u_load_firmware_cb.cold+0x97/0x13a
drivers/net/wireless/intersil/p54/p54usb.c:936
Read of size 8 at addr ffff88809803f588 by task kworker/1:0/17
CPU: 1 PID: 17 Comm: kworker/1:0 Not tainted 5.1.0-rc3-319004-g43151d6 #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Workqueue: events request_firmware_work_func
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xe8/0x16e lib/dump_stack.c:113
print_address_description+0x6c/0x236 mm/kasan/report.c:187
kasan_report.cold+0x1a/0x3c mm/kasan/report.c:317
p54u_load_firmware_cb.cold+0x97/0x13a
drivers/net/wireless/intersil/p54/p54usb.c:936
request_firmware_work_func+0x12d/0x249
drivers/base/firmware_loader/main.c:785
process_one_work+0x90f/0x1580 kernel/workqueue.c:2269
worker_thread+0x9b/0xe20 kernel/workqueue.c:2415
kthread+0x313/0x420 kernel/kthread.c:253
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
Allocated by task 0:
(stack is not available)
Freed by task 0:
(stack is not available)
The buggy address belongs to the object at ffff88809803f180
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 8 bytes to the right of
1024-byte region [ffff88809803f180, ffff88809803f580)
The buggy address belongs to the page:
page:ffffea0002600f00 count:1 mapcount:0 mapping:ffff88812c3f4a00 index:0x0
compound_mapcount: 0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 dead000000000100 dead000000000200 ffff88812c3f4a00
raw: 0000000000000000 00000000800e000e 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88809803f480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809803f500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ffff88809803f580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff88809803f600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88809803f680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
^ permalink raw reply
* [PATCH] mt76: mt76x02: fix edcca file permission
From: Lorenzo Bianconi @ 2019-05-13 10:23 UTC (permalink / raw)
To: nbd; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <cover.1557742856.git.lorenzo@kernel.org>
Use 0600 as edcca file permission in mt76x02 debugfs
Fixes: 643749d4a82b ("mt76: mt76x02: disable ED/CCA by default")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
index f412c779d8e2..ffdba5ffc22d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
@@ -157,7 +157,7 @@ void mt76x02_init_debugfs(struct mt76x02_dev *dev)
debugfs_create_u8("temperature", 0400, dir, &dev->cal.temp);
debugfs_create_bool("tpc", 0600, dir, &dev->enable_tpc);
- debugfs_create_file("edcca", 0400, dir, dev, &fops_edcca);
+ debugfs_create_file("edcca", 0600, dir, dev, &fops_edcca);
debugfs_create_file("ampdu_stat", 0400, dir, dev, &fops_ampdu_stat);
debugfs_create_file("dfs_stats", 0400, dir, dev, &fops_dfs_stat);
debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir,
--
2.20.1
^ permalink raw reply related
* [PATCH v2 01/12] NFC: nxp-nci: Add NXP1001 to the ACPI ID table
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index ba695e392c3b..fec904ad624b 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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" },
{ },
};
--
2.20.1
^ permalink raw reply related
* [PATCH v2 04/12] NFC: nxp-nci: Add GPIO ACPI mapping table
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6f61368ae065..9a65dd6cd405 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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");
--
2.20.1
^ permalink raw reply related
* [PATCH v2 03/12] NFC: nxp-nci: Convert to use GPIO descriptor
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
Since we got rid of platform data, the driver may use
GPIO descriptor directly.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/core.c | 1 -
drivers/nfc/nxp-nci/i2c.c | 60 ++++++++++----------------------------
2 files changed, 15 insertions(+), 46 deletions(-)
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index 1907b1fd57a7..b0b6db81a5e8 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -22,7 +22,6 @@
*/
#include <linux/delay.h>
-#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/nfc.h>
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 549e09deb92f..6f61368ae065 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -32,8 +32,6 @@
#include <linux/module.h>
#include <linux/nfc.h>
#include <linux/gpio/consumer.h>
-#include <linux/of_gpio.h>
-#include <linux/of_irq.h>
#include <asm/unaligned.h>
#include <net/nfc/nfc.h>
@@ -48,8 +46,8 @@ struct nxp_nci_i2c_phy {
struct i2c_client *i2c_dev;
struct nci_dev *ndev;
- unsigned int gpio_en;
- unsigned int gpio_fw;
+ struct gpio_desc *gpiod_en;
+ struct gpio_desc *gpiod_fw;
int hard_fault; /*
* < 0 if hardware error occurred (e.g. i2c err)
@@ -62,8 +60,8 @@ static int nxp_nci_i2c_set_mode(void *phy_id,
{
struct nxp_nci_i2c_phy *phy = (struct nxp_nci_i2c_phy *) phy_id;
- gpio_set_value(phy->gpio_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0);
- gpio_set_value(phy->gpio_en, (mode != NXP_NCI_MODE_COLD) ? 1 : 0);
+ gpiod_set_value(phy->gpiod_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0);
+ gpiod_set_value(phy->gpiod_en, (mode != NXP_NCI_MODE_COLD) ? 1 : 0);
usleep_range(10000, 15000);
if (mode == NXP_NCI_MODE_COLD)
@@ -263,30 +261,18 @@ static irqreturn_t nxp_nci_i2c_irq_thread_fn(int irq, void *phy_id)
static int nxp_nci_i2c_parse_devtree(struct i2c_client *client)
{
struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
- struct device_node *pp;
- int r;
-
- pp = client->dev.of_node;
- if (!pp)
- return -ENODEV;
- r = of_get_named_gpio(pp, "enable-gpios", 0);
- if (r == -EPROBE_DEFER)
- r = of_get_named_gpio(pp, "enable-gpios", 0);
- if (r < 0) {
- nfc_err(&client->dev, "Failed to get EN gpio, error: %d\n", r);
- return r;
+ 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->gpio_en = r;
- r = of_get_named_gpio(pp, "firmware-gpios", 0);
- if (r == -EPROBE_DEFER)
- r = of_get_named_gpio(pp, "firmware-gpios", 0);
- if (r < 0) {
- nfc_err(&client->dev, "Failed to get FW gpio, error: %d\n", r);
- return r;
+ 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);
}
- phy->gpio_fw = r;
return 0;
}
@@ -294,19 +280,15 @@ 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;
- struct gpio_desc *gpiod_en, *gpiod_fw;
- gpiod_en = devm_gpiod_get_index(&client->dev, NULL, 2, GPIOD_OUT_LOW);
- gpiod_fw = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_OUT_LOW);
+ 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);
- if (IS_ERR(gpiod_en) || IS_ERR(gpiod_fw)) {
+ if (IS_ERR(phy->gpiod_en) || IS_ERR(phy->gpiod_fw)) {
nfc_err(&client->dev, "No GPIOs\n");
return -EINVAL;
}
- phy->gpio_en = desc_to_gpio(gpiod_en);
- phy->gpio_fw = desc_to_gpio(gpiod_fw);
-
return 0;
}
@@ -342,24 +324,12 @@ static int nxp_nci_i2c_probe(struct i2c_client *client,
r = nxp_nci_i2c_acpi_config(phy);
if (r < 0)
goto probe_exit;
- goto nci_probe;
} else {
nfc_err(&client->dev, "No platform data\n");
r = -EINVAL;
goto probe_exit;
}
- r = devm_gpio_request_one(&phy->i2c_dev->dev, phy->gpio_en,
- GPIOF_OUT_INIT_LOW, "nxp_nci_en");
- if (r < 0)
- goto probe_exit;
-
- r = devm_gpio_request_one(&phy->i2c_dev->dev, phy->gpio_fw,
- GPIOF_OUT_INIT_LOW, "nxp_nci_fw");
- if (r < 0)
- goto probe_exit;
-
-nci_probe:
r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev);
if (r < 0)
--
2.20.1
^ permalink raw reply related
* [PATCH v2 09/12] NFC: nxp-nci: Drop comma in terminator lines
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 69c98f2018e3..6114787e13a3 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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
--
2.20.1
^ permalink raw reply related
* [PATCH v2 06/12] NFC: nxp-nci: Get rid of useless label
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
Return directly in ->probe() since there no special cleaning is needed.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 9eeb59d1199a..6379f2198524 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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;
}
--
2.20.1
^ permalink raw reply related
* [PATCH v2 11/12] NFC: nxp-nci: Remove 'default n' for tests
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/Kconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/Kconfig b/drivers/nfc/nxp-nci/Kconfig
index 37b40612520d..a28c4265354d 100644
--- a/drivers/nfc/nxp-nci/Kconfig
+++ b/drivers/nfc/nxp-nci/Kconfig
@@ -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.
--
2.20.1
^ permalink raw reply related
* [PATCH v2 05/12] NFC: nxp-nci: Get rid of code duplication in ->probe()
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
Since OF and ACPI case almost the same get rid of code duplication
by moving gpiod_get() calls directly to ->probe().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 68 +++++++++------------------------------
1 file changed, 15 insertions(+), 53 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 9a65dd6cd405..9eeb59d1199a 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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,
--
2.20.1
^ permalink raw reply related
* [PATCH v2 07/12] NFC: nxp-nci: Constify acpi_device_id
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6379f2198524..472bedbeb5d8 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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" },
{ },
--
2.20.1
^ permalink raw reply related
* [PATCH v2 12/12] NFC: nxp-nci: Convert to SPDX license tags
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
Replace boiler plate licenses texts with the SPDX license
identifiers in the mei nfc files header.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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(-)
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index b0b6db81a5e8..643347cac007 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -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>
diff --git a/drivers/nfc/nxp-nci/firmware.c b/drivers/nfc/nxp-nci/firmware.c
index e50c6f67bb39..231c93b3dc5f 100644
--- a/drivers/nfc/nxp-nci/firmware.c
+++ b/drivers/nfc/nxp-nci/firmware.c
@@ -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>
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 703f4c8fa751..69ab576ef438 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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>
--
2.20.1
^ permalink raw reply related
* [PATCH v2 10/12] NFC: nxp-nci: Remove unused macro pr_fmt()
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
The macro had never been used.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6114787e13a3..703f4c8fa751 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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>
--
2.20.1
^ permalink raw reply related
* [PATCH v2 00/12] NFC: nxp-nci: clean up and support new ID
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: 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
--
2.20.1
^ permalink raw reply
* [PATCH v2 02/12] NFC: nxp-nci: Get rid of platform data
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
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
diff --git a/MAINTAINERS b/MAINTAINERS
index 7707c28628b9..faa7493933de 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index 2e4b004a96aa..1907b1fd57a7 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -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>
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index fec904ad624b..549e09deb92f 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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)
diff --git a/drivers/nfc/nxp-nci/nxp-nci.h b/drivers/nfc/nxp-nci/nxp-nci.h
index 20408cbff4f1..e584c92fad49 100644
--- a/drivers/nfc/nxp-nci/nxp-nci.h
+++ b/drivers/nfc/nxp-nci/nxp-nci.h
@@ -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>
diff --git a/include/linux/platform_data/nxp-nci.h b/include/linux/platform_data/nxp-nci.h
deleted file mode 100644
index d6ed28679bb2..000000000000
--- a/include/linux/platform_data/nxp-nci.h
+++ /dev/null
@@ -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 <clement.perrochaud@nxp.com>
- *
- * 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_ */
--
2.20.1
^ permalink raw reply related
* [PATCH v2 08/12] NFC: nxp-nci: Drop of_match_ptr() use
From: Andy Shevchenko @ 2019-05-13 10:43 UTC (permalink / raw)
To: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Sedat Dilek, Oleg Zhurakivskyy
Cc: Andy Shevchenko
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
There is no need to guard OF device ID table with of_match_ptr().
Otherwise we would get a defined but not used data.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/nfc/nxp-nci/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 472bedbeb5d8..69c98f2018e3 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -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,
--
2.20.1
^ permalink raw reply related
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-13 10:51 UTC (permalink / raw)
To: Oleg Zhurakivskyy
Cc: Samuel Ortiz, Andy Shevchenko, linux-wireless, linux-nfc
In-Reply-To: <2b1bd56f-8797-fb90-e2af-218edaedd089@intel.com>
On Mon, May 13, 2019 at 12:15 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> Hi Sedat,
>
> On 5/13/19 12:27 PM, Sedat Dilek wrote:
>
> > So, this seems to work.
>
> I spent a bit of time trying to find T470, couldn’t, anyway managed to get to ”NXP 1001” and was going to hint you further.
>
> Congratulations, great job!
>
> And thanks a lot for documenting everything and posting it here. Perhaps, eventually it could be upstreamed.
>
Hi Oleg,
Thanks to you and Andy.
As far as I have understood the pn5xx_i2c kernel driver (from NXP or
better to say the ACPI support modified one by jr64 user) is needed as
the NFC device is not auto-detected/configured via I2C and GPIO and
ACPI.
Unsure, why the pn544_i2c NFC driver shipped with the Linux v5.1.1
does not work.
Or what it is missing.
Helpful was the PDF from [1].
Furthermore, I have seen that Debian refused to integrate the NXP
libnfc-nci library due to policy issues (see [2]).
libnfc library shipped with Debian does not work.
- Sedat -
[1] http://www.nxp.com/documents/application_note/AN11697.pdf
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854606
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Andy Shevchenko @ 2019-05-13 10:57 UTC (permalink / raw)
To: Sedat Dilek; +Cc: Oleg Zhurakivskyy, Samuel Ortiz, linux-wireless, linux-nfc
In-Reply-To: <CA+icZUWXSup0BfXNZXxcrAAbu-b9KCiBU++OkC+eFqacMrTwRg@mail.gmail.com>
On Mon, May 13, 2019 at 12:38:27PM +0200, Sedat Dilek wrote:
> On Mon, May 13, 2019 at 11:51 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Mon, May 13, 2019 at 11:27:07AM +0200, Sedat Dilek wrote:
> >
> > > Sorry to say, I still have not get all correlations...
> >
> > Can you provide the output of the following on running Linux system with latest
> > possible kernel you can install (I am expecting v5.1) and command line with
> > 'ignore_loglevel'?
> >
> > 1. `dmesg`
> > 2. `grep -H 15 /sys/bus/acpi/devices/*/status`
> > 3. `acpidump -o t470-tables.dat` # the file t470-tables.dat
> > 4. `lspci -vv -nk`
> >
> > P.S. You may use GitHub gist for this set (please, don't share archives) or any
> > other resource like pastebin.
> >
>
> Looks like I am unable to use Debian's gist-paste package today or
> need more coffee.
>
> So, I add this here.
>
> I added my kernel-config.
Thanks. I just sent a series to (hopefully) support it in the vanilla kernel.
Can you test it?
P.S. I see in dmesg the pn544 tries to bind to the NXP1001. Do you have some
custom patches for that in your kernel? If so, please drop them.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-13 11:07 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Oleg Zhurakivskyy, Samuel Ortiz, linux-wireless, linux-nfc
In-Reply-To: <20190513105745.GR9224@smile.fi.intel.com>
On Mon, May 13, 2019 at 12:57 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, May 13, 2019 at 12:38:27PM +0200, Sedat Dilek wrote:
> > On Mon, May 13, 2019 at 11:51 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > On Mon, May 13, 2019 at 11:27:07AM +0200, Sedat Dilek wrote:
> > >
> > > > Sorry to say, I still have not get all correlations...
> > >
> > > Can you provide the output of the following on running Linux system with latest
> > > possible kernel you can install (I am expecting v5.1) and command line with
> > > 'ignore_loglevel'?
> > >
> > > 1. `dmesg`
> > > 2. `grep -H 15 /sys/bus/acpi/devices/*/status`
> > > 3. `acpidump -o t470-tables.dat` # the file t470-tables.dat
> > > 4. `lspci -vv -nk`
> > >
> > > P.S. You may use GitHub gist for this set (please, don't share archives) or any
> > > other resource like pastebin.
> > >
> >
> > Looks like I am unable to use Debian's gist-paste package today or
> > need more coffee.
> >
> > So, I add this here.
> >
> > I added my kernel-config.
>
>
> Thanks. I just sent a series to (hopefully) support it in the vanilla kernel.
> Can you test it?
>
> P.S. I see in dmesg the pn544 tries to bind to the NXP1001. Do you have some
> custom patches for that in your kernel? If so, please drop them.
>
Hi Andy,
I dropped the manually added nxp-pn5xx in driver/misc.
No, I have no custom patches.
Thanks, I amcompiling with your v2 series of NFC nxp-nci...
- Sedat -
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-13 11:22 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Oleg Zhurakivskyy, Samuel Ortiz, linux-wireless, linux-nfc
In-Reply-To: <CA+icZUVDTx_ZUuOgHVDmg5_a4tgrRkPp880+0KPaRJ1d=zF5VQ@mail.gmail.com>
On Mon, May 13, 2019 at 1:20 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Mon, May 13, 2019 at 12:57 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Mon, May 13, 2019 at 12:38:27PM +0200, Sedat Dilek wrote:
> > > On Mon, May 13, 2019 at 11:51 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > >
> > > > On Mon, May 13, 2019 at 11:27:07AM +0200, Sedat Dilek wrote:
> > > >
> > > > > Sorry to say, I still have not get all correlations...
> > > >
> > > > Can you provide the output of the following on running Linux system with latest
> > > > possible kernel you can install (I am expecting v5.1) and command line with
> > > > 'ignore_loglevel'?
> > > >
> > > > 1. `dmesg`
> > > > 2. `grep -H 15 /sys/bus/acpi/devices/*/status`
> > > > 3. `acpidump -o t470-tables.dat` # the file t470-tables.dat
> > > > 4. `lspci -vv -nk`
> > > >
> > > > P.S. You may use GitHub gist for this set (please, don't share archives) or any
> > > > other resource like pastebin.
> > > >
> > >
> > > Looks like I am unable to use Debian's gist-paste package today or
> > > need more coffee.
> > >
> > > So, I add this here.
> > >
> > > I added my kernel-config.
> >
> >
> > Thanks. I just sent a series to (hopefully) support it in the vanilla kernel.
> > Can you test it?
> >
> > P.S. I see in dmesg the pn544 tries to bind to the NXP1001. Do you have some
> > custom patches for that in your kernel? If so, please drop them.
> >
>
> Hi Andy,
>
> this looks promising!
>
> I have attached v2 of the disired outputs.
>
Output of modinfo looks good to me
root@iniza:~# modinfo nxp-nci_i2c
filename:
/lib/modules/5.1.1-1-amd64-gcc8-ldbfd/kernel/drivers/nfc/nxp-nci/nxp-nci_i2c.ko
author: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
author: Clément Perrochaud <clement.perrochaud@nxp.com>
description: I2C driver for NXP NCI NFC controllers
license: GPL
alias: i2c:nxp-nci_i2c
alias: acpi*:NXP7471:*
alias: acpi*:NXP1001:*
alias: of:N*T*Cnxp,nxp-nci-i2cC*
alias: of:N*T*Cnxp,nxp-nci-i2c
depends: nci,nxp-nci
retpoline: Y
intree: Y
name: nxp_nci_i2c
vermagic: 5.1.1-1-amd64-gcc8-ldbfd SMP mod_unload modversions
- Sedat -
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Oleg Zhurakivskyy @ 2019-05-13 11:28 UTC (permalink / raw)
To: sedat.dilek, Andy Shevchenko; +Cc: Samuel Ortiz, linux-wireless, linux-nfc
In-Reply-To: <CA+icZUVMjCWwuC-ee1-+EPU6+mYqFZ7w4ai4t4EJcrsvZ2_BYg@mail.gmail.com>
Hi Sedat, Andy,
Andy, thanks a lot for extending and cleaning that up.
> Unsure, why the pn544_i2c NFC driver shipped with the Linux v5.1.1
does not work.
I briefly looked into drivers/nfc/pn544, that seems like an HCI based chip (as opposed to NCI based PN547).
It might be that changes that Andy posted are already sufficient for PN547 to just work with neard (if I am not missing anything).
# sudo apt-get install neard neard-tools
# man nfctool
Regards,
Oleg
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-13 11:31 UTC (permalink / raw)
To: Oleg Zhurakivskyy
Cc: Andy Shevchenko, Samuel Ortiz, linux-wireless, linux-nfc
In-Reply-To: <3b7065a2-694f-63bf-fba3-a1641a03ea76@intel.com>
On Mon, May 13, 2019 at 1:28 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> Hi Sedat, Andy,
>
> Andy, thanks a lot for extending and cleaning that up.
>
> > Unsure, why the pn544_i2c NFC driver shipped with the Linux v5.1.1
> does not work.
>
> I briefly looked into drivers/nfc/pn544, that seems like an HCI based chip (as opposed to NCI based PN547).
>
> It might be that changes that Andy posted are already sufficient for PN547 to just work with neard (if I am not missing anything).
>
> # sudo apt-get install neard neard-tools
> # man nfctool
>
Away with NXP's libnfc-nci...
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: [ ]
Devices: [ ]
Protocols: [ Felica MIFARE Jewel ISO-DEP NFC-DEP ]
Powered: No
RF Mode: None
lto: 150
rw: 15
miux: 2047
Putting my YubiKey on the T470...
root@iniza:~# nfctool --poll -d nfc0
Start polling on nfc0 as initiator
Targets found for nfc0
Tags: [ tag0 ]
Devices: [ ]
Can I get a detailed view on the polling?
- Sedat -
^ permalink raw reply
* Re: [PATCH v2 00/12] NFC: nxp-nci: clean up and support new ID
From: Sedat Dilek @ 2019-05-13 11:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Oleg Zhurakivskyy
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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
>
^ permalink raw reply
* Re: [PATCH v2 00/12] NFC: nxp-nci: clean up and support new ID
From: Sedat Dilek @ 2019-05-13 11:46 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Oleg Zhurakivskyy
In-Reply-To: <CA+icZUUu6NmQoKS-2x32Fz388Q_ahXyYzLLf5JNm=mZR+r-0kQ@mail.gmail.com>
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 -
^ permalink raw reply
* Re: [linux-nfc] ThinkPad T470 and NXP PN5xx (PN547 or PN548)
From: Sedat Dilek @ 2019-05-13 11:50 UTC (permalink / raw)
To: Oleg Zhurakivskyy
Cc: Andy Shevchenko, Samuel Ortiz, linux-wireless, linux-nfc
In-Reply-To: <3b7065a2-694f-63bf-fba3-a1641a03ea76@intel.com>
On Mon, May 13, 2019 at 1:28 PM Oleg Zhurakivskyy
<oleg.zhurakivskyy@intel.com> wrote:
>
>
> Hi Sedat, Andy,
>
> Andy, thanks a lot for extending and cleaning that up.
>
> > Unsure, why the pn544_i2c NFC driver shipped with the Linux v5.1.1
> does not work.
>
> I briefly looked into drivers/nfc/pn544, that seems like an HCI based chip (as opposed to NCI based PN547).
>
> It might be that changes that Andy posted are already sufficient for PN547 to just work with neard (if I am not missing anything).
>
> # sudo apt-get install neard neard-tools
> # man nfctool
>
With the nxp-pn5xx (plus acpi support) and running the nfcDemoApp
demo-app I saw this in the logs...
$ grep PN548 nfcDemoApp-poll.txt
NxpHal: phNxpNciHal_deriveChipType Hw Version (0x68) Not Found:
Setting Default Chip Type : PN548C2
NxpHal: phNxpNciHal_deriveChipType NxpNci > Product : PN548C2
- Sedat -
^ permalink raw reply
* Re: [PATCH v2 00/12] NFC: nxp-nci: clean up and support new ID
From: Sedat Dilek @ 2019-05-13 12:18 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Clément Perrochaud, Charles Gorand, linux-nfc, Samuel Ortiz,
linux-wireless, Oleg Zhurakivskyy
In-Reply-To: <20190513104358.59716-1-andriy.shevchenko@linux.intel.com>
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.
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox