diff options
author | Michael Thalmeier <michael.thalmeier@hale.at> | 2016-03-25 15:46:54 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-04-09 23:53:20 +0200 |
commit | dd7bedcd2673e4c8957d15d7e6e649fc6fa40206 (patch) | |
tree | dbe51f2048ed438bf00b95e068ba8601bc05265f /drivers/nfc/pn533/pn533.c | |
parent | 9815c7cf22daceabfb919ddcd6f2c80e049c1fbc (diff) | |
download | kernel_replicant_linux-dd7bedcd2673e4c8957d15d7e6e649fc6fa40206.tar.gz kernel_replicant_linux-dd7bedcd2673e4c8957d15d7e6e649fc6fa40206.tar.bz2 kernel_replicant_linux-dd7bedcd2673e4c8957d15d7e6e649fc6fa40206.zip |
NFC: pn533: add I2C phy driver
This adds the I2C phy interface for the pn533 driver.
This way the driver can be used to interact with I2C
connected pn532 devices.
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533/pn533.c')
-rw-r--r-- | drivers/nfc/pn533/pn533.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/nfc/pn533/pn533.c b/drivers/nfc/pn533/pn533.c index 52d83fec5add..ee9e8f1195fa 100644 --- a/drivers/nfc/pn533/pn533.c +++ b/drivers/nfc/pn533/pn533.c @@ -2427,8 +2427,37 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf) return rc; } +static int pn532_sam_configuration(struct nfc_dev *nfc_dev) +{ + struct pn533 *dev = nfc_get_drvdata(nfc_dev); + struct sk_buff *skb; + struct sk_buff *resp; + + skb = pn533_alloc_skb(dev, 1); + if (!skb) + return -ENOMEM; + + *skb_put(skb, 1) = 0x01; + + resp = pn533_send_cmd_sync(dev, PN533_CMD_SAM_CONFIGURATION, skb); + if (IS_ERR(resp)) + return PTR_ERR(resp); + + dev_kfree_skb(resp); + return 0; +} + static int pn533_dev_up(struct nfc_dev *nfc_dev) { + struct pn533 *dev = nfc_get_drvdata(nfc_dev); + + if (dev->device_type == PN533_DEVICE_PN532) { + int rc = pn532_sam_configuration(nfc_dev); + + if (rc) + return rc; + } + return pn533_rf_field(nfc_dev, 1); } @@ -2461,6 +2490,7 @@ static int pn533_setup(struct pn533 *dev) case PN533_DEVICE_STD: case PN533_DEVICE_PASORI: case PN533_DEVICE_ACR122U: + case PN533_DEVICE_PN532: max_retries.mx_rty_atr = 0x2; max_retries.mx_rty_psl = 0x1; max_retries.mx_rty_passive_act = @@ -2496,6 +2526,7 @@ static int pn533_setup(struct pn533 *dev) switch (dev->device_type) { case PN533_DEVICE_STD: + case PN533_DEVICE_PN532: break; case PN533_DEVICE_PASORI: |