···11Kernel driver for the NXP Semiconductors PN544 Near Field22Communication chip3344-Author: Jari Vanhala55-Contact: Matti Aaltonen (matti.j.aaltonen at nokia.com)66-74General85-------96107The PN544 is an integrated transmission module for contactless118communication. The driver goes under drives/nfc/ and is compiled as a1212-module named "pn544". It registers a misc device and creates a device1313-file named "/dev/pn544".99+module named "pn544".14101511Host Interfaces: I2C, SPI and HSU, this driver supports currently only I2C.1616-1717-The Interface1818--------------1919-2020-The driver offers a sysfs interface for a hardware test and an IOCTL2121-interface for selecting between two operating modes. There are read,2222-write and poll functions for transferring messages. The two operating2323-modes are the normal (HCI) mode and the firmware update mode.2424-2525-PN544 is controlled by sending messages from the userspace to the2626-chip. The main function of the driver is just to pass those messages2727-without caring about the message content.2828-29123013Protocols3114---------···30473148For the ETSI HCI specification see3249http://www.etsi.org/WebSite/Technologies/ProtocolSpecification.aspx3333-3434-The Hardware Test3535------------------3636-3737-The idea of the test is that it can performed by reading from the3838-corresponding sysfs file. The test is implemented in the board file3939-and it should test that PN544 can be put into the firmware update4040-mode. If the test is not implemented the sysfs file does not get4141-created.4242-4343-Example:4444-> cat /sys/module/pn544/drivers/i2c\:pn544/3-002b/nfc_test4545-14646-4747-Normal Operation4848-----------------4949-5050-PN544 is powered up when the device file is opened, otherwise it's5151-turned off. Only one instance can use the device at a time.5252-5353-Userspace applications control PN544 with HCI messages. The hardware5454-sends an interrupt when data is available for reading. Data is5555-physically read when the read function is called by a userspace5656-application. Poll() checks the read interrupt state. Configuration and5757-self testing are also done from the userspace using read and write.5858-5959-Example platform data:6060-6161-static int rx71_pn544_nfc_request_resources(struct i2c_client *client)6262-{6363- /* Get and setup the HW resources for the device */6464-}6565-6666-static void rx71_pn544_nfc_free_resources(void)6767-{6868- /* Release the HW resources */6969-}7070-7171-static void rx71_pn544_nfc_enable(int fw)7272-{7373- /* Turn the device on */7474-}7575-7676-static int rx71_pn544_nfc_test(void)7777-{7878- /*7979- * Put the device into the FW update mode8080- * and then back to the normal mode.8181- * Check the behavior and return one on success,8282- * zero on failure.8383- */8484-}8585-8686-static void rx71_pn544_nfc_disable(void)8787-{8888- /* turn the power off */8989-}9090-9191-static struct pn544_nfc_platform_data rx71_nfc_data = {9292- .request_resources = rx71_pn544_nfc_request_resources,9393- .free_resources = rx71_pn544_nfc_free_resources,9494- .enable = rx71_pn544_nfc_enable,9595- .test = rx71_pn544_nfc_test,9696- .disable = rx71_pn544_nfc_disable,9797-};