Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem

This commit is contained in:
John W. Linville 2013-01-28 14:43:00 -05:00
commit 4205e6ef4e
210 changed files with 7702 additions and 4987 deletions

View file

@ -5,19 +5,6 @@
menu "Near Field Communication (NFC) devices"
depends on NFC
config PN544_HCI_NFC
tristate "HCI PN544 NFC driver"
depends on I2C && NFC_HCI && NFC_SHDLC
select CRC_CCITT
default n
---help---
NXP PN544 i2c driver.
This is a driver based on the SHDLC and HCI NFC kernel layers and
will thus not work with NXP libnfc library.
To compile this driver as a module, choose m here. The module will
be called pn544_hci.
config NFC_PN533
tristate "NXP PN533 USB driver"
depends on USB
@ -39,4 +26,6 @@ config NFC_WILINK
Say Y here to compile support for Texas Instrument's NFC WiLink driver
into the kernel or say M to compile it as module.
source "drivers/nfc/pn544/Kconfig"
endmenu

View file

@ -2,7 +2,7 @@
# Makefile for nfc devices
#
obj-$(CONFIG_PN544_HCI_NFC) += pn544/
obj-$(CONFIG_NFC_PN544) += pn544/
obj-$(CONFIG_NFC_PN533) += pn533.o
obj-$(CONFIG_NFC_WILINK) += nfcwilink.o

View file

@ -526,7 +526,7 @@ static int nfcwilink_probe(struct platform_device *pdev)
nfc_dev_dbg(&pdev->dev, "probe entry");
drv = kzalloc(sizeof(struct nfcwilink), GFP_KERNEL);
drv = devm_kzalloc(&pdev->dev, sizeof(struct nfcwilink), GFP_KERNEL);
if (!drv) {
rc = -ENOMEM;
goto exit;
@ -542,12 +542,13 @@ static int nfcwilink_probe(struct platform_device *pdev)
drv->ndev = nci_allocate_device(&nfcwilink_ops,
protocols,
NFC_SE_NONE,
NFCWILINK_HDR_LEN,
0);
if (!drv->ndev) {
nfc_dev_err(&pdev->dev, "nci_allocate_device failed");
rc = -ENOMEM;
goto free_exit;
goto exit;
}
nci_set_parent_dev(drv->ndev, &pdev->dev);
@ -566,9 +567,6 @@ static int nfcwilink_probe(struct platform_device *pdev)
free_dev_exit:
nci_free_device(drv->ndev);
free_exit:
kfree(drv);
exit:
return rc;
}
@ -588,8 +586,6 @@ static int nfcwilink_remove(struct platform_device *pdev)
nci_unregister_device(ndev);
nci_free_device(ndev);
kfree(drv);
dev_set_drvdata(&pdev->dev, NULL);
return 0;

File diff suppressed because it is too large Load diff

23
drivers/nfc/pn544/Kconfig Normal file
View file

@ -0,0 +1,23 @@
config NFC_PN544
tristate "NXP PN544 NFC driver"
depends on NFC_HCI
select CRC_CCITT
default n
---help---
NXP PN544 core driver.
This is a driver based on the HCI NFC kernel layers and
will thus not work with NXP libnfc library.
To compile this driver as a module, choose m here. The module will
be called pn544.
Say N if unsure.
config NFC_PN544_I2C
tristate "NFC PN544 i2c support"
depends on NFC_PN544 && I2C && NFC_SHDLC
---help---
This module adds support for the NXP pn544 i2c interface.
Select this if your platform is using the i2c bus.
If you choose to build a module, it'll be called pn544_i2c.
Say N if unsure.

View file

@ -2,6 +2,7 @@
# Makefile for PN544 HCI based NFC driver
#
obj-$(CONFIG_PN544_HCI_NFC) += pn544_i2c.o
pn544_i2c-objs = i2c.o
pn544_i2c-y := pn544.o i2c.o
obj-$(CONFIG_NFC_PN544) += pn544.o
obj-$(CONFIG_NFC_PN544_I2C) += pn544_i2c.o

View file

@ -376,12 +376,12 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
return -ENODEV;
}
phy = kzalloc(sizeof(struct pn544_i2c_phy), GFP_KERNEL);
phy = devm_kzalloc(&client->dev, sizeof(struct pn544_i2c_phy),
GFP_KERNEL);
if (!phy) {
dev_err(&client->dev,
"Cannot allocate memory for pn544 i2c phy.\n");
r = -ENOMEM;
goto err_phy_alloc;
return -ENOMEM;
}
phy->i2c_dev = client;
@ -390,20 +390,18 @@ static int pn544_hci_i2c_probe(struct i2c_client *client,
pdata = client->dev.platform_data;
if (pdata == NULL) {
dev_err(&client->dev, "No platform data\n");
r = -EINVAL;
goto err_pdata;
return -EINVAL;
}
if (pdata->request_resources == NULL) {
dev_err(&client->dev, "request_resources() missing\n");
r = -EINVAL;
goto err_pdata;
return -EINVAL;
}
r = pdata->request_resources(client);
if (r) {
dev_err(&client->dev, "Cannot get platform resources\n");
goto err_pdata;
return r;
}
phy->gpio_en = pdata->get_gpio(NFC_GPIO_ENABLE);
@ -435,10 +433,6 @@ err_rti:
if (pdata->free_resources != NULL)
pdata->free_resources();
err_pdata:
kfree(phy);
err_phy_alloc:
return r;
}
@ -458,8 +452,6 @@ static int pn544_hci_i2c_remove(struct i2c_client *client)
if (pdata->free_resources)
pdata->free_resources();
kfree(phy);
return 0;
}
@ -472,29 +464,7 @@ static struct i2c_driver pn544_hci_i2c_driver = {
.remove = pn544_hci_i2c_remove,
};
static int __init pn544_hci_i2c_init(void)
{
int r;
pr_debug(DRIVER_DESC ": %s\n", __func__);
r = i2c_add_driver(&pn544_hci_i2c_driver);
if (r) {
pr_err(PN544_HCI_I2C_DRIVER_NAME
": driver registration failed\n");
return r;
}
return 0;
}
static void __exit pn544_hci_i2c_exit(void)
{
i2c_del_driver(&pn544_hci_i2c_driver);
}
module_init(pn544_hci_i2c_init);
module_exit(pn544_hci_i2c_exit);
module_i2c_driver(pn544_hci_i2c_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(DRIVER_DESC);

View file

@ -20,6 +20,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/nfc.h>
#include <net/nfc/hci.h>
@ -675,11 +676,17 @@ static int pn544_hci_im_transceive(struct nfc_hci_dev *hdev,
static int pn544_hci_tm_send(struct nfc_hci_dev *hdev, struct sk_buff *skb)
{
int r;
/* Set default false for multiple information chaining */
*skb_push(skb, 1) = 0;
return nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE,
PN544_HCI_EVT_SND_DATA, skb->data, skb->len);
r = nfc_hci_send_event(hdev, PN544_RF_READER_NFCIP1_TARGET_GATE,
PN544_HCI_EVT_SND_DATA, skb->data, skb->len);
kfree_skb(skb);
return r;
}
static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
@ -714,35 +721,40 @@ static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
return 0;
}
static void pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate,
u8 event, struct sk_buff *skb)
/*
* Returns:
* <= 0: driver handled the event, skb consumed
* 1: driver does not handle the event, please do standard processing
*/
static int pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate, u8 event,
struct sk_buff *skb)
{
struct sk_buff *rgb_skb = NULL;
int r = 0;
int r;
pr_debug("hci event %d", event);
switch (event) {
case PN544_HCI_EVT_ACTIVATED:
if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE)
nfc_hci_target_discovered(hdev, gate);
else if (gate == PN544_RF_READER_NFCIP1_TARGET_GATE) {
if (gate == PN544_RF_READER_NFCIP1_INITIATOR_GATE) {
r = nfc_hci_target_discovered(hdev, gate);
} else if (gate == PN544_RF_READER_NFCIP1_TARGET_GATE) {
r = nfc_hci_get_param(hdev, gate, PN544_DEP_ATR_REQ,
&rgb_skb);
&rgb_skb);
if (r < 0)
goto exit;
nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK,
NFC_COMM_PASSIVE, rgb_skb->data,
rgb_skb->len);
r = nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK,
NFC_COMM_PASSIVE, rgb_skb->data,
rgb_skb->len);
kfree_skb(rgb_skb);
} else {
r = -EINVAL;
}
break;
case PN544_HCI_EVT_DEACTIVATED:
nfc_hci_send_event(hdev, gate,
NFC_HCI_EVT_END_OPERATION, NULL, 0);
r = nfc_hci_send_event(hdev, gate, NFC_HCI_EVT_END_OPERATION,
NULL, 0);
break;
case PN544_HCI_EVT_RCV_DATA:
if (skb->len < 2) {
@ -757,15 +769,15 @@ static void pn544_hci_event_received(struct nfc_hci_dev *hdev, u8 gate,
}
skb_pull(skb, 2);
nfc_tm_data_received(hdev->ndev, skb);
return;
return nfc_tm_data_received(hdev->ndev, skb);
default:
break;
return 1;
}
exit:
kfree_skb(skb);
return r;
}
static struct nfc_hci_ops pn544_hci_ops = {
@ -789,7 +801,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
struct nfc_hci_dev **hdev)
{
struct pn544_hci_info *info;
u32 protocols;
u32 protocols, se;
struct nfc_hci_init_data init_data;
int r;
@ -822,8 +834,10 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
NFC_PROTO_ISO14443_B_MASK |
NFC_PROTO_NFC_DEP_MASK;
info->hdev = nfc_hci_allocate_device(&pn544_hci_ops, &init_data,
protocols, llc_name,
se = NFC_SE_UICC | NFC_SE_EMBEDDED;
info->hdev = nfc_hci_allocate_device(&pn544_hci_ops, &init_data, 0,
protocols, se, llc_name,
phy_headroom + PN544_CMDS_HEADROOM,
phy_tailroom, phy_payload);
if (!info->hdev) {
@ -851,6 +865,7 @@ err_alloc_hdev:
err_info_alloc:
return r;
}
EXPORT_SYMBOL(pn544_hci_probe);
void pn544_hci_remove(struct nfc_hci_dev *hdev)
{
@ -860,3 +875,7 @@ void pn544_hci_remove(struct nfc_hci_dev *hdev)
nfc_hci_free_device(hdev);
kfree(info);
}
EXPORT_SYMBOL(pn544_hci_remove);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(DRIVER_DESC);