diff options
| -rw-r--r-- | drivers/nfc/pn544/i2c.c | 2 | ||||
| -rw-r--r-- | drivers/nfc/pn544/mei.c | 2 | ||||
| -rw-r--r-- | drivers/nfc/pn544/pn544.c | 17 | ||||
| -rw-r--r-- | drivers/nfc/pn544/pn544.h | 4 |
4 files changed, 21 insertions, 4 deletions
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index e09c8982596c..017dc61effc8 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c | |||
| @@ -428,7 +428,7 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, | |||
| 428 | 428 | ||
| 429 | r = pn544_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, | 429 | r = pn544_hci_probe(phy, &i2c_phy_ops, LLC_SHDLC_NAME, |
| 430 | PN544_I2C_FRAME_HEADROOM, PN544_I2C_FRAME_TAILROOM, | 430 | PN544_I2C_FRAME_HEADROOM, PN544_I2C_FRAME_TAILROOM, |
| 431 | PN544_HCI_I2C_LLC_MAX_PAYLOAD, &phy->hdev); | 431 | PN544_HCI_I2C_LLC_MAX_PAYLOAD, NULL, &phy->hdev); |
| 432 | if (r < 0) | 432 | if (r < 0) |
| 433 | goto err_hci; | 433 | goto err_hci; |
| 434 | 434 | ||
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index b5d3d18179eb..ee67de50c36f 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c | |||
| @@ -45,7 +45,7 @@ static int pn544_mei_probe(struct mei_cl_device *device, | |||
| 45 | 45 | ||
| 46 | r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, | 46 | r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME, |
| 47 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, | 47 | MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD, |
| 48 | &phy->hdev); | 48 | NULL, &phy->hdev); |
| 49 | if (r < 0) { | 49 | if (r < 0) { |
| 50 | nfc_mei_phy_free(phy); | 50 | nfc_mei_phy_free(phy); |
| 51 | 51 | ||
diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c index 1d4b38c036fb..078e62feba17 100644 --- a/drivers/nfc/pn544/pn544.c +++ b/drivers/nfc/pn544/pn544.c | |||
| @@ -127,6 +127,8 @@ struct pn544_hci_info { | |||
| 127 | int async_cb_type; | 127 | int async_cb_type; |
| 128 | data_exchange_cb_t async_cb; | 128 | data_exchange_cb_t async_cb; |
| 129 | void *async_cb_context; | 129 | void *async_cb_context; |
| 130 | |||
| 131 | fw_download_t fw_download; | ||
| 130 | }; | 132 | }; |
| 131 | 133 | ||
| 132 | static int pn544_hci_open(struct nfc_hci_dev *hdev) | 134 | static int pn544_hci_open(struct nfc_hci_dev *hdev) |
| @@ -779,6 +781,17 @@ exit: | |||
| 779 | return r; | 781 | return r; |
| 780 | } | 782 | } |
| 781 | 783 | ||
| 784 | static 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 | |||
| 782 | static struct nfc_hci_ops pn544_hci_ops = { | 795 | static struct nfc_hci_ops pn544_hci_ops = { |
| 783 | .open = pn544_hci_open, | 796 | .open = pn544_hci_open, |
| 784 | .close = pn544_hci_close, | 797 | .close = pn544_hci_close, |
| @@ -793,11 +806,12 @@ static struct nfc_hci_ops pn544_hci_ops = { | |||
| 793 | .tm_send = pn544_hci_tm_send, | 806 | .tm_send = pn544_hci_tm_send, |
| 794 | .check_presence = pn544_hci_check_presence, | 807 | .check_presence = pn544_hci_check_presence, |
| 795 | .event_received = pn544_hci_event_received, | 808 | .event_received = pn544_hci_event_received, |
| 809 | .fw_download = pn544_hci_fw_download, | ||
| 796 | }; | 810 | }; |
| 797 | 811 | ||
| 798 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, | 812 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, |
| 799 | int phy_headroom, int phy_tailroom, int phy_payload, | 813 | int phy_headroom, int phy_tailroom, int phy_payload, |
| 800 | struct nfc_hci_dev **hdev) | 814 | fw_download_t fw_download, struct nfc_hci_dev **hdev) |
| 801 | { | 815 | { |
| 802 | struct pn544_hci_info *info; | 816 | struct pn544_hci_info *info; |
| 803 | u32 protocols; | 817 | u32 protocols; |
| @@ -813,6 +827,7 @@ int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, | |||
| 813 | 827 | ||
| 814 | info->phy_ops = phy_ops; | 828 | info->phy_ops = phy_ops; |
| 815 | info->phy_id = phy_id; | 829 | info->phy_id = phy_id; |
| 830 | info->fw_download = fw_download; | ||
| 816 | info->state = PN544_ST_COLD; | 831 | info->state = PN544_ST_COLD; |
| 817 | mutex_init(&info->info_lock); | 832 | mutex_init(&info->info_lock); |
| 818 | 833 | ||
diff --git a/drivers/nfc/pn544/pn544.h b/drivers/nfc/pn544/pn544.h index d689f0ac64aa..01020e585443 100644 --- a/drivers/nfc/pn544/pn544.h +++ b/drivers/nfc/pn544/pn544.h | |||
| @@ -27,9 +27,11 @@ | |||
| 27 | #define PN544_HCI_MODE 0 | 27 | #define PN544_HCI_MODE 0 |
| 28 | #define PN544_FW_MODE 1 | 28 | #define PN544_FW_MODE 1 |
| 29 | 29 | ||
| 30 | typedef int (*fw_download_t)(void *context, const char *firmware_name); | ||
| 31 | |||
| 30 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, | 32 | int pn544_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, char *llc_name, |
| 31 | int phy_headroom, int phy_tailroom, int phy_payload, | 33 | int phy_headroom, int phy_tailroom, int phy_payload, |
| 32 | struct nfc_hci_dev **hdev); | 34 | fw_download_t fw_download, struct nfc_hci_dev **hdev); |
| 33 | void pn544_hci_remove(struct nfc_hci_dev *hdev); | 35 | void pn544_hci_remove(struct nfc_hci_dev *hdev); |
| 34 | 36 | ||
| 35 | #endif /* __LOCAL_PN544_H_ */ | 37 | #endif /* __LOCAL_PN544_H_ */ |
