aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn544/pn544.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nfc/pn544/pn544.c')
-rw-r--r--drivers/nfc/pn544/pn544.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c
index 0d17da7675b7..078e62feba17 100644
--- a/drivers/nfc/pn544/pn544.c
+++ b/drivers/nfc/pn544/pn544.c
@@ -31,9 +31,6 @@
31/* Timing restrictions (ms) */ 31/* Timing restrictions (ms) */
32#define PN544_HCI_RESETVEN_TIME 30 32#define PN544_HCI_RESETVEN_TIME 30
33 33
34#define HCI_MODE 0
35#define FW_MODE 1
36
37enum pn544_state { 34enum pn544_state {
38 PN544_ST_COLD, 35 PN544_ST_COLD,
39 PN544_ST_FW_READY, 36 PN544_ST_FW_READY,
@@ -130,6 +127,8 @@ struct pn544_hci_info {
130 int async_cb_type; 127 int async_cb_type;
131 data_exchange_cb_t async_cb; 128 data_exchange_cb_t async_cb;
132 void *async_cb_context; 129 void *async_cb_context;
130
131 fw_download_t fw_download;
133}; 132};
134 133
135static int pn544_hci_open(struct nfc_hci_dev *hdev) 134static int pn544_hci_open(struct nfc_hci_dev *hdev)
@@ -782,6 +781,17 @@ exit:
782 return r; 781 return r;
783} 782}
784 783
784static int pn544_hci_fw_download(struct nfc_hci_dev *hdev,
785 const char *firmware_name)
786{
787 struct pn544_hci_info *info = nfc_hci_get_clientdata(hdev);
788
789 if (info->fw_download == NULL)
790 return -ENOTSUPP;
791
792 return info->fw_download(info->phy_id, firmware_name);
793}
794
785static struct nfc_hci_ops pn544_hci_ops = { 795static struct nfc_hci_ops pn544_hci_ops = {
786 .open = pn544_hci_open, 796 .open = pn544_hci_open,
787 .close = pn544_hci_close, 797 .close = pn544_hci_close,
@@ -796,11 +806,12 @@ static struct nfc_hci_ops pn544_hci_ops = {
796 .tm_send = pn544_hci_tm_send, 806 .tm_send = pn544_hci_tm_send,
797 .check_presence = pn544_hci_check_presence, 807 .check_presence = pn544_hci_check_presence,
798 .event_received = pn544_hci_event_received, 808 .event_received = pn544_hci_event_received,
809 .fw_download = pn544_hci_fw_download,
799}; 810};
800 811
801int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, 812int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
802 int phy_headroom, int phy_tailroom, int phy_payload, 813 int phy_headroom, int phy_tailroom, int phy_payload,
803 struct nfc_hci_dev **hdev) 814 fw_download_t fw_download, struct nfc_hci_dev **hdev)
804{ 815{
805 struct pn544_hci_info *info; 816 struct pn544_hci_info *info;
806 u32 protocols; 817 u32 protocols;
@@ -816,6 +827,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name,
816 827
817 info->phy_ops = phy_ops; 828 info->phy_ops = phy_ops;
818 info->phy_id = phy_id; 829 info->phy_id = phy_id;
830 info->fw_download = fw_download;
819 info->state = PN544_ST_COLD; 831 info->state = PN544_ST_COLD;
820 mutex_init(&info->info_lock); 832 mutex_init(&info->info_lock);
821 833