summaryrefslogtreecommitdiffstats
path: root/drivers/nfc
Commit message (Collapse)AuthorAgeFilesLines
* NFC: pn544: Add MEI physical layerSamuel Ortiz2013-04-163-1/+135
| | | | | | | With the new mei_phy NFC driver API, the pn544 MEI physical layer is minimal and similar to the microread one. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: mei: Add a common mei bus API for NFC driversEric Lapuyade2013-04-166-131/+215
| | | | | | | | | | This isolates the common code that is required to use an mei bus nfc device from an NFC HCI drivers. This prepares for future drivers for NFC chips connected behind an Intel Management Engine controller. The microread_mei HCI driver is also modified to use that common code. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Turn radio on and off when bringing the device up and downSamuel Ortiz2013-04-111-4/+35
| | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Add missing usb_put_devMarina Makienko2013-04-111-0/+1
| | | | | | | | | Add missing usb_put_dev on failure path in pn533_probe(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Marina Makienko <makienko@ispras.ru> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Increase version numberWaldemar Rymarkiewicz2013-04-111-1/+1
| | | | | | | | | | Major features added in 0.2 version: * frame ops added to support wider set of devices * support of ACS ACR122U Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Remove unused pn533_cmd_complete_tWaldemar Rymarkiewicz2013-04-111-2/+0
| | | | | Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Add pn533_abort_cmd procedureWaldemar Rymarkiewicz2013-04-111-14/+21
| | | | | | | | | | | | pn533_abort_cmd() aborts last command sent to the controller and cancels already requested urb. As ACR122U does not support any mechanism (as ACK for standard PN533) which aborts last command this cannot be issued for this device. Otherwise, acr122u will behave in an unstable way. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Add support for ACS ACR122U readerWaldemar Rymarkiewicz2013-04-111-2/+217
| | | | | | | | | | | | | | | | | | | | | | | | ACS ACR122U is an USB NFC reader, PC/SC and CCID compilant, based on NXP PN532 chip. Internally, it's build of MCU, PN532 and an antenna. MCU makes the device CCID and PC/SC compilant and provide USB connection. In this achitecture, a host cannot talk directly to PN532 and must rely on MCU. Luckily, MCU exposes pseud-APDU through PC/SC Escape mechanism which let the host to transmit standard PN532 commands directly to PN532 chip with some limitations. The frame roughly looks like: CCID header | APDU header | PN532 header (pc_to_rdr_escape) | (pseudo apdu Direct Tramsmit) | (len, TFI, cmd, params) Accordign to limitations, ACR122U does't provide any mechanism to abort last issued command. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Add protocol type for frame opsWaldemar Rymarkiewicz2013-04-111-3/+18
| | | | | | | | | | As not all devices require ACK confirmation of every request sent to the controller, differentiate two protocol types. First one, request-ack-response and the second one request-response type. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Move wq_in_error to cmd contextWaldemar Rymarkiewicz2013-04-111-12/+12
| | | | | | | | Rename 'wq_in_error' field to more relevant 'status' and move it to cmd context struct. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Re-group fields in struct pn533Waldemar Rymarkiewicz2013-04-111-9/+8
| | | | | Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Avoid function declarationsWaldemar Rymarkiewicz2013-04-111-12/+10
| | | | | | | Reorder code to avoid functions declaration. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Simplify __pn533_send_frame_asyncWaldemar Rymarkiewicz2013-04-111-17/+9
| | | | | | | | | | | | | | | | In all cases (send_cmd_async, send_data_async and send_sync) pn533_send_async_complete() handles all responses internally, so there is no need to pass this as a callback. Cmd context is passed to __pn533_send_frame_async in all the cases as well. It's already kept in struct pn533 which is available all the time the device is attached. So we can make use of it instead. Therefore, cmd_complete and cmd_complete_arg are no needed any more. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Fix incorrect kfree of complete argsWaldemar Rymarkiewicz2013-04-111-1/+1
| | | | | | | | We must free 'cmd_complete_mi_arg' and not 'cmd_complete_arg' when getting send error handling fragmented response. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Remove redundant cmd_ prefix in the structWaldemar Rymarkiewicz2013-04-111-4/+4
| | | | | | | 'cmd->code' looks better then 'cmd->cmd_code' Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Keep cmd context in pn533 structWaldemar Rymarkiewicz2013-04-111-5/+12
| | | | | | | | Keep cmd context in pn533 struct instead of only cmd code. The context already includes cmd_code. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Optimise issued cmd context trackingWaldemar Rymarkiewicz2013-04-111-52/+35
| | | | | | | | | | | Use struct pn533_cmd instead of pn533_send_async_complete_arg to track the context of the issued cmd. This way pn533_send_async_complete_arg struct is no needed anymore. Just move issuer complete callback to pn533_cmd struct. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Fix memleak while scheduling next cmdWaldemar Rymarkiewicz2013-04-111-2/+8
| | | | | | | | | In case of error from __pn533_send_frame_async() while sending next cmd from the queue (cmd_wq), cmd->req, cmd->resp and cmd->arg pointers won't be freed. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Rename pn533_fw_reset appropriatelyWaldemar Rymarkiewicz2013-04-111-3/+3
| | | | | | | Define explicitely it is Pasori specific reset command. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Update copyrights noteWaldemar Rymarkiewicz2013-04-111-6/+4
| | | | | | | Remove duplicated authors info from the header as well. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Fix div by zero while stopping pollingWaldemar Rymarkiewicz2013-04-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depends on timing division by zero can happen when user stops polling. pn533_stop_poll() resets modulation counter on stop_poll, but meanwhile we get response for last poll request and try, despite of stop poll request, to schedule next modulation for polling. Log message: [345.922515] pn533 1-1.3:1.0: pn533_stop_poll [345.928314] pn533 1-1.3:1.0: pn533_send_ack [345.932769] pn533 1-1.3:1.0: Received a frame. [345.937438] PN533 RX: 00 00 ff 03 fd d5 4b 00 e0 00 [345.942840] pn533 1-1.3:1.0: pn533_poll_complete [345.947753] pn533 1-1.3:1.0: pn533_start_poll_complete [345.953186] Division by zero in kernel. [345.957244] [<c001b38c>] (unwind_backtrace+0x0/0xf0) [345.965698] [<c0260e78>] (Ldiv0+0x8/0x10) [345.974060] [<c0260e60>] (__aeabi_idivmod+0x8/0x18) [345.983978] [<c02e0064>] (pn533_poll_complete+0x3c0/0x500) [345.994903] [<c02df690>] (pn533_send_async_complete+0x7c/0xc0) [346.005828] [<c02e028c>] (pn533_wq_cmd_complete+0x1c/0x34) [346.016113] [<c005d134>] (process_one_work+0x1ac/0x57c) [346.025848] [<c005d85c>] (worker_thread+0x168/0x42c) [346.034576] [<c00620c0>] (kthread+0xa4/0xb0) Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Print out response status bits in hexWaldemar Rymarkiewicz2013-04-111-3/+4
| | | | | | | For better debugging as the codes are defined in hex in the spec. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Reword all std frame logic functWaldemar Rymarkiewicz2013-04-111-60/+61
| | | | | Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: pn533: Use dynamic debug for pn533 hex dumpsSamuel Ortiz2013-04-111-4/+4
| | | | | | Those can be very verbose and we only want them when debugging pn533. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* NFC: microread: Fix build failure due to a new MEI bus APISamuel Ortiz2013-04-011-21/+17
| | | | | | uuid device_id field is removed and mei_device is renamed mei_cl_device. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* Merge branch 'master' of ↵John W. Linville2013-02-189-5/+1397
|\ | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: drivers/net/wireless/iwlwifi/dvm/tx.c drivers/net/wireless/ti/wlcore/sdio.c drivers/net/wireless/ti/wlcore/spi.c
| * NFC: microread: Fix mei physical layerSamuel Ortiz2013-02-111-19/+24
| | | | | | | | | | | | | | | | | | | | | | | | The MEI bus API changed according to the latest comments from the char-misc maintainers, and this patch fixes the microread mei physical layer code according to those changes: We pass the MEI id back to the probe routine, and the mei_driver takes a table of MEI ids instead of one static id. Also, mei_bus_driver got renamed to mei_driver, mei_bus_client to mei_device, and mei_bus_set/get_clientdata to mei_set/get_clientdata. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Fix target polling modeThierry Escande2013-02-081-1/+1
| | | | | | | | | | | | | | Remove unneeded bitwise OR operator on uninitialized sk_buff data Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: microread: Add MEI physical layerSamuel Ortiz2013-02-083-0/+254
| | | | | | | | | | | | | | On some peculiar worlds, microreads are found hidden behind MEIs and needs to be accessed through the ME bus. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: microread: Add i2c physical layerSamuel Ortiz2013-02-033-0/+354
| | | | | | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Initial support for Inside Secure microreadEric Lapuyade2013-02-036-0/+781
| | | | | | | | | | | | | | | | Inside Secure microread is an HCI based NFC chipset. This initial support includes reader and p2p (Target and initiator) modes. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * nfc: pn533: Remove unreachable codeWaldemar Rymarkiewicz2013-01-291-2/+0
| | | | | | | | | | Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * nfc: pn533: Use static poll_mod and std_frame_opsWaldemar Rymarkiewicz2013-01-291-2/+2
| | | | | | | | | | | | | | These variables are not exported. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* | Merge branch 'master' of ↵John W. Linville2013-01-288-840/+917
|\| | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
| * NFC: pn533: Fix bad allocation sizeThierry Escande2013-01-131-2/+2
| | | | | | | | | | | | | | Use dereferenced pointer in sizeof instead of pointer itself. Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Fix missing parenthesisWaldemar Rymarkiewicz2013-01-101-1/+2
| | | | | | | | | | | | | | | | | | This is a quite critical patch as it fixes potential reference to undefined general_bytes which were never set correctly on target activation due to missing parenthesis. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Initial Secure Element APISamuel Ortiz2013-01-103-2/+6
| | | | | | | | | | | | | | | | | | | | Each NFC adapter can have several links to different secure elements and that property needs to be exported by the drivers. A secure element link can be enabled and disabled, and card emulation will be handled by the currently active one. Otherwise card emulation will be host implemented. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn544: Use devm_kzalloc APISamuel Ortiz2013-01-101-14/+6
| | | | | | | | Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn544: Use module_i2c_driverSamuel Ortiz2013-01-101-23/+1
| | | | | | | | | | | | The pn544 init routine does nothing but adding the driver to the i2c bus. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn544: Separate the core code and the i2c one into different modulesSamuel Ortiz2013-01-105-16/+35
| | | | | | | | | | | | | | As we may need to support other physical layers, we can avoid linking the core part into each and every pn544 module. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Add HCI quirks to support driver (non)standard implementationsEric Lapuyade2013-01-101-1/+1
| | | | | | | | | | | | | | | | | | Some chips diverge from the HCI spec in their implementation of standard features. This adds a new quirks parameter to nfc_hci_allocate_device() to let the driver indicate its divergence. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Fixed skb leak in tm_send() nfc and hci ops implementationsEric Lapuyade2013-01-101-2/+8
| | | | | | | | | | Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Changed event_received hci ops result semanticEric Lapuyade2013-01-101-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Some chips use a standard HCI event code, destined to a proprietary gate, with a different meaning. Therefore, the HCI driver must always have a chance to intercept the event before standard processing is attempted. The new semantic specifies that the result value "1" means that the driver doesn't especially handle the event. result <= 0 means it was handled. Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: Added error handling in event_received hci opsEric Lapuyade2013-01-101-14/+13
| | | | | | | | | | | | There is no use to return an error if the caller doesn't get it. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: nfcwilink: Use devm_kzallocJulia Lawall2013-01-101-7/+2
| | | | | | | | | | | | | | | | | | devm_kzalloc allocates memory that is released when a driver detaches. This patch uses devm_kzalloc for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Introduce ops for frame logicWaldemar Rymarkiewicz2013-01-101-73/+135
| | | | | | | | | | | | | | | | | | Encapsulate whole frame logic (tx/rx frame structure and size) inside the ops structure to make the core driver generic for devices which handle frames in non standard menner (different then pn533 spec say). Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Remove unused dev->wq_in_frameWaldemar Rymarkiewicz2013-01-101-5/+0
| | | | | | | | | | Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Cleanup pn533_cmd_complete_tWaldemar Rymarkiewicz2013-01-101-22/+7
| | | | | | | | | | | | | | | | | | | | | | 'params' arg in pn533_cmd_complete_t definition has been deprecated and currently is not in use (resp skb is pass in arg ptr), so remove it. Also 'params_len' arg is used as a transfer status indicator, so simply reword it appropriately. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Remove deprecated dev->out_frame buffWaldemar Rymarkiewicz2013-01-101-6/+1
| | | | | | | | | | | | | | As it's not used anymore get rid of that buffer. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| * NFC: pn533: Use skb in __pn533_send_cmd_frame_asynWaldemar Rymarkiewicz2013-01-101-26/+18
| | | | | | | | | | | | | | | | __pn533_send_cmd_frame_async() should be frame type independent. So, don't use pn533_frame type params and instead use skb for req and resp pointers. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>