diff options
-rw-r--r-- | Documentation/devicetree/bindings/net/nfc/st-nci.txt (renamed from Documentation/devicetree/bindings/net/nfc/st21nfcb.txt) | 4 | ||||
-rw-r--r-- | drivers/nfc/Kconfig | 2 | ||||
-rw-r--r-- | drivers/nfc/Makefile | 2 | ||||
-rw-r--r-- | drivers/nfc/st-nci/Kconfig | 23 | ||||
-rw-r--r-- | drivers/nfc/st-nci/Makefile | 9 | ||||
-rw-r--r-- | drivers/nfc/st-nci/core.c | 179 | ||||
-rw-r--r-- | drivers/nfc/st-nci/i2c.c (renamed from drivers/nfc/st21nfcb/i2c.c) | 123 | ||||
-rw-r--r-- | drivers/nfc/st-nci/ndlc.c (renamed from drivers/nfc/st21nfcb/ndlc.c) | 12 | ||||
-rw-r--r-- | drivers/nfc/st-nci/ndlc.h (renamed from drivers/nfc/st21nfcb/ndlc.h) | 4 | ||||
-rw-r--r-- | drivers/nfc/st-nci/st-nci.h (renamed from drivers/nfc/st21nfcb/st21nfcb.h) | 22 | ||||
-rw-r--r-- | drivers/nfc/st-nci/st-nci_se.c (renamed from drivers/nfc/st21nfcb/st21nfcb_se.c) | 383 | ||||
-rw-r--r-- | drivers/nfc/st-nci/st-nci_se.h | 61 | ||||
-rw-r--r-- | drivers/nfc/st21nfcb/Kconfig | 22 | ||||
-rw-r--r-- | drivers/nfc/st21nfcb/Makefile | 9 | ||||
-rw-r--r-- | drivers/nfc/st21nfcb/st21nfcb.c | 179 | ||||
-rw-r--r-- | drivers/nfc/st21nfcb/st21nfcb_se.h | 61 | ||||
-rw-r--r-- | include/linux/platform_data/st-nci.h (renamed from include/linux/platform_data/st21nfcb.h) | 14 | ||||
-rw-r--r-- | include/linux/platform_data/st_nci.h | 29 |
18 files changed, 585 insertions, 553 deletions
diff --git a/Documentation/devicetree/bindings/net/nfc/st21nfcb.txt b/Documentation/devicetree/bindings/net/nfc/st-nci.txt index bb237072dbe9..d707588ed734 100644 --- a/Documentation/devicetree/bindings/net/nfc/st21nfcb.txt +++ b/Documentation/devicetree/bindings/net/nfc/st-nci.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | * STMicroelectronics SAS. ST21NFCB NFC Controller | 1 | * STMicroelectronics SAS. ST NCI NFC Controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: Should be "st,st21nfcb-i2c". | 4 | - compatible: Should be "st,st21nfcb-i2c" or "st,st21nfcc-i2c". |
5 | - clock-frequency: I²C work frequency. | 5 | - clock-frequency: I²C work frequency. |
6 | - reg: address on the bus | 6 | - reg: address on the bus |
7 | - interrupt-parent: phandle for the interrupt gpio controller | 7 | - interrupt-parent: phandle for the interrupt gpio controller |
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig index 107714e4405f..722673cb785b 100644 --- a/drivers/nfc/Kconfig +++ b/drivers/nfc/Kconfig | |||
@@ -72,6 +72,6 @@ source "drivers/nfc/pn544/Kconfig" | |||
72 | source "drivers/nfc/microread/Kconfig" | 72 | source "drivers/nfc/microread/Kconfig" |
73 | source "drivers/nfc/nfcmrvl/Kconfig" | 73 | source "drivers/nfc/nfcmrvl/Kconfig" |
74 | source "drivers/nfc/st21nfca/Kconfig" | 74 | source "drivers/nfc/st21nfca/Kconfig" |
75 | source "drivers/nfc/st21nfcb/Kconfig" | 75 | source "drivers/nfc/st-nci/Kconfig" |
76 | source "drivers/nfc/nxp-nci/Kconfig" | 76 | source "drivers/nfc/nxp-nci/Kconfig" |
77 | endmenu | 77 | endmenu |
diff --git a/drivers/nfc/Makefile b/drivers/nfc/Makefile index 13b648baf175..368b6dfe71b3 100644 --- a/drivers/nfc/Makefile +++ b/drivers/nfc/Makefile | |||
@@ -12,5 +12,5 @@ obj-$(CONFIG_NFC_PORT100) += port100.o | |||
12 | obj-$(CONFIG_NFC_MRVL) += nfcmrvl/ | 12 | obj-$(CONFIG_NFC_MRVL) += nfcmrvl/ |
13 | obj-$(CONFIG_NFC_TRF7970A) += trf7970a.o | 13 | obj-$(CONFIG_NFC_TRF7970A) += trf7970a.o |
14 | obj-$(CONFIG_NFC_ST21NFCA) += st21nfca/ | 14 | obj-$(CONFIG_NFC_ST21NFCA) += st21nfca/ |
15 | obj-$(CONFIG_NFC_ST21NFCB) += st21nfcb/ | 15 | obj-$(CONFIG_NFC_ST_NCI) += st-nci/ |
16 | obj-$(CONFIG_NFC_NXP_NCI) += nxp-nci/ | 16 | obj-$(CONFIG_NFC_NXP_NCI) += nxp-nci/ |
diff --git a/drivers/nfc/st-nci/Kconfig b/drivers/nfc/st-nci/Kconfig new file mode 100644 index 000000000000..fc3904c946ee --- /dev/null +++ b/drivers/nfc/st-nci/Kconfig | |||
@@ -0,0 +1,23 @@ | |||
1 | config NFC_ST_NCI | ||
2 | tristate "STMicroelectronics ST NCI NFC driver" | ||
3 | depends on NFC_NCI | ||
4 | default n | ||
5 | ---help--- | ||
6 | STMicroelectronics NFC NCI chips core driver. It implements the chipset | ||
7 | NCI logic and hooks into the NFC kernel APIs. Physical layers will | ||
8 | register against it. | ||
9 | |||
10 | To compile this driver as a module, choose m here. The module will | ||
11 | be called st-nci. | ||
12 | Say N if unsure. | ||
13 | |||
14 | config NFC_ST_NCI_I2C | ||
15 | tristate "NFC ST NCI i2c support" | ||
16 | depends on NFC_ST_NCI && I2C | ||
17 | ---help--- | ||
18 | This module adds support for an I2C interface to the | ||
19 | STMicroelectronics NFC NCI chips familly. | ||
20 | Select this if your platform is using the i2c bus. | ||
21 | |||
22 | If you choose to build a module, it'll be called st-nci_i2c. | ||
23 | Say N if unsure. | ||
diff --git a/drivers/nfc/st-nci/Makefile b/drivers/nfc/st-nci/Makefile new file mode 100644 index 000000000000..0df157df3a94 --- /dev/null +++ b/drivers/nfc/st-nci/Makefile | |||
@@ -0,0 +1,9 @@ | |||
1 | # | ||
2 | # Makefile for ST21NFCB NCI based NFC driver | ||
3 | # | ||
4 | |||
5 | st-nci-objs = ndlc.o core.o st-nci_se.o | ||
6 | obj-$(CONFIG_NFC_ST_NCI) += st-nci.o | ||
7 | |||
8 | st-nci_i2c-objs = i2c.o | ||
9 | obj-$(CONFIG_NFC_ST_NCI_I2C) += st-nci_i2c.o | ||
diff --git a/drivers/nfc/st-nci/core.c b/drivers/nfc/st-nci/core.c new file mode 100644 index 000000000000..c419d3943973 --- /dev/null +++ b/drivers/nfc/st-nci/core.c | |||
@@ -0,0 +1,179 @@ | |||
1 | /* | ||
2 | * NCI based Driver for STMicroelectronics NFC Chip | ||
3 | * | ||
4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/nfc.h> | ||
21 | #include <net/nfc/nci.h> | ||
22 | #include <net/nfc/nci_core.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <linux/delay.h> | ||
25 | |||
26 | #include "st-nci.h" | ||
27 | #include "st-nci_se.h" | ||
28 | |||
29 | #define DRIVER_DESC "NCI NFC driver for ST_NCI" | ||
30 | |||
31 | #define ST_NCI1_X_PROPRIETARY_ISO15693 0x83 | ||
32 | |||
33 | static int st_nci_init(struct nci_dev *ndev) | ||
34 | { | ||
35 | struct nci_mode_set_cmd cmd; | ||
36 | |||
37 | cmd.cmd_type = ST_NCI_SET_NFC_MODE; | ||
38 | cmd.mode = 1; | ||
39 | |||
40 | return nci_prop_cmd(ndev, ST_NCI_CORE_PROP, | ||
41 | sizeof(struct nci_mode_set_cmd), (__u8 *)&cmd); | ||
42 | } | ||
43 | |||
44 | static int st_nci_open(struct nci_dev *ndev) | ||
45 | { | ||
46 | struct st_nci_info *info = nci_get_drvdata(ndev); | ||
47 | int r; | ||
48 | |||
49 | if (test_and_set_bit(ST_NCI_RUNNING, &info->flags)) | ||
50 | return 0; | ||
51 | |||
52 | r = ndlc_open(info->ndlc); | ||
53 | if (r) | ||
54 | clear_bit(ST_NCI_RUNNING, &info->flags); | ||
55 | |||
56 | return r; | ||
57 | } | ||
58 | |||
59 | static int st_nci_close(struct nci_dev *ndev) | ||
60 | { | ||
61 | struct st_nci_info *info = nci_get_drvdata(ndev); | ||
62 | |||
63 | if (!test_bit(ST_NCI_RUNNING, &info->flags)) | ||
64 | return 0; | ||
65 | |||
66 | ndlc_close(info->ndlc); | ||
67 | |||
68 | clear_bit(ST_NCI_RUNNING, &info->flags); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int st_nci_send(struct nci_dev *ndev, struct sk_buff *skb) | ||
74 | { | ||
75 | struct st_nci_info *info = nci_get_drvdata(ndev); | ||
76 | |||
77 | skb->dev = (void *)ndev; | ||
78 | |||
79 | if (!test_bit(ST_NCI_RUNNING, &info->flags)) | ||
80 | return -EBUSY; | ||
81 | |||
82 | return ndlc_send(info->ndlc, skb); | ||
83 | } | ||
84 | |||
85 | static __u32 st_nci_get_rfprotocol(struct nci_dev *ndev, | ||
86 | __u8 rf_protocol) | ||
87 | { | ||
88 | return rf_protocol == ST_NCI1_X_PROPRIETARY_ISO15693 ? | ||
89 | NFC_PROTO_ISO15693_MASK : 0; | ||
90 | } | ||
91 | |||
92 | static int st_nci_prop_rsp_packet(struct nci_dev *ndev, | ||
93 | struct sk_buff *skb) | ||
94 | { | ||
95 | __u8 status = skb->data[0]; | ||
96 | |||
97 | nci_req_complete(ndev, status); | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static struct nci_prop_ops st_nci_prop_ops[] = { | ||
102 | { | ||
103 | .opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, | ||
104 | ST_NCI_CORE_PROP), | ||
105 | .rsp = st_nci_prop_rsp_packet, | ||
106 | }, | ||
107 | }; | ||
108 | |||
109 | static struct nci_ops st_nci_ops = { | ||
110 | .init = st_nci_init, | ||
111 | .open = st_nci_open, | ||
112 | .close = st_nci_close, | ||
113 | .send = st_nci_send, | ||
114 | .get_rfprotocol = st_nci_get_rfprotocol, | ||
115 | .discover_se = st_nci_discover_se, | ||
116 | .enable_se = st_nci_enable_se, | ||
117 | .disable_se = st_nci_disable_se, | ||
118 | .se_io = st_nci_se_io, | ||
119 | .hci_load_session = st_nci_hci_load_session, | ||
120 | .hci_event_received = st_nci_hci_event_received, | ||
121 | .hci_cmd_received = st_nci_hci_cmd_received, | ||
122 | .prop_ops = st_nci_prop_ops, | ||
123 | .n_prop_ops = ARRAY_SIZE(st_nci_prop_ops), | ||
124 | }; | ||
125 | |||
126 | int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, | ||
127 | int phy_tailroom) | ||
128 | { | ||
129 | struct st_nci_info *info; | ||
130 | int r; | ||
131 | u32 protocols; | ||
132 | |||
133 | info = devm_kzalloc(ndlc->dev, | ||
134 | sizeof(struct st_nci_info), GFP_KERNEL); | ||
135 | if (!info) | ||
136 | return -ENOMEM; | ||
137 | |||
138 | protocols = NFC_PROTO_JEWEL_MASK | ||
139 | | NFC_PROTO_MIFARE_MASK | ||
140 | | NFC_PROTO_FELICA_MASK | ||
141 | | NFC_PROTO_ISO14443_MASK | ||
142 | | NFC_PROTO_ISO14443_B_MASK | ||
143 | | NFC_PROTO_ISO15693_MASK | ||
144 | | NFC_PROTO_NFC_DEP_MASK; | ||
145 | |||
146 | ndlc->ndev = nci_allocate_device(&st_nci_ops, protocols, | ||
147 | phy_headroom, phy_tailroom); | ||
148 | if (!ndlc->ndev) { | ||
149 | pr_err("Cannot allocate nfc ndev\n"); | ||
150 | return -ENOMEM; | ||
151 | } | ||
152 | info->ndlc = ndlc; | ||
153 | |||
154 | nci_set_drvdata(ndlc->ndev, info); | ||
155 | |||
156 | r = nci_register_device(ndlc->ndev); | ||
157 | if (r) { | ||
158 | pr_err("Cannot register nfc device to nci core\n"); | ||
159 | nci_free_device(ndlc->ndev); | ||
160 | return r; | ||
161 | } | ||
162 | |||
163 | return st_nci_se_init(ndlc->ndev); | ||
164 | } | ||
165 | EXPORT_SYMBOL_GPL(st_nci_probe); | ||
166 | |||
167 | void st_nci_remove(struct nci_dev *ndev) | ||
168 | { | ||
169 | struct st_nci_info *info = nci_get_drvdata(ndev); | ||
170 | |||
171 | ndlc_close(info->ndlc); | ||
172 | |||
173 | nci_unregister_device(ndev); | ||
174 | nci_free_device(ndev); | ||
175 | } | ||
176 | EXPORT_SYMBOL_GPL(st_nci_remove); | ||
177 | |||
178 | MODULE_LICENSE("GPL"); | ||
179 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st-nci/i2c.c index dbc0dfd8ae85..06175ce769bb 100644 --- a/drivers/nfc/st21nfcb/i2c.c +++ b/drivers/nfc/st-nci/i2c.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * I2C Link Layer for ST21NFCB NCI based Driver | 2 | * I2C Link Layer for ST NCI NFC controller familly based Driver |
3 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | 3 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms and conditions of the GNU General Public License, | 6 | * under the terms and conditions of the GNU General Public License, |
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/nfc.h> | 27 | #include <linux/nfc.h> |
28 | #include <linux/platform_data/st21nfcb.h> | 28 | #include <linux/platform_data/st_nci.h> |
29 | 29 | ||
30 | #include "ndlc.h" | 30 | #include "ndlc.h" |
31 | 31 | ||
@@ -35,18 +35,18 @@ | |||
35 | #define ST21NFCB_FRAME_HEADROOM 1 | 35 | #define ST21NFCB_FRAME_HEADROOM 1 |
36 | #define ST21NFCB_FRAME_TAILROOM 0 | 36 | #define ST21NFCB_FRAME_TAILROOM 0 |
37 | 37 | ||
38 | #define ST21NFCB_NCI_I2C_MIN_SIZE 4 /* PCB(1) + NCI Packet header(3) */ | 38 | #define ST_NCI_I2C_MIN_SIZE 4 /* PCB(1) + NCI Packet header(3) */ |
39 | #define ST21NFCB_NCI_I2C_MAX_SIZE 250 /* req 4.2.1 */ | 39 | #define ST_NCI_I2C_MAX_SIZE 250 /* req 4.2.1 */ |
40 | 40 | ||
41 | #define ST21NFCB_NCI_I2C_DRIVER_NAME "st21nfcb_nci_i2c" | 41 | #define ST_NCI_I2C_DRIVER_NAME "st_nci_i2c" |
42 | 42 | ||
43 | static struct i2c_device_id st21nfcb_nci_i2c_id_table[] = { | 43 | static struct i2c_device_id st_nci_i2c_id_table[] = { |
44 | {ST21NFCB_NCI_DRIVER_NAME, 0}, | 44 | {ST_NCI_DRIVER_NAME, 0}, |
45 | {} | 45 | {} |
46 | }; | 46 | }; |
47 | MODULE_DEVICE_TABLE(i2c, st21nfcb_nci_i2c_id_table); | 47 | MODULE_DEVICE_TABLE(i2c, st_nci_i2c_id_table); |
48 | 48 | ||
49 | struct st21nfcb_i2c_phy { | 49 | struct st_nci_i2c_phy { |
50 | struct i2c_client *i2c_dev; | 50 | struct i2c_client *i2c_dev; |
51 | struct llt_ndlc *ndlc; | 51 | struct llt_ndlc *ndlc; |
52 | 52 | ||
@@ -61,9 +61,9 @@ do { \ | |||
61 | 16, 1, (skb)->data, (skb)->len, 0); \ | 61 | 16, 1, (skb)->data, (skb)->len, 0); \ |
62 | } while (0) | 62 | } while (0) |
63 | 63 | ||
64 | static int st21nfcb_nci_i2c_enable(void *phy_id) | 64 | static int st_nci_i2c_enable(void *phy_id) |
65 | { | 65 | { |
66 | struct st21nfcb_i2c_phy *phy = phy_id; | 66 | struct st_nci_i2c_phy *phy = phy_id; |
67 | 67 | ||
68 | gpio_set_value(phy->gpio_reset, 0); | 68 | gpio_set_value(phy->gpio_reset, 0); |
69 | usleep_range(10000, 15000); | 69 | usleep_range(10000, 15000); |
@@ -76,9 +76,9 @@ static int st21nfcb_nci_i2c_enable(void *phy_id) | |||
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | 78 | ||
79 | static void st21nfcb_nci_i2c_disable(void *phy_id) | 79 | static void st_nci_i2c_disable(void *phy_id) |
80 | { | 80 | { |
81 | struct st21nfcb_i2c_phy *phy = phy_id; | 81 | struct st_nci_i2c_phy *phy = phy_id; |
82 | 82 | ||
83 | disable_irq_nosync(phy->i2c_dev->irq); | 83 | disable_irq_nosync(phy->i2c_dev->irq); |
84 | } | 84 | } |
@@ -88,13 +88,13 @@ static void st21nfcb_nci_i2c_disable(void *phy_id) | |||
88 | * It must return either zero for success, or <0 for error. | 88 | * It must return either zero for success, or <0 for error. |
89 | * In addition, it must not alter the skb | 89 | * In addition, it must not alter the skb |
90 | */ | 90 | */ |
91 | static int st21nfcb_nci_i2c_write(void *phy_id, struct sk_buff *skb) | 91 | static int st_nci_i2c_write(void *phy_id, struct sk_buff *skb) |
92 | { | 92 | { |
93 | int r = -1; | 93 | int r = -1; |
94 | struct st21nfcb_i2c_phy *phy = phy_id; | 94 | struct st_nci_i2c_phy *phy = phy_id; |
95 | struct i2c_client *client = phy->i2c_dev; | 95 | struct i2c_client *client = phy->i2c_dev; |
96 | 96 | ||
97 | I2C_DUMP_SKB("st21nfcb_nci_i2c_write", skb); | 97 | I2C_DUMP_SKB("st_nci_i2c_write", skb); |
98 | 98 | ||
99 | if (phy->ndlc->hard_fault != 0) | 99 | if (phy->ndlc->hard_fault != 0) |
100 | return phy->ndlc->hard_fault; | 100 | return phy->ndlc->hard_fault; |
@@ -124,40 +124,40 @@ static int st21nfcb_nci_i2c_write(void *phy_id, struct sk_buff *skb) | |||
124 | * at end of read) | 124 | * at end of read) |
125 | * -EREMOTEIO : i2c read error (fatal) | 125 | * -EREMOTEIO : i2c read error (fatal) |
126 | * -EBADMSG : frame was incorrect and discarded | 126 | * -EBADMSG : frame was incorrect and discarded |
127 | * (value returned from st21nfcb_nci_i2c_repack) | 127 | * (value returned from st_nci_i2c_repack) |
128 | * -EIO : if no ST21NFCB_SOF_EOF is found after reaching | 128 | * -EIO : if no ST21NFCB_SOF_EOF is found after reaching |
129 | * the read length end sequence | 129 | * the read length end sequence |
130 | */ | 130 | */ |
131 | static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy, | 131 | static int st_nci_i2c_read(struct st_nci_i2c_phy *phy, |
132 | struct sk_buff **skb) | 132 | struct sk_buff **skb) |
133 | { | 133 | { |
134 | int r; | 134 | int r; |
135 | u8 len; | 135 | u8 len; |
136 | u8 buf[ST21NFCB_NCI_I2C_MAX_SIZE]; | 136 | u8 buf[ST_NCI_I2C_MAX_SIZE]; |
137 | struct i2c_client *client = phy->i2c_dev; | 137 | struct i2c_client *client = phy->i2c_dev; |
138 | 138 | ||
139 | r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE); | 139 | r = i2c_master_recv(client, buf, ST_NCI_I2C_MIN_SIZE); |
140 | if (r < 0) { /* Retry, chip was in standby */ | 140 | if (r < 0) { /* Retry, chip was in standby */ |
141 | usleep_range(1000, 4000); | 141 | usleep_range(1000, 4000); |
142 | r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE); | 142 | r = i2c_master_recv(client, buf, ST_NCI_I2C_MIN_SIZE); |
143 | } | 143 | } |
144 | 144 | ||
145 | if (r != ST21NFCB_NCI_I2C_MIN_SIZE) | 145 | if (r != ST_NCI_I2C_MIN_SIZE) |
146 | return -EREMOTEIO; | 146 | return -EREMOTEIO; |
147 | 147 | ||
148 | len = be16_to_cpu(*(__be16 *) (buf + 2)); | 148 | len = be16_to_cpu(*(__be16 *) (buf + 2)); |
149 | if (len > ST21NFCB_NCI_I2C_MAX_SIZE) { | 149 | if (len > ST_NCI_I2C_MAX_SIZE) { |
150 | nfc_err(&client->dev, "invalid frame len\n"); | 150 | nfc_err(&client->dev, "invalid frame len\n"); |
151 | return -EBADMSG; | 151 | return -EBADMSG; |
152 | } | 152 | } |
153 | 153 | ||
154 | *skb = alloc_skb(ST21NFCB_NCI_I2C_MIN_SIZE + len, GFP_KERNEL); | 154 | *skb = alloc_skb(ST_NCI_I2C_MIN_SIZE + len, GFP_KERNEL); |
155 | if (*skb == NULL) | 155 | if (*skb == NULL) |
156 | return -ENOMEM; | 156 | return -ENOMEM; |
157 | 157 | ||
158 | skb_reserve(*skb, ST21NFCB_NCI_I2C_MIN_SIZE); | 158 | skb_reserve(*skb, ST_NCI_I2C_MIN_SIZE); |
159 | skb_put(*skb, ST21NFCB_NCI_I2C_MIN_SIZE); | 159 | skb_put(*skb, ST_NCI_I2C_MIN_SIZE); |
160 | memcpy((*skb)->data, buf, ST21NFCB_NCI_I2C_MIN_SIZE); | 160 | memcpy((*skb)->data, buf, ST_NCI_I2C_MIN_SIZE); |
161 | 161 | ||
162 | if (!len) | 162 | if (!len) |
163 | return 0; | 163 | return 0; |
@@ -169,7 +169,7 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy, | |||
169 | } | 169 | } |
170 | 170 | ||
171 | skb_put(*skb, len); | 171 | skb_put(*skb, len); |
172 | memcpy((*skb)->data + ST21NFCB_NCI_I2C_MIN_SIZE, buf, len); | 172 | memcpy((*skb)->data + ST_NCI_I2C_MIN_SIZE, buf, len); |
173 | 173 | ||
174 | I2C_DUMP_SKB("i2c frame read", *skb); | 174 | I2C_DUMP_SKB("i2c frame read", *skb); |
175 | 175 | ||
@@ -181,9 +181,9 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy, | |||
181 | * | 181 | * |
182 | * On ST21NFCB, IRQ goes in idle state when read starts. | 182 | * On ST21NFCB, IRQ goes in idle state when read starts. |
183 | */ | 183 | */ |
184 | static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id) | 184 | static irqreturn_t st_nci_irq_thread_fn(int irq, void *phy_id) |
185 | { | 185 | { |
186 | struct st21nfcb_i2c_phy *phy = phy_id; | 186 | struct st_nci_i2c_phy *phy = phy_id; |
187 | struct i2c_client *client; | 187 | struct i2c_client *client; |
188 | struct sk_buff *skb = NULL; | 188 | struct sk_buff *skb = NULL; |
189 | int r; | 189 | int r; |
@@ -200,11 +200,11 @@ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id) | |||
200 | return IRQ_HANDLED; | 200 | return IRQ_HANDLED; |
201 | 201 | ||
202 | if (!phy->ndlc->powered) { | 202 | if (!phy->ndlc->powered) { |
203 | st21nfcb_nci_i2c_disable(phy); | 203 | st_nci_i2c_disable(phy); |
204 | return IRQ_HANDLED; | 204 | return IRQ_HANDLED; |
205 | } | 205 | } |
206 | 206 | ||
207 | r = st21nfcb_nci_i2c_read(phy, &skb); | 207 | r = st_nci_i2c_read(phy, &skb); |
208 | if (r == -EREMOTEIO || r == -ENOMEM || r == -EBADMSG) | 208 | if (r == -EREMOTEIO || r == -ENOMEM || r == -EBADMSG) |
209 | return IRQ_HANDLED; | 209 | return IRQ_HANDLED; |
210 | 210 | ||
@@ -214,15 +214,15 @@ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id) | |||
214 | } | 214 | } |
215 | 215 | ||
216 | static struct nfc_phy_ops i2c_phy_ops = { | 216 | static struct nfc_phy_ops i2c_phy_ops = { |
217 | .write = st21nfcb_nci_i2c_write, | 217 | .write = st_nci_i2c_write, |
218 | .enable = st21nfcb_nci_i2c_enable, | 218 | .enable = st_nci_i2c_enable, |
219 | .disable = st21nfcb_nci_i2c_disable, | 219 | .disable = st_nci_i2c_disable, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | #ifdef CONFIG_OF | 222 | #ifdef CONFIG_OF |
223 | static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) | 223 | static int st_nci_i2c_of_request_resources(struct i2c_client *client) |
224 | { | 224 | { |
225 | struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); | 225 | struct st_nci_i2c_phy *phy = i2c_get_clientdata(client); |
226 | struct device_node *pp; | 226 | struct device_node *pp; |
227 | int gpio; | 227 | int gpio; |
228 | int r; | 228 | int r; |
@@ -253,16 +253,16 @@ static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) | |||
253 | return 0; | 253 | return 0; |
254 | } | 254 | } |
255 | #else | 255 | #else |
256 | static int st21nfcb_nci_i2c_of_request_resources(struct i2c_client *client) | 256 | static int st_nci_i2c_of_request_resources(struct i2c_client *client) |
257 | { | 257 | { |
258 | return -ENODEV; | 258 | return -ENODEV; |
259 | } | 259 | } |
260 | #endif | 260 | #endif |
261 | 261 | ||
262 | static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) | 262 | static int st_nci_i2c_request_resources(struct i2c_client *client) |
263 | { | 263 | { |
264 | struct st21nfcb_nfc_platform_data *pdata; | 264 | struct st_nci_nfc_platform_data *pdata; |
265 | struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); | 265 | struct st_nci_i2c_phy *phy = i2c_get_clientdata(client); |
266 | int r; | 266 | int r; |
267 | 267 | ||
268 | pdata = client->dev.platform_data; | 268 | pdata = client->dev.platform_data; |
@@ -285,11 +285,11 @@ static int st21nfcb_nci_i2c_request_resources(struct i2c_client *client) | |||
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | static int st21nfcb_nci_i2c_probe(struct i2c_client *client, | 288 | static int st_nci_i2c_probe(struct i2c_client *client, |
289 | const struct i2c_device_id *id) | 289 | const struct i2c_device_id *id) |
290 | { | 290 | { |
291 | struct st21nfcb_i2c_phy *phy; | 291 | struct st_nci_i2c_phy *phy; |
292 | struct st21nfcb_nfc_platform_data *pdata; | 292 | struct st_nci_nfc_platform_data *pdata; |
293 | int r; | 293 | int r; |
294 | 294 | ||
295 | dev_dbg(&client->dev, "%s\n", __func__); | 295 | dev_dbg(&client->dev, "%s\n", __func__); |
@@ -300,7 +300,7 @@ static int st21nfcb_nci_i2c_probe(struct i2c_client *client, | |||
300 | return -ENODEV; | 300 | return -ENODEV; |
301 | } | 301 | } |
302 | 302 | ||
303 | phy = devm_kzalloc(&client->dev, sizeof(struct st21nfcb_i2c_phy), | 303 | phy = devm_kzalloc(&client->dev, sizeof(struct st_nci_i2c_phy), |
304 | GFP_KERNEL); | 304 | GFP_KERNEL); |
305 | if (!phy) | 305 | if (!phy) |
306 | return -ENOMEM; | 306 | return -ENOMEM; |
@@ -311,13 +311,13 @@ static int st21nfcb_nci_i2c_probe(struct i2c_client *client, | |||
311 | 311 | ||
312 | pdata = client->dev.platform_data; | 312 | pdata = client->dev.platform_data; |
313 | if (!pdata && client->dev.of_node) { | 313 | if (!pdata && client->dev.of_node) { |
314 | r = st21nfcb_nci_i2c_of_request_resources(client); | 314 | r = st_nci_i2c_of_request_resources(client); |
315 | if (r) { | 315 | if (r) { |
316 | nfc_err(&client->dev, "No platform data\n"); | 316 | nfc_err(&client->dev, "No platform data\n"); |
317 | return r; | 317 | return r; |
318 | } | 318 | } |
319 | } else if (pdata) { | 319 | } else if (pdata) { |
320 | r = st21nfcb_nci_i2c_request_resources(client); | 320 | r = st_nci_i2c_request_resources(client); |
321 | if (r) { | 321 | if (r) { |
322 | nfc_err(&client->dev, | 322 | nfc_err(&client->dev, |
323 | "Cannot get platform resources\n"); | 323 | "Cannot get platform resources\n"); |
@@ -338,18 +338,18 @@ static int st21nfcb_nci_i2c_probe(struct i2c_client *client, | |||
338 | } | 338 | } |
339 | 339 | ||
340 | r = devm_request_threaded_irq(&client->dev, client->irq, NULL, | 340 | r = devm_request_threaded_irq(&client->dev, client->irq, NULL, |
341 | st21nfcb_nci_irq_thread_fn, | 341 | st_nci_irq_thread_fn, |
342 | phy->irq_polarity | IRQF_ONESHOT, | 342 | phy->irq_polarity | IRQF_ONESHOT, |
343 | ST21NFCB_NCI_DRIVER_NAME, phy); | 343 | ST_NCI_DRIVER_NAME, phy); |
344 | if (r < 0) | 344 | if (r < 0) |
345 | nfc_err(&client->dev, "Unable to register IRQ handler\n"); | 345 | nfc_err(&client->dev, "Unable to register IRQ handler\n"); |
346 | 346 | ||
347 | return r; | 347 | return r; |
348 | } | 348 | } |
349 | 349 | ||
350 | static int st21nfcb_nci_i2c_remove(struct i2c_client *client) | 350 | static int st_nci_i2c_remove(struct i2c_client *client) |
351 | { | 351 | { |
352 | struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); | 352 | struct st_nci_i2c_phy *phy = i2c_get_clientdata(client); |
353 | 353 | ||
354 | dev_dbg(&client->dev, "%s\n", __func__); | 354 | dev_dbg(&client->dev, "%s\n", __func__); |
355 | 355 | ||
@@ -359,26 +359,27 @@ static int st21nfcb_nci_i2c_remove(struct i2c_client *client) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | #ifdef CONFIG_OF | 361 | #ifdef CONFIG_OF |
362 | static const struct of_device_id of_st21nfcb_i2c_match[] = { | 362 | static const struct of_device_id of_st_nci_i2c_match[] = { |
363 | { .compatible = "st,st21nfcb-i2c", }, | 363 | { .compatible = "st,st21nfcb-i2c", }, |
364 | { .compatible = "st,st21nfcb_i2c", }, | 364 | { .compatible = "st,st21nfcb_i2c", }, |
365 | { .compatible = "st,st21nfcc-i2c", }, | ||
365 | {} | 366 | {} |
366 | }; | 367 | }; |
367 | MODULE_DEVICE_TABLE(of, of_st21nfcb_i2c_match); | 368 | MODULE_DEVICE_TABLE(of, of_st_nci_i2c_match); |
368 | #endif | 369 | #endif |
369 | 370 | ||
370 | static struct i2c_driver st21nfcb_nci_i2c_driver = { | 371 | static struct i2c_driver st_nci_i2c_driver = { |
371 | .driver = { | 372 | .driver = { |
372 | .owner = THIS_MODULE, | 373 | .owner = THIS_MODULE, |
373 | .name = ST21NFCB_NCI_I2C_DRIVER_NAME, | 374 | .name = ST_NCI_I2C_DRIVER_NAME, |
374 | .of_match_table = of_match_ptr(of_st21nfcb_i2c_match), | 375 | .of_match_table = of_match_ptr(of_st_nci_i2c_match), |
375 | }, | 376 | }, |
376 | .probe = st21nfcb_nci_i2c_probe, | 377 | .probe = st_nci_i2c_probe, |
377 | .id_table = st21nfcb_nci_i2c_id_table, | 378 | .id_table = st_nci_i2c_id_table, |
378 | .remove = st21nfcb_nci_i2c_remove, | 379 | .remove = st_nci_i2c_remove, |
379 | }; | 380 | }; |
380 | 381 | ||
381 | module_i2c_driver(st21nfcb_nci_i2c_driver); | 382 | module_i2c_driver(st_nci_i2c_driver); |
382 | 383 | ||
383 | MODULE_LICENSE("GPL"); | 384 | MODULE_LICENSE("GPL"); |
384 | MODULE_DESCRIPTION(DRIVER_DESC); | 385 | MODULE_DESCRIPTION(DRIVER_DESC); |
diff --git a/drivers/nfc/st21nfcb/ndlc.c b/drivers/nfc/st-nci/ndlc.c index 91e81f37b3a6..56c6a4cb4c96 100644 --- a/drivers/nfc/st21nfcb/ndlc.c +++ b/drivers/nfc/st-nci/ndlc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Low Level Transport (NDLC) Driver for STMicroelectronics NFC Chip | 2 | * Low Level Transport (NDLC) Driver for STMicroelectronics NFC Chip |
3 | * | 3 | * |
4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | 4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -20,7 +20,7 @@ | |||
20 | #include <net/nfc/nci_core.h> | 20 | #include <net/nfc/nci_core.h> |
21 | 21 | ||
22 | #include "ndlc.h" | 22 | #include "ndlc.h" |
23 | #include "st21nfcb.h" | 23 | #include "st-nci.h" |
24 | 24 | ||
25 | #define NDLC_TIMER_T1 100 | 25 | #define NDLC_TIMER_T1 100 |
26 | #define NDLC_TIMER_T1_WAIT 400 | 26 | #define NDLC_TIMER_T1_WAIT 400 |
@@ -68,13 +68,13 @@ void ndlc_close(struct llt_ndlc *ndlc) | |||
68 | { | 68 | { |
69 | struct nci_mode_set_cmd cmd; | 69 | struct nci_mode_set_cmd cmd; |
70 | 70 | ||
71 | cmd.cmd_type = ST21NFCB_NCI_SET_NFC_MODE; | 71 | cmd.cmd_type = ST_NCI_SET_NFC_MODE; |
72 | cmd.mode = 0; | 72 | cmd.mode = 0; |
73 | 73 | ||
74 | /* toggle reset pin */ | 74 | /* toggle reset pin */ |
75 | ndlc->ops->enable(ndlc->phy_id); | 75 | ndlc->ops->enable(ndlc->phy_id); |
76 | 76 | ||
77 | nci_prop_cmd(ndlc->ndev, ST21NFCB_NCI_CORE_PROP, | 77 | nci_prop_cmd(ndlc->ndev, ST_NCI_CORE_PROP, |
78 | sizeof(struct nci_mode_set_cmd), (__u8 *)&cmd); | 78 | sizeof(struct nci_mode_set_cmd), (__u8 *)&cmd); |
79 | 79 | ||
80 | ndlc->powered = 0; | 80 | ndlc->powered = 0; |
@@ -293,13 +293,13 @@ int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev, | |||
293 | 293 | ||
294 | INIT_WORK(&ndlc->sm_work, llt_ndlc_sm_work); | 294 | INIT_WORK(&ndlc->sm_work, llt_ndlc_sm_work); |
295 | 295 | ||
296 | return st21nfcb_nci_probe(ndlc, phy_headroom, phy_tailroom); | 296 | return st_nci_probe(ndlc, phy_headroom, phy_tailroom); |
297 | } | 297 | } |
298 | EXPORT_SYMBOL(ndlc_probe); | 298 | EXPORT_SYMBOL(ndlc_probe); |
299 | 299 | ||
300 | void ndlc_remove(struct llt_ndlc *ndlc) | 300 | void ndlc_remove(struct llt_ndlc *ndlc) |
301 | { | 301 | { |
302 | st21nfcb_nci_remove(ndlc->ndev); | 302 | st_nci_remove(ndlc->ndev); |
303 | 303 | ||
304 | /* cancel timers */ | 304 | /* cancel timers */ |
305 | del_timer_sync(&ndlc->t1_timer); | 305 | del_timer_sync(&ndlc->t1_timer); |
diff --git a/drivers/nfc/st21nfcb/ndlc.h b/drivers/nfc/st-nci/ndlc.h index cf6a9d9f2983..6361005ef003 100644 --- a/drivers/nfc/st21nfcb/ndlc.h +++ b/drivers/nfc/st-nci/ndlc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * NCI based Driver for STMicroelectronics NFC Chip | 2 | * NCI based Driver for STMicroelectronics NFC Chip |
3 | * | 3 | * |
4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | 4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -43,7 +43,7 @@ struct llt_ndlc { | |||
43 | struct device *dev; | 43 | struct device *dev; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * < 0 if hardware error occured | 46 | * < 0 if hardware error occurred |
47 | * and prevents normal operation. | 47 | * and prevents normal operation. |
48 | */ | 48 | */ |
49 | int hard_fault; | 49 | int hard_fault; |
diff --git a/drivers/nfc/st21nfcb/st21nfcb.h b/drivers/nfc/st-nci/st-nci.h index 710636325c1f..850a2395deb7 100644 --- a/drivers/nfc/st21nfcb/st21nfcb.h +++ b/drivers/nfc/st-nci/st-nci.h | |||
@@ -16,17 +16,17 @@ | |||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef __LOCAL_ST21NFCB_H_ | 19 | #ifndef __LOCAL_ST_NCI_H_ |
20 | #define __LOCAL_ST21NFCB_H_ | 20 | #define __LOCAL_ST_NCI_H_ |
21 | 21 | ||
22 | #include "st21nfcb_se.h" | 22 | #include "st-nci_se.h" |
23 | #include "ndlc.h" | 23 | #include "ndlc.h" |
24 | 24 | ||
25 | /* Define private flags: */ | 25 | /* Define private flags: */ |
26 | #define ST21NFCB_NCI_RUNNING 1 | 26 | #define ST_NCI_RUNNING 1 |
27 | 27 | ||
28 | #define ST21NFCB_NCI_CORE_PROP 0x01 | 28 | #define ST_NCI_CORE_PROP 0x01 |
29 | #define ST21NFCB_NCI_SET_NFC_MODE 0x02 | 29 | #define ST_NCI_SET_NFC_MODE 0x02 |
30 | 30 | ||
31 | struct nci_mode_set_cmd { | 31 | struct nci_mode_set_cmd { |
32 | u8 cmd_type; | 32 | u8 cmd_type; |
@@ -37,14 +37,14 @@ struct nci_mode_set_rsp { | |||
37 | u8 status; | 37 | u8 status; |
38 | } __packed; | 38 | } __packed; |
39 | 39 | ||
40 | struct st21nfcb_nci_info { | 40 | struct st_nci_info { |
41 | struct llt_ndlc *ndlc; | 41 | struct llt_ndlc *ndlc; |
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | struct st21nfcb_se_info se_info; | 43 | struct st_nci_se_info se_info; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | void st21nfcb_nci_remove(struct nci_dev *ndev); | 46 | void st_nci_remove(struct nci_dev *ndev); |
47 | int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, | 47 | int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, |
48 | int phy_tailroom); | 48 | int phy_tailroom); |
49 | 49 | ||
50 | #endif /* __LOCAL_ST21NFCB_H_ */ | 50 | #endif /* __LOCAL_ST_NCI_H_ */ |
diff --git a/drivers/nfc/st21nfcb/st21nfcb_se.c b/drivers/nfc/st-nci/st-nci_se.c index 24862a525fb5..97addfa96c6f 100644 --- a/drivers/nfc/st21nfcb/st21nfcb_se.c +++ b/drivers/nfc/st-nci/st-nci_se.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * NCI based Driver for STMicroelectronics NFC Chip | 2 | * Secure Element driver for STMicroelectronics NFC NCI chip |
3 | * | 3 | * |
4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | 4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -22,10 +22,10 @@ | |||
22 | #include <net/nfc/nci.h> | 22 | #include <net/nfc/nci.h> |
23 | #include <net/nfc/nci_core.h> | 23 | #include <net/nfc/nci_core.h> |
24 | 24 | ||
25 | #include "st21nfcb.h" | 25 | #include "st-nci.h" |
26 | #include "st21nfcb_se.h" | 26 | #include "st-nci_se.h" |
27 | 27 | ||
28 | struct st21nfcb_pipe_info { | 28 | struct st_nci_pipe_info { |
29 | u8 pipe_state; | 29 | u8 pipe_state; |
30 | u8 src_host_id; | 30 | u8 src_host_id; |
31 | u8 src_gate_id; | 31 | u8 src_gate_id; |
@@ -34,166 +34,166 @@ struct st21nfcb_pipe_info { | |||
34 | } __packed; | 34 | } __packed; |
35 | 35 | ||
36 | /* Hosts */ | 36 | /* Hosts */ |
37 | #define ST21NFCB_HOST_CONTROLLER_ID 0x00 | 37 | #define ST_NCI_HOST_CONTROLLER_ID 0x00 |
38 | #define ST21NFCB_TERMINAL_HOST_ID 0x01 | 38 | #define ST_NCI_TERMINAL_HOST_ID 0x01 |
39 | #define ST21NFCB_UICC_HOST_ID 0x02 | 39 | #define ST_NCI_UICC_HOST_ID 0x02 |
40 | #define ST21NFCB_ESE_HOST_ID 0xc0 | 40 | #define ST_NCI_ESE_HOST_ID 0xc0 |
41 | 41 | ||
42 | /* Gates */ | 42 | /* Gates */ |
43 | #define ST21NFCB_DEVICE_MGNT_GATE 0x01 | 43 | #define ST_NCI_DEVICE_MGNT_GATE 0x01 |
44 | #define ST21NFCB_APDU_READER_GATE 0xf0 | 44 | #define ST_NCI_APDU_READER_GATE 0xf0 |
45 | #define ST21NFCB_CONNECTIVITY_GATE 0x41 | 45 | #define ST_NCI_CONNECTIVITY_GATE 0x41 |
46 | 46 | ||
47 | /* Pipes */ | 47 | /* Pipes */ |
48 | #define ST21NFCB_DEVICE_MGNT_PIPE 0x02 | 48 | #define ST_NCI_DEVICE_MGNT_PIPE 0x02 |
49 | 49 | ||
50 | /* Connectivity pipe only */ | 50 | /* Connectivity pipe only */ |
51 | #define ST21NFCB_SE_COUNT_PIPE_UICC 0x01 | 51 | #define ST_NCI_SE_COUNT_PIPE_UICC 0x01 |
52 | /* Connectivity + APDU Reader pipe */ | 52 | /* Connectivity + APDU Reader pipe */ |
53 | #define ST21NFCB_SE_COUNT_PIPE_EMBEDDED 0x02 | 53 | #define ST_NCI_SE_COUNT_PIPE_EMBEDDED 0x02 |
54 | 54 | ||
55 | #define ST21NFCB_SE_TO_HOT_PLUG 1000 /* msecs */ | 55 | #define ST_NCI_SE_TO_HOT_PLUG 1000 /* msecs */ |
56 | #define ST21NFCB_SE_TO_PIPES 2000 | 56 | #define ST_NCI_SE_TO_PIPES 2000 |
57 | 57 | ||
58 | #define ST21NFCB_EVT_HOT_PLUG_IS_INHIBITED(x) (x->data[0] & 0x80) | 58 | #define ST_NCI_EVT_HOT_PLUG_IS_INHIBITED(x) (x->data[0] & 0x80) |
59 | 59 | ||
60 | #define NCI_HCI_APDU_PARAM_ATR 0x01 | 60 | #define NCI_HCI_APDU_PARAM_ATR 0x01 |
61 | #define NCI_HCI_ADMIN_PARAM_SESSION_IDENTITY 0x01 | 61 | #define NCI_HCI_ADMIN_PARAM_SESSION_IDENTITY 0x01 |
62 | #define NCI_HCI_ADMIN_PARAM_WHITELIST 0x03 | 62 | #define NCI_HCI_ADMIN_PARAM_WHITELIST 0x03 |
63 | #define NCI_HCI_ADMIN_PARAM_HOST_LIST 0x04 | 63 | #define NCI_HCI_ADMIN_PARAM_HOST_LIST 0x04 |
64 | 64 | ||
65 | #define ST21NFCB_EVT_SE_HARD_RESET 0x20 | 65 | #define ST_NCI_EVT_SE_HARD_RESET 0x20 |
66 | #define ST21NFCB_EVT_TRANSMIT_DATA 0x10 | 66 | #define ST_NCI_EVT_TRANSMIT_DATA 0x10 |
67 | #define ST21NFCB_EVT_WTX_REQUEST 0x11 | 67 | #define ST_NCI_EVT_WTX_REQUEST 0x11 |
68 | #define ST21NFCB_EVT_SE_SOFT_RESET 0x11 | 68 | #define ST_NCI_EVT_SE_SOFT_RESET 0x11 |
69 | #define ST21NFCB_EVT_SE_END_OF_APDU_TRANSFER 0x21 | 69 | #define ST_NCI_EVT_SE_END_OF_APDU_TRANSFER 0x21 |
70 | #define ST21NFCB_EVT_HOT_PLUG 0x03 | 70 | #define ST_NCI_EVT_HOT_PLUG 0x03 |
71 | 71 | ||
72 | #define ST21NFCB_SE_MODE_OFF 0x00 | 72 | #define ST_NCI_SE_MODE_OFF 0x00 |
73 | #define ST21NFCB_SE_MODE_ON 0x01 | 73 | #define ST_NCI_SE_MODE_ON 0x01 |
74 | 74 | ||
75 | #define ST21NFCB_EVT_CONNECTIVITY 0x10 | 75 | #define ST_NCI_EVT_CONNECTIVITY 0x10 |
76 | #define ST21NFCB_EVT_TRANSACTION 0x12 | 76 | #define ST_NCI_EVT_TRANSACTION 0x12 |
77 | 77 | ||
78 | #define ST21NFCB_DM_GETINFO 0x13 | 78 | #define ST_NCI_DM_GETINFO 0x13 |
79 | #define ST21NFCB_DM_GETINFO_PIPE_LIST 0x02 | 79 | #define ST_NCI_DM_GETINFO_PIPE_LIST 0x02 |
80 | #define ST21NFCB_DM_GETINFO_PIPE_INFO 0x01 | 80 | #define ST_NCI_DM_GETINFO_PIPE_INFO 0x01 |
81 | #define ST21NFCB_DM_PIPE_CREATED 0x02 | 81 | #define ST_NCI_DM_PIPE_CREATED 0x02 |
82 | #define ST21NFCB_DM_PIPE_OPEN 0x04 | 82 | #define ST_NCI_DM_PIPE_OPEN 0x04 |
83 | #define ST21NFCB_DM_RF_ACTIVE 0x80 | 83 | #define ST_NCI_DM_RF_ACTIVE 0x80 |
84 | #define ST21NFCB_DM_DISCONNECT 0x30 | 84 | #define ST_NCI_DM_DISCONNECT 0x30 |
85 | 85 | ||
86 | #define ST21NFCB_DM_IS_PIPE_OPEN(p) \ | 86 | #define ST_NCI_DM_IS_PIPE_OPEN(p) \ |
87 | ((p & 0x0f) == (ST21NFCB_DM_PIPE_CREATED | ST21NFCB_DM_PIPE_OPEN)) | 87 | ((p & 0x0f) == (ST_NCI_DM_PIPE_CREATED | ST_NCI_DM_PIPE_OPEN)) |
88 | 88 | ||
89 | #define ST21NFCB_ATR_DEFAULT_BWI 0x04 | 89 | #define ST_NCI_ATR_DEFAULT_BWI 0x04 |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * WT = 2^BWI/10[s], convert into msecs and add a secure | 92 | * WT = 2^BWI/10[s], convert into msecs and add a secure |
93 | * room by increasing by 2 this timeout | 93 | * room by increasing by 2 this timeout |
94 | */ | 94 | */ |
95 | #define ST21NFCB_BWI_TO_TIMEOUT(x) ((1 << x) * 200) | 95 | #define ST_NCI_BWI_TO_TIMEOUT(x) ((1 << x) * 200) |
96 | #define ST21NFCB_ATR_GET_Y_FROM_TD(x) (x >> 4) | 96 | #define ST_NCI_ATR_GET_Y_FROM_TD(x) (x >> 4) |
97 | 97 | ||
98 | /* If TA is present bit 0 is set */ | 98 | /* If TA is present bit 0 is set */ |
99 | #define ST21NFCB_ATR_TA_PRESENT(x) (x & 0x01) | 99 | #define ST_NCI_ATR_TA_PRESENT(x) (x & 0x01) |
100 | /* If TB is present bit 1 is set */ | 100 | /* If TB is present bit 1 is set */ |
101 | #define ST21NFCB_ATR_TB_PRESENT(x) (x & 0x02) | 101 | #define ST_NCI_ATR_TB_PRESENT(x) (x & 0x02) |
102 | 102 | ||
103 | #define ST21NFCB_NUM_DEVICES 256 | 103 | #define ST_NCI_NUM_DEVICES 256 |
104 | 104 | ||
105 | static DECLARE_BITMAP(dev_mask, ST21NFCB_NUM_DEVICES); | 105 | static DECLARE_BITMAP(dev_mask, ST_NCI_NUM_DEVICES); |
106 | 106 | ||
107 | /* Here are the mandatory pipe for st21nfcb */ | 107 | /* Here are the mandatory pipe for st_nci */ |
108 | static struct nci_hci_gate st21nfcb_gates[] = { | 108 | static struct nci_hci_gate st_nci_gates[] = { |
109 | {NCI_HCI_ADMIN_GATE, NCI_HCI_ADMIN_PIPE, | 109 | {NCI_HCI_ADMIN_GATE, NCI_HCI_ADMIN_PIPE, |
110 | ST21NFCB_HOST_CONTROLLER_ID}, | 110 | ST_NCI_HOST_CONTROLLER_ID}, |
111 | {NCI_HCI_LINK_MGMT_GATE, NCI_HCI_LINK_MGMT_PIPE, | 111 | {NCI_HCI_LINK_MGMT_GATE, NCI_HCI_LINK_MGMT_PIPE, |
112 | ST21NFCB_HOST_CONTROLLER_ID}, | 112 | ST_NCI_HOST_CONTROLLER_ID}, |
113 | {ST21NFCB_DEVICE_MGNT_GATE, ST21NFCB_DEVICE_MGNT_PIPE, | 113 | {ST_NCI_DEVICE_MGNT_GATE, ST_NCI_DEVICE_MGNT_PIPE, |
114 | ST21NFCB_HOST_CONTROLLER_ID}, | 114 | ST_NCI_HOST_CONTROLLER_ID}, |
115 | 115 | ||
116 | /* Secure element pipes are created by secure element host */ | 116 | /* Secure element pipes are created by secure element host */ |
117 | {ST21NFCB_CONNECTIVITY_GATE, NCI_HCI_DO_NOT_OPEN_PIPE, | 117 | {ST_NCI_CONNECTIVITY_GATE, NCI_HCI_DO_NOT_OPEN_PIPE, |
118 | ST21NFCB_HOST_CONTROLLER_ID}, | 118 | ST_NCI_HOST_CONTROLLER_ID}, |
119 | {ST21NFCB_APDU_READER_GATE, NCI_HCI_DO_NOT_OPEN_PIPE, | 119 | {ST_NCI_APDU_READER_GATE, NCI_HCI_DO_NOT_OPEN_PIPE, |
120 | ST21NFCB_HOST_CONTROLLER_ID}, | 120 | ST_NCI_HOST_CONTROLLER_ID}, |
121 | }; | 121 | }; |
122 | 122 | ||
123 | static u8 st21nfcb_se_get_bwi(struct nci_dev *ndev) | 123 | static u8 st_nci_se_get_bwi(struct nci_dev *ndev) |
124 | { | 124 | { |
125 | int i; | 125 | int i; |
126 | u8 td; | 126 | u8 td; |
127 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 127 | struct st_nci_info *info = nci_get_drvdata(ndev); |
128 | 128 | ||
129 | /* Bits 8 to 5 of the first TB for T=1 encode BWI from zero to nine */ | 129 | /* Bits 8 to 5 of the first TB for T=1 encode BWI from zero to nine */ |
130 | for (i = 1; i < ST21NFCB_ESE_MAX_LENGTH; i++) { | 130 | for (i = 1; i < ST_NCI_ESE_MAX_LENGTH; i++) { |
131 | td = ST21NFCB_ATR_GET_Y_FROM_TD(info->se_info.atr[i]); | 131 | td = ST_NCI_ATR_GET_Y_FROM_TD(info->se_info.atr[i]); |
132 | if (ST21NFCB_ATR_TA_PRESENT(td)) | 132 | if (ST_NCI_ATR_TA_PRESENT(td)) |
133 | i++; | 133 | i++; |
134 | if (ST21NFCB_ATR_TB_PRESENT(td)) { | 134 | if (ST_NCI_ATR_TB_PRESENT(td)) { |
135 | i++; | 135 | i++; |
136 | return info->se_info.atr[i] >> 4; | 136 | return info->se_info.atr[i] >> 4; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | return ST21NFCB_ATR_DEFAULT_BWI; | 139 | return ST_NCI_ATR_DEFAULT_BWI; |
140 | } | 140 | } |
141 | 141 | ||
142 | static void st21nfcb_se_get_atr(struct nci_dev *ndev) | 142 | static void st_nci_se_get_atr(struct nci_dev *ndev) |
143 | { | 143 | { |
144 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 144 | struct st_nci_info *info = nci_get_drvdata(ndev); |
145 | int r; | 145 | int r; |
146 | struct sk_buff *skb; | 146 | struct sk_buff *skb; |
147 | 147 | ||
148 | r = nci_hci_get_param(ndev, ST21NFCB_APDU_READER_GATE, | 148 | r = nci_hci_get_param(ndev, ST_NCI_APDU_READER_GATE, |
149 | NCI_HCI_APDU_PARAM_ATR, &skb); | 149 | NCI_HCI_APDU_PARAM_ATR, &skb); |
150 | if (r < 0) | 150 | if (r < 0) |
151 | return; | 151 | return; |
152 | 152 | ||
153 | if (skb->len <= ST21NFCB_ESE_MAX_LENGTH) { | 153 | if (skb->len <= ST_NCI_ESE_MAX_LENGTH) { |
154 | memcpy(info->se_info.atr, skb->data, skb->len); | 154 | memcpy(info->se_info.atr, skb->data, skb->len); |
155 | 155 | ||
156 | info->se_info.wt_timeout = | 156 | info->se_info.wt_timeout = |
157 | ST21NFCB_BWI_TO_TIMEOUT(st21nfcb_se_get_bwi(ndev)); | 157 | ST_NCI_BWI_TO_TIMEOUT(st_nci_se_get_bwi(ndev)); |
158 | } | 158 | } |
159 | kfree_skb(skb); | 159 | kfree_skb(skb); |
160 | } | 160 | } |
161 | 161 | ||
162 | int st21nfcb_hci_load_session(struct nci_dev *ndev) | 162 | int st_nci_hci_load_session(struct nci_dev *ndev) |
163 | { | 163 | { |
164 | int i, j, r; | 164 | int i, j, r; |
165 | struct sk_buff *skb_pipe_list, *skb_pipe_info; | 165 | struct sk_buff *skb_pipe_list, *skb_pipe_info; |
166 | struct st21nfcb_pipe_info *dm_pipe_info; | 166 | struct st_nci_pipe_info *dm_pipe_info; |
167 | u8 pipe_list[] = { ST21NFCB_DM_GETINFO_PIPE_LIST, | 167 | u8 pipe_list[] = { ST_NCI_DM_GETINFO_PIPE_LIST, |
168 | ST21NFCB_TERMINAL_HOST_ID}; | 168 | ST_NCI_TERMINAL_HOST_ID}; |
169 | u8 pipe_info[] = { ST21NFCB_DM_GETINFO_PIPE_INFO, | 169 | u8 pipe_info[] = { ST_NCI_DM_GETINFO_PIPE_INFO, |
170 | ST21NFCB_TERMINAL_HOST_ID, 0}; | 170 | ST_NCI_TERMINAL_HOST_ID, 0}; |
171 | 171 | ||
172 | /* On ST21NFCB device pipes number are dynamics | 172 | /* On ST_NCI device pipes number are dynamics |
173 | * If pipes are already created, hci_dev_up will fail. | 173 | * If pipes are already created, hci_dev_up will fail. |
174 | * Doing a clear all pipe is a bad idea because: | 174 | * Doing a clear all pipe is a bad idea because: |
175 | * - It does useless EEPROM cycling | 175 | * - It does useless EEPROM cycling |
176 | * - It might cause issue for secure elements support | 176 | * - It might cause issue for secure elements support |
177 | * (such as removing connectivity or APDU reader pipe) | 177 | * (such as removing connectivity or APDU reader pipe) |
178 | * A better approach on ST21NFCB is to: | 178 | * A better approach on ST_NCI is to: |
179 | * - get a pipe list for each host. | 179 | * - get a pipe list for each host. |
180 | * (eg: ST21NFCB_HOST_CONTROLLER_ID for now). | 180 | * (eg: ST_NCI_HOST_CONTROLLER_ID for now). |
181 | * (TODO Later on UICC HOST and eSE HOST) | 181 | * (TODO Later on UICC HOST and eSE HOST) |
182 | * - get pipe information | 182 | * - get pipe information |
183 | * - match retrieved pipe list in st21nfcb_gates | 183 | * - match retrieved pipe list in st_nci_gates |
184 | * ST21NFCB_DEVICE_MGNT_GATE is a proprietary gate | 184 | * ST_NCI_DEVICE_MGNT_GATE is a proprietary gate |
185 | * with ST21NFCB_DEVICE_MGNT_PIPE. | 185 | * with ST_NCI_DEVICE_MGNT_PIPE. |
186 | * Pipe can be closed and need to be open. | 186 | * Pipe can be closed and need to be open. |
187 | */ | 187 | */ |
188 | r = nci_hci_connect_gate(ndev, ST21NFCB_HOST_CONTROLLER_ID, | 188 | r = nci_hci_connect_gate(ndev, ST_NCI_HOST_CONTROLLER_ID, |
189 | ST21NFCB_DEVICE_MGNT_GATE, | 189 | ST_NCI_DEVICE_MGNT_GATE, |
190 | ST21NFCB_DEVICE_MGNT_PIPE); | 190 | ST_NCI_DEVICE_MGNT_PIPE); |
191 | if (r < 0) | 191 | if (r < 0) |
192 | goto free_info; | 192 | goto free_info; |
193 | 193 | ||
194 | /* Get pipe list */ | 194 | /* Get pipe list */ |
195 | r = nci_hci_send_cmd(ndev, ST21NFCB_DEVICE_MGNT_GATE, | 195 | r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE, |
196 | ST21NFCB_DM_GETINFO, pipe_list, sizeof(pipe_list), | 196 | ST_NCI_DM_GETINFO, pipe_list, sizeof(pipe_list), |
197 | &skb_pipe_list); | 197 | &skb_pipe_list); |
198 | if (r < 0) | 198 | if (r < 0) |
199 | goto free_info; | 199 | goto free_info; |
@@ -201,8 +201,8 @@ int st21nfcb_hci_load_session(struct nci_dev *ndev) | |||
201 | /* Complete the existing gate_pipe table */ | 201 | /* Complete the existing gate_pipe table */ |
202 | for (i = 0; i < skb_pipe_list->len; i++) { | 202 | for (i = 0; i < skb_pipe_list->len; i++) { |
203 | pipe_info[2] = skb_pipe_list->data[i]; | 203 | pipe_info[2] = skb_pipe_list->data[i]; |
204 | r = nci_hci_send_cmd(ndev, ST21NFCB_DEVICE_MGNT_GATE, | 204 | r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE, |
205 | ST21NFCB_DM_GETINFO, pipe_info, | 205 | ST_NCI_DM_GETINFO, pipe_info, |
206 | sizeof(pipe_info), &skb_pipe_info); | 206 | sizeof(pipe_info), &skb_pipe_info); |
207 | 207 | ||
208 | if (r) | 208 | if (r) |
@@ -217,81 +217,81 @@ int st21nfcb_hci_load_session(struct nci_dev *ndev) | |||
217 | * - destination hid (1byte) | 217 | * - destination hid (1byte) |
218 | * - destination gid (1byte) | 218 | * - destination gid (1byte) |
219 | */ | 219 | */ |
220 | dm_pipe_info = (struct st21nfcb_pipe_info *)skb_pipe_info->data; | 220 | dm_pipe_info = (struct st_nci_pipe_info *)skb_pipe_info->data; |
221 | if (dm_pipe_info->dst_gate_id == ST21NFCB_APDU_READER_GATE && | 221 | if (dm_pipe_info->dst_gate_id == ST_NCI_APDU_READER_GATE && |
222 | dm_pipe_info->src_host_id != ST21NFCB_ESE_HOST_ID) { | 222 | dm_pipe_info->src_host_id != ST_NCI_ESE_HOST_ID) { |
223 | pr_err("Unexpected apdu_reader pipe on host %x\n", | 223 | pr_err("Unexpected apdu_reader pipe on host %x\n", |
224 | dm_pipe_info->src_host_id); | 224 | dm_pipe_info->src_host_id); |
225 | continue; | 225 | continue; |
226 | } | 226 | } |
227 | 227 | ||
228 | for (j = 0; (j < ARRAY_SIZE(st21nfcb_gates)) && | 228 | for (j = 0; (j < ARRAY_SIZE(st_nci_gates)) && |
229 | (st21nfcb_gates[j].gate != dm_pipe_info->dst_gate_id); j++) | 229 | (st_nci_gates[j].gate != dm_pipe_info->dst_gate_id); j++) |
230 | ; | 230 | ; |
231 | 231 | ||
232 | if (j < ARRAY_SIZE(st21nfcb_gates) && | 232 | if (j < ARRAY_SIZE(st_nci_gates) && |
233 | st21nfcb_gates[j].gate == dm_pipe_info->dst_gate_id && | 233 | st_nci_gates[j].gate == dm_pipe_info->dst_gate_id && |
234 | ST21NFCB_DM_IS_PIPE_OPEN(dm_pipe_info->pipe_state)) { | 234 | ST_NCI_DM_IS_PIPE_OPEN(dm_pipe_info->pipe_state)) { |
235 | st21nfcb_gates[j].pipe = pipe_info[2]; | 235 | st_nci_gates[j].pipe = pipe_info[2]; |
236 | 236 | ||
237 | ndev->hci_dev->gate2pipe[st21nfcb_gates[j].gate] = | 237 | ndev->hci_dev->gate2pipe[st_nci_gates[j].gate] = |
238 | st21nfcb_gates[j].pipe; | 238 | st_nci_gates[j].pipe; |
239 | ndev->hci_dev->pipes[st21nfcb_gates[j].pipe].gate = | 239 | ndev->hci_dev->pipes[st_nci_gates[j].pipe].gate = |
240 | st21nfcb_gates[j].gate; | 240 | st_nci_gates[j].gate; |
241 | ndev->hci_dev->pipes[st21nfcb_gates[j].pipe].host = | 241 | ndev->hci_dev->pipes[st_nci_gates[j].pipe].host = |
242 | dm_pipe_info->src_host_id; | 242 | dm_pipe_info->src_host_id; |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | memcpy(ndev->hci_dev->init_data.gates, st21nfcb_gates, | 246 | memcpy(ndev->hci_dev->init_data.gates, st_nci_gates, |
247 | sizeof(st21nfcb_gates)); | 247 | sizeof(st_nci_gates)); |
248 | 248 | ||
249 | free_info: | 249 | free_info: |
250 | kfree_skb(skb_pipe_info); | 250 | kfree_skb(skb_pipe_info); |
251 | kfree_skb(skb_pipe_list); | 251 | kfree_skb(skb_pipe_list); |
252 | return r; | 252 | return r; |
253 | } | 253 | } |
254 | EXPORT_SYMBOL_GPL(st21nfcb_hci_load_session); | 254 | EXPORT_SYMBOL_GPL(st_nci_hci_load_session); |
255 | 255 | ||
256 | static void st21nfcb_hci_admin_event_received(struct nci_dev *ndev, | 256 | static void st_nci_hci_admin_event_received(struct nci_dev *ndev, |
257 | u8 event, struct sk_buff *skb) | 257 | u8 event, struct sk_buff *skb) |
258 | { | 258 | { |
259 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 259 | struct st_nci_info *info = nci_get_drvdata(ndev); |
260 | 260 | ||
261 | switch (event) { | 261 | switch (event) { |
262 | case ST21NFCB_EVT_HOT_PLUG: | 262 | case ST_NCI_EVT_HOT_PLUG: |
263 | if (info->se_info.se_active) { | 263 | if (info->se_info.se_active) { |
264 | if (!ST21NFCB_EVT_HOT_PLUG_IS_INHIBITED(skb)) { | 264 | if (!ST_NCI_EVT_HOT_PLUG_IS_INHIBITED(skb)) { |
265 | del_timer_sync(&info->se_info.se_active_timer); | 265 | del_timer_sync(&info->se_info.se_active_timer); |
266 | info->se_info.se_active = false; | 266 | info->se_info.se_active = false; |
267 | complete(&info->se_info.req_completion); | 267 | complete(&info->se_info.req_completion); |
268 | } else { | 268 | } else { |
269 | mod_timer(&info->se_info.se_active_timer, | 269 | mod_timer(&info->se_info.se_active_timer, |
270 | jiffies + | 270 | jiffies + |
271 | msecs_to_jiffies(ST21NFCB_SE_TO_PIPES)); | 271 | msecs_to_jiffies(ST_NCI_SE_TO_PIPES)); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | break; | 274 | break; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | static int st21nfcb_hci_apdu_reader_event_received(struct nci_dev *ndev, | 278 | static int st_nci_hci_apdu_reader_event_received(struct nci_dev *ndev, |
279 | u8 event, | 279 | u8 event, |
280 | struct sk_buff *skb) | 280 | struct sk_buff *skb) |
281 | { | 281 | { |
282 | int r = 0; | 282 | int r = 0; |
283 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 283 | struct st_nci_info *info = nci_get_drvdata(ndev); |
284 | 284 | ||
285 | pr_debug("apdu reader gate event: %x\n", event); | 285 | pr_debug("apdu reader gate event: %x\n", event); |
286 | 286 | ||
287 | switch (event) { | 287 | switch (event) { |
288 | case ST21NFCB_EVT_TRANSMIT_DATA: | 288 | case ST_NCI_EVT_TRANSMIT_DATA: |
289 | del_timer_sync(&info->se_info.bwi_timer); | 289 | del_timer_sync(&info->se_info.bwi_timer); |
290 | info->se_info.bwi_active = false; | 290 | info->se_info.bwi_active = false; |
291 | info->se_info.cb(info->se_info.cb_context, | 291 | info->se_info.cb(info->se_info.cb_context, |
292 | skb->data, skb->len, 0); | 292 | skb->data, skb->len, 0); |
293 | break; | 293 | break; |
294 | case ST21NFCB_EVT_WTX_REQUEST: | 294 | case ST_NCI_EVT_WTX_REQUEST: |
295 | mod_timer(&info->se_info.bwi_timer, jiffies + | 295 | mod_timer(&info->se_info.bwi_timer, jiffies + |
296 | msecs_to_jiffies(info->se_info.wt_timeout)); | 296 | msecs_to_jiffies(info->se_info.wt_timeout)); |
297 | break; | 297 | break; |
@@ -306,7 +306,7 @@ static int st21nfcb_hci_apdu_reader_event_received(struct nci_dev *ndev, | |||
306 | * <= 0: driver handled the event, skb consumed | 306 | * <= 0: driver handled the event, skb consumed |
307 | * 1: driver does not handle the event, please do standard processing | 307 | * 1: driver does not handle the event, please do standard processing |
308 | */ | 308 | */ |
309 | static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev, | 309 | static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev, |
310 | u8 host, u8 event, | 310 | u8 host, u8 event, |
311 | struct sk_buff *skb) | 311 | struct sk_buff *skb) |
312 | { | 312 | { |
@@ -317,10 +317,10 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev, | |||
317 | pr_debug("connectivity gate event: %x\n", event); | 317 | pr_debug("connectivity gate event: %x\n", event); |
318 | 318 | ||
319 | switch (event) { | 319 | switch (event) { |
320 | case ST21NFCB_EVT_CONNECTIVITY: | 320 | case ST_NCI_EVT_CONNECTIVITY: |
321 | 321 | ||
322 | break; | 322 | break; |
323 | case ST21NFCB_EVT_TRANSACTION: | 323 | case ST_NCI_EVT_TRANSACTION: |
324 | /* According to specification etsi 102 622 | 324 | /* According to specification etsi 102 622 |
325 | * 11.2.2.4 EVT_TRANSACTION Table 52 | 325 | * 11.2.2.4 EVT_TRANSACTION Table 52 |
326 | * Description Tag Length | 326 | * Description Tag Length |
@@ -355,7 +355,7 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev, | |||
355 | return r; | 355 | return r; |
356 | } | 356 | } |
357 | 357 | ||
358 | void st21nfcb_hci_event_received(struct nci_dev *ndev, u8 pipe, | 358 | void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe, |
359 | u8 event, struct sk_buff *skb) | 359 | u8 event, struct sk_buff *skb) |
360 | { | 360 | { |
361 | u8 gate = ndev->hci_dev->pipes[pipe].gate; | 361 | u8 gate = ndev->hci_dev->pipes[pipe].gate; |
@@ -363,32 +363,32 @@ void st21nfcb_hci_event_received(struct nci_dev *ndev, u8 pipe, | |||
363 | 363 | ||
364 | switch (gate) { | 364 | switch (gate) { |
365 | case NCI_HCI_ADMIN_GATE: | 365 | case NCI_HCI_ADMIN_GATE: |
366 | st21nfcb_hci_admin_event_received(ndev, event, skb); | 366 | st_nci_hci_admin_event_received(ndev, event, skb); |
367 | break; | 367 | break; |
368 | case ST21NFCB_APDU_READER_GATE: | 368 | case ST_NCI_APDU_READER_GATE: |
369 | st21nfcb_hci_apdu_reader_event_received(ndev, event, skb); | 369 | st_nci_hci_apdu_reader_event_received(ndev, event, skb); |
370 | break; | 370 | break; |
371 | case ST21NFCB_CONNECTIVITY_GATE: | 371 | case ST_NCI_CONNECTIVITY_GATE: |
372 | st21nfcb_hci_connectivity_event_received(ndev, host, event, | 372 | st_nci_hci_connectivity_event_received(ndev, host, event, |
373 | skb); | 373 | skb); |
374 | break; | 374 | break; |
375 | } | 375 | } |
376 | } | 376 | } |
377 | EXPORT_SYMBOL_GPL(st21nfcb_hci_event_received); | 377 | EXPORT_SYMBOL_GPL(st_nci_hci_event_received); |
378 | 378 | ||
379 | 379 | ||
380 | void st21nfcb_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd, | 380 | void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd, |
381 | struct sk_buff *skb) | 381 | struct sk_buff *skb) |
382 | { | 382 | { |
383 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 383 | struct st_nci_info *info = nci_get_drvdata(ndev); |
384 | u8 gate = ndev->hci_dev->pipes[pipe].gate; | 384 | u8 gate = ndev->hci_dev->pipes[pipe].gate; |
385 | 385 | ||
386 | pr_debug("cmd: %x\n", cmd); | 386 | pr_debug("cmd: %x\n", cmd); |
387 | 387 | ||
388 | switch (cmd) { | 388 | switch (cmd) { |
389 | case NCI_HCI_ANY_OPEN_PIPE: | 389 | case NCI_HCI_ANY_OPEN_PIPE: |
390 | if (gate != ST21NFCB_APDU_READER_GATE && | 390 | if (gate != ST_NCI_APDU_READER_GATE && |
391 | ndev->hci_dev->pipes[pipe].host != ST21NFCB_UICC_HOST_ID) | 391 | ndev->hci_dev->pipes[pipe].host != ST_NCI_UICC_HOST_ID) |
392 | ndev->hci_dev->count_pipes++; | 392 | ndev->hci_dev->count_pipes++; |
393 | 393 | ||
394 | if (ndev->hci_dev->count_pipes == | 394 | if (ndev->hci_dev->count_pipes == |
@@ -401,28 +401,28 @@ void st21nfcb_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd, | |||
401 | break; | 401 | break; |
402 | } | 402 | } |
403 | } | 403 | } |
404 | EXPORT_SYMBOL_GPL(st21nfcb_hci_cmd_received); | 404 | EXPORT_SYMBOL_GPL(st_nci_hci_cmd_received); |
405 | 405 | ||
406 | /* | 406 | /* |
407 | * Remarks: On some early st21nfcb firmware, nci_nfcee_mode_set(0) | 407 | * Remarks: On some early st_nci firmware, nci_nfcee_mode_set(0) |
408 | * is rejected | 408 | * is rejected |
409 | */ | 409 | */ |
410 | static int st21nfcb_nci_control_se(struct nci_dev *ndev, u8 se_idx, | 410 | static int st_nci_control_se(struct nci_dev *ndev, u8 se_idx, |
411 | u8 state) | 411 | u8 state) |
412 | { | 412 | { |
413 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 413 | struct st_nci_info *info = nci_get_drvdata(ndev); |
414 | int r; | 414 | int r; |
415 | struct sk_buff *sk_host_list; | 415 | struct sk_buff *sk_host_list; |
416 | u8 host_id; | 416 | u8 host_id; |
417 | 417 | ||
418 | switch (se_idx) { | 418 | switch (se_idx) { |
419 | case ST21NFCB_UICC_HOST_ID: | 419 | case ST_NCI_UICC_HOST_ID: |
420 | ndev->hci_dev->count_pipes = 0; | 420 | ndev->hci_dev->count_pipes = 0; |
421 | ndev->hci_dev->expected_pipes = ST21NFCB_SE_COUNT_PIPE_UICC; | 421 | ndev->hci_dev->expected_pipes = ST_NCI_SE_COUNT_PIPE_UICC; |
422 | break; | 422 | break; |
423 | case ST21NFCB_ESE_HOST_ID: | 423 | case ST_NCI_ESE_HOST_ID: |
424 | ndev->hci_dev->count_pipes = 0; | 424 | ndev->hci_dev->count_pipes = 0; |
425 | ndev->hci_dev->expected_pipes = ST21NFCB_SE_COUNT_PIPE_EMBEDDED; | 425 | ndev->hci_dev->expected_pipes = ST_NCI_SE_COUNT_PIPE_EMBEDDED; |
426 | break; | 426 | break; |
427 | default: | 427 | default: |
428 | return -EINVAL; | 428 | return -EINVAL; |
@@ -438,7 +438,7 @@ static int st21nfcb_nci_control_se(struct nci_dev *ndev, u8 se_idx, | |||
438 | return r; | 438 | return r; |
439 | 439 | ||
440 | mod_timer(&info->se_info.se_active_timer, jiffies + | 440 | mod_timer(&info->se_info.se_active_timer, jiffies + |
441 | msecs_to_jiffies(ST21NFCB_SE_TO_HOT_PLUG)); | 441 | msecs_to_jiffies(ST_NCI_SE_TO_HOT_PLUG)); |
442 | info->se_info.se_active = true; | 442 | info->se_info.se_active = true; |
443 | 443 | ||
444 | /* Ignore return value and check in any case the host_list */ | 444 | /* Ignore return value and check in any case the host_list */ |
@@ -458,49 +458,49 @@ static int st21nfcb_nci_control_se(struct nci_dev *ndev, u8 se_idx, | |||
458 | 458 | ||
459 | host_id = sk_host_list->data[sk_host_list->len - 1]; | 459 | host_id = sk_host_list->data[sk_host_list->len - 1]; |
460 | kfree_skb(sk_host_list); | 460 | kfree_skb(sk_host_list); |
461 | if (state == ST21NFCB_SE_MODE_ON && host_id == se_idx) | 461 | if (state == ST_NCI_SE_MODE_ON && host_id == se_idx) |
462 | return se_idx; | 462 | return se_idx; |
463 | else if (state == ST21NFCB_SE_MODE_OFF && host_id != se_idx) | 463 | else if (state == ST_NCI_SE_MODE_OFF && host_id != se_idx) |
464 | return se_idx; | 464 | return se_idx; |
465 | 465 | ||
466 | return -1; | 466 | return -1; |
467 | } | 467 | } |
468 | 468 | ||
469 | int st21nfcb_nci_disable_se(struct nci_dev *ndev, u32 se_idx) | 469 | int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx) |
470 | { | 470 | { |
471 | int r; | 471 | int r; |
472 | 472 | ||
473 | pr_debug("st21nfcb_nci_disable_se\n"); | 473 | pr_debug("st_nci_disable_se\n"); |
474 | 474 | ||
475 | if (se_idx == NFC_SE_EMBEDDED) { | 475 | if (se_idx == NFC_SE_EMBEDDED) { |
476 | r = nci_hci_send_event(ndev, ST21NFCB_APDU_READER_GATE, | 476 | r = nci_hci_send_event(ndev, ST_NCI_APDU_READER_GATE, |
477 | ST21NFCB_EVT_SE_END_OF_APDU_TRANSFER, NULL, 0); | 477 | ST_NCI_EVT_SE_END_OF_APDU_TRANSFER, NULL, 0); |
478 | if (r < 0) | 478 | if (r < 0) |
479 | return r; | 479 | return r; |
480 | } | 480 | } |
481 | 481 | ||
482 | return 0; | 482 | return 0; |
483 | } | 483 | } |
484 | EXPORT_SYMBOL_GPL(st21nfcb_nci_disable_se); | 484 | EXPORT_SYMBOL_GPL(st_nci_disable_se); |
485 | 485 | ||
486 | int st21nfcb_nci_enable_se(struct nci_dev *ndev, u32 se_idx) | 486 | int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx) |
487 | { | 487 | { |
488 | int r; | 488 | int r; |
489 | 489 | ||
490 | pr_debug("st21nfcb_nci_enable_se\n"); | 490 | pr_debug("st_nci_enable_se\n"); |
491 | 491 | ||
492 | if (se_idx == ST21NFCB_HCI_HOST_ID_ESE) { | 492 | if (se_idx == ST_NCI_HCI_HOST_ID_ESE) { |
493 | r = nci_hci_send_event(ndev, ST21NFCB_APDU_READER_GATE, | 493 | r = nci_hci_send_event(ndev, ST_NCI_APDU_READER_GATE, |
494 | ST21NFCB_EVT_SE_SOFT_RESET, NULL, 0); | 494 | ST_NCI_EVT_SE_SOFT_RESET, NULL, 0); |
495 | if (r < 0) | 495 | if (r < 0) |
496 | return r; | 496 | return r; |
497 | } | 497 | } |
498 | 498 | ||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | EXPORT_SYMBOL_GPL(st21nfcb_nci_enable_se); | 501 | EXPORT_SYMBOL_GPL(st_nci_enable_se); |
502 | 502 | ||
503 | static int st21nfcb_hci_network_init(struct nci_dev *ndev) | 503 | static int st_nci_hci_network_init(struct nci_dev *ndev) |
504 | { | 504 | { |
505 | struct core_conn_create_dest_spec_params *dest_params; | 505 | struct core_conn_create_dest_spec_params *dest_params; |
506 | struct dest_spec_params spec_params; | 506 | struct dest_spec_params spec_params; |
@@ -519,7 +519,8 @@ static int st21nfcb_hci_network_init(struct nci_dev *ndev) | |||
519 | dest_params->length = sizeof(struct dest_spec_params); | 519 | dest_params->length = sizeof(struct dest_spec_params); |
520 | spec_params.id = ndev->hci_dev->nfcee_id; | 520 | spec_params.id = ndev->hci_dev->nfcee_id; |
521 | spec_params.protocol = NCI_NFCEE_INTERFACE_HCI_ACCESS; | 521 | spec_params.protocol = NCI_NFCEE_INTERFACE_HCI_ACCESS; |
522 | memcpy(dest_params->value, &spec_params, sizeof(struct dest_spec_params)); | 522 | memcpy(dest_params->value, &spec_params, |
523 | sizeof(struct dest_spec_params)); | ||
523 | r = nci_core_conn_create(ndev, NCI_DESTINATION_NFCEE, 1, | 524 | r = nci_core_conn_create(ndev, NCI_DESTINATION_NFCEE, 1, |
524 | sizeof(struct core_conn_create_dest_spec_params) + | 525 | sizeof(struct core_conn_create_dest_spec_params) + |
525 | sizeof(struct dest_spec_params), | 526 | sizeof(struct dest_spec_params), |
@@ -531,15 +532,15 @@ static int st21nfcb_hci_network_init(struct nci_dev *ndev) | |||
531 | if (!conn_info) | 532 | if (!conn_info) |
532 | goto free_dest_params; | 533 | goto free_dest_params; |
533 | 534 | ||
534 | memcpy(ndev->hci_dev->init_data.gates, st21nfcb_gates, | 535 | memcpy(ndev->hci_dev->init_data.gates, st_nci_gates, |
535 | sizeof(st21nfcb_gates)); | 536 | sizeof(st_nci_gates)); |
536 | 537 | ||
537 | /* | 538 | /* |
538 | * Session id must include the driver name + i2c bus addr | 539 | * Session id must include the driver name + i2c bus addr |
539 | * persistent info to discriminate 2 identical chips | 540 | * persistent info to discriminate 2 identical chips |
540 | */ | 541 | */ |
541 | dev_num = find_first_zero_bit(dev_mask, ST21NFCB_NUM_DEVICES); | 542 | dev_num = find_first_zero_bit(dev_mask, ST_NCI_NUM_DEVICES); |
542 | if (dev_num >= ST21NFCB_NUM_DEVICES) { | 543 | if (dev_num >= ST_NCI_NUM_DEVICES) { |
543 | r = -ENODEV; | 544 | r = -ENODEV; |
544 | goto free_dest_params; | 545 | goto free_dest_params; |
545 | } | 546 | } |
@@ -564,72 +565,72 @@ exit: | |||
564 | return r; | 565 | return r; |
565 | } | 566 | } |
566 | 567 | ||
567 | int st21nfcb_nci_discover_se(struct nci_dev *ndev) | 568 | int st_nci_discover_se(struct nci_dev *ndev) |
568 | { | 569 | { |
569 | u8 param[2]; | 570 | u8 param[2]; |
570 | int r; | 571 | int r; |
571 | int se_count = 0; | 572 | int se_count = 0; |
572 | 573 | ||
573 | pr_debug("st21nfcb_nci_discover_se\n"); | 574 | pr_debug("st_nci_discover_se\n"); |
574 | 575 | ||
575 | r = st21nfcb_hci_network_init(ndev); | 576 | r = st_nci_hci_network_init(ndev); |
576 | if (r != 0) | 577 | if (r != 0) |
577 | return r; | 578 | return r; |
578 | 579 | ||
579 | param[0] = ST21NFCB_UICC_HOST_ID; | 580 | param[0] = ST_NCI_UICC_HOST_ID; |
580 | param[1] = ST21NFCB_HCI_HOST_ID_ESE; | 581 | param[1] = ST_NCI_HCI_HOST_ID_ESE; |
581 | r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE, | 582 | r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE, |
582 | NCI_HCI_ADMIN_PARAM_WHITELIST, | 583 | NCI_HCI_ADMIN_PARAM_WHITELIST, |
583 | param, sizeof(param)); | 584 | param, sizeof(param)); |
584 | if (r != NCI_HCI_ANY_OK) | 585 | if (r != NCI_HCI_ANY_OK) |
585 | return r; | 586 | return r; |
586 | 587 | ||
587 | r = st21nfcb_nci_control_se(ndev, ST21NFCB_UICC_HOST_ID, | 588 | r = st_nci_control_se(ndev, ST_NCI_UICC_HOST_ID, |
588 | ST21NFCB_SE_MODE_ON); | 589 | ST_NCI_SE_MODE_ON); |
589 | if (r == ST21NFCB_UICC_HOST_ID) { | 590 | if (r == ST_NCI_UICC_HOST_ID) { |
590 | nfc_add_se(ndev->nfc_dev, ST21NFCB_UICC_HOST_ID, NFC_SE_UICC); | 591 | nfc_add_se(ndev->nfc_dev, ST_NCI_UICC_HOST_ID, NFC_SE_UICC); |
591 | se_count++; | 592 | se_count++; |
592 | } | 593 | } |
593 | 594 | ||
594 | /* Try to enable eSE in order to check availability */ | 595 | /* Try to enable eSE in order to check availability */ |
595 | r = st21nfcb_nci_control_se(ndev, ST21NFCB_HCI_HOST_ID_ESE, | 596 | r = st_nci_control_se(ndev, ST_NCI_HCI_HOST_ID_ESE, |
596 | ST21NFCB_SE_MODE_ON); | 597 | ST_NCI_SE_MODE_ON); |
597 | if (r == ST21NFCB_HCI_HOST_ID_ESE) { | 598 | if (r == ST_NCI_HCI_HOST_ID_ESE) { |
598 | nfc_add_se(ndev->nfc_dev, ST21NFCB_HCI_HOST_ID_ESE, | 599 | nfc_add_se(ndev->nfc_dev, ST_NCI_HCI_HOST_ID_ESE, |
599 | NFC_SE_EMBEDDED); | 600 | NFC_SE_EMBEDDED); |
600 | se_count++; | 601 | se_count++; |
601 | st21nfcb_se_get_atr(ndev); | 602 | st_nci_se_get_atr(ndev); |
602 | } | 603 | } |
603 | 604 | ||
604 | return !se_count; | 605 | return !se_count; |
605 | } | 606 | } |
606 | EXPORT_SYMBOL_GPL(st21nfcb_nci_discover_se); | 607 | EXPORT_SYMBOL_GPL(st_nci_discover_se); |
607 | 608 | ||
608 | int st21nfcb_nci_se_io(struct nci_dev *ndev, u32 se_idx, | 609 | int st_nci_se_io(struct nci_dev *ndev, u32 se_idx, |
609 | u8 *apdu, size_t apdu_length, | 610 | u8 *apdu, size_t apdu_length, |
610 | se_io_cb_t cb, void *cb_context) | 611 | se_io_cb_t cb, void *cb_context) |
611 | { | 612 | { |
612 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 613 | struct st_nci_info *info = nci_get_drvdata(ndev); |
613 | 614 | ||
614 | pr_debug("\n"); | 615 | pr_debug("\n"); |
615 | 616 | ||
616 | switch (se_idx) { | 617 | switch (se_idx) { |
617 | case ST21NFCB_HCI_HOST_ID_ESE: | 618 | case ST_NCI_HCI_HOST_ID_ESE: |
618 | info->se_info.cb = cb; | 619 | info->se_info.cb = cb; |
619 | info->se_info.cb_context = cb_context; | 620 | info->se_info.cb_context = cb_context; |
620 | mod_timer(&info->se_info.bwi_timer, jiffies + | 621 | mod_timer(&info->se_info.bwi_timer, jiffies + |
621 | msecs_to_jiffies(info->se_info.wt_timeout)); | 622 | msecs_to_jiffies(info->se_info.wt_timeout)); |
622 | info->se_info.bwi_active = true; | 623 | info->se_info.bwi_active = true; |
623 | return nci_hci_send_event(ndev, ST21NFCB_APDU_READER_GATE, | 624 | return nci_hci_send_event(ndev, ST_NCI_APDU_READER_GATE, |
624 | ST21NFCB_EVT_TRANSMIT_DATA, apdu, | 625 | ST_NCI_EVT_TRANSMIT_DATA, apdu, |
625 | apdu_length); | 626 | apdu_length); |
626 | default: | 627 | default: |
627 | return -ENODEV; | 628 | return -ENODEV; |
628 | } | 629 | } |
629 | } | 630 | } |
630 | EXPORT_SYMBOL(st21nfcb_nci_se_io); | 631 | EXPORT_SYMBOL(st_nci_se_io); |
631 | 632 | ||
632 | static void st21nfcb_se_wt_timeout(unsigned long data) | 633 | static void st_nci_se_wt_timeout(unsigned long data) |
633 | { | 634 | { |
634 | /* | 635 | /* |
635 | * No answer from the secure element | 636 | * No answer from the secure element |
@@ -642,7 +643,7 @@ static void st21nfcb_se_wt_timeout(unsigned long data) | |||
642 | */ | 643 | */ |
643 | /* hardware reset managed through VCC_UICC_OUT power supply */ | 644 | /* hardware reset managed through VCC_UICC_OUT power supply */ |
644 | u8 param = 0x01; | 645 | u8 param = 0x01; |
645 | struct st21nfcb_nci_info *info = (struct st21nfcb_nci_info *) data; | 646 | struct st_nci_info *info = (struct st_nci_info *) data; |
646 | 647 | ||
647 | pr_debug("\n"); | 648 | pr_debug("\n"); |
648 | 649 | ||
@@ -650,19 +651,19 @@ static void st21nfcb_se_wt_timeout(unsigned long data) | |||
650 | 651 | ||
651 | if (!info->se_info.xch_error) { | 652 | if (!info->se_info.xch_error) { |
652 | info->se_info.xch_error = true; | 653 | info->se_info.xch_error = true; |
653 | nci_hci_send_event(info->ndlc->ndev, ST21NFCB_APDU_READER_GATE, | 654 | nci_hci_send_event(info->ndlc->ndev, ST_NCI_APDU_READER_GATE, |
654 | ST21NFCB_EVT_SE_SOFT_RESET, NULL, 0); | 655 | ST_NCI_EVT_SE_SOFT_RESET, NULL, 0); |
655 | } else { | 656 | } else { |
656 | info->se_info.xch_error = false; | 657 | info->se_info.xch_error = false; |
657 | nci_hci_send_event(info->ndlc->ndev, ST21NFCB_DEVICE_MGNT_GATE, | 658 | nci_hci_send_event(info->ndlc->ndev, ST_NCI_DEVICE_MGNT_GATE, |
658 | ST21NFCB_EVT_SE_HARD_RESET, ¶m, 1); | 659 | ST_NCI_EVT_SE_HARD_RESET, ¶m, 1); |
659 | } | 660 | } |
660 | info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME); | 661 | info->se_info.cb(info->se_info.cb_context, NULL, 0, -ETIME); |
661 | } | 662 | } |
662 | 663 | ||
663 | static void st21nfcb_se_activation_timeout(unsigned long data) | 664 | static void st_nci_se_activation_timeout(unsigned long data) |
664 | { | 665 | { |
665 | struct st21nfcb_nci_info *info = (struct st21nfcb_nci_info *) data; | 666 | struct st_nci_info *info = (struct st_nci_info *) data; |
666 | 667 | ||
667 | pr_debug("\n"); | 668 | pr_debug("\n"); |
668 | 669 | ||
@@ -671,35 +672,35 @@ static void st21nfcb_se_activation_timeout(unsigned long data) | |||
671 | complete(&info->se_info.req_completion); | 672 | complete(&info->se_info.req_completion); |
672 | } | 673 | } |
673 | 674 | ||
674 | int st21nfcb_se_init(struct nci_dev *ndev) | 675 | int st_nci_se_init(struct nci_dev *ndev) |
675 | { | 676 | { |
676 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 677 | struct st_nci_info *info = nci_get_drvdata(ndev); |
677 | 678 | ||
678 | init_completion(&info->se_info.req_completion); | 679 | init_completion(&info->se_info.req_completion); |
679 | /* initialize timers */ | 680 | /* initialize timers */ |
680 | init_timer(&info->se_info.bwi_timer); | 681 | init_timer(&info->se_info.bwi_timer); |
681 | info->se_info.bwi_timer.data = (unsigned long)info; | 682 | info->se_info.bwi_timer.data = (unsigned long)info; |
682 | info->se_info.bwi_timer.function = st21nfcb_se_wt_timeout; | 683 | info->se_info.bwi_timer.function = st_nci_se_wt_timeout; |
683 | info->se_info.bwi_active = false; | 684 | info->se_info.bwi_active = false; |
684 | 685 | ||
685 | init_timer(&info->se_info.se_active_timer); | 686 | init_timer(&info->se_info.se_active_timer); |
686 | info->se_info.se_active_timer.data = (unsigned long)info; | 687 | info->se_info.se_active_timer.data = (unsigned long)info; |
687 | info->se_info.se_active_timer.function = | 688 | info->se_info.se_active_timer.function = |
688 | st21nfcb_se_activation_timeout; | 689 | st_nci_se_activation_timeout; |
689 | info->se_info.se_active = false; | 690 | info->se_info.se_active = false; |
690 | 691 | ||
691 | info->se_info.xch_error = false; | 692 | info->se_info.xch_error = false; |
692 | 693 | ||
693 | info->se_info.wt_timeout = | 694 | info->se_info.wt_timeout = |
694 | ST21NFCB_BWI_TO_TIMEOUT(ST21NFCB_ATR_DEFAULT_BWI); | 695 | ST_NCI_BWI_TO_TIMEOUT(ST_NCI_ATR_DEFAULT_BWI); |
695 | 696 | ||
696 | return 0; | 697 | return 0; |
697 | } | 698 | } |
698 | EXPORT_SYMBOL(st21nfcb_se_init); | 699 | EXPORT_SYMBOL(st_nci_se_init); |
699 | 700 | ||
700 | void st21nfcb_se_deinit(struct nci_dev *ndev) | 701 | void st_nci_se_deinit(struct nci_dev *ndev) |
701 | { | 702 | { |
702 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | 703 | struct st_nci_info *info = nci_get_drvdata(ndev); |
703 | 704 | ||
704 | if (info->se_info.bwi_active) | 705 | if (info->se_info.bwi_active) |
705 | del_timer_sync(&info->se_info.bwi_timer); | 706 | del_timer_sync(&info->se_info.bwi_timer); |
@@ -709,5 +710,5 @@ void st21nfcb_se_deinit(struct nci_dev *ndev) | |||
709 | info->se_info.se_active = false; | 710 | info->se_info.se_active = false; |
710 | info->se_info.bwi_active = false; | 711 | info->se_info.bwi_active = false; |
711 | } | 712 | } |
712 | EXPORT_SYMBOL(st21nfcb_se_deinit); | 713 | EXPORT_SYMBOL(st_nci_se_deinit); |
713 | 714 | ||
diff --git a/drivers/nfc/st-nci/st-nci_se.h b/drivers/nfc/st-nci/st-nci_se.h new file mode 100644 index 000000000000..ea66e879d67f --- /dev/null +++ b/drivers/nfc/st-nci/st-nci_se.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Secure Element Driver for STMicroelectronics NFC NCI Chip | ||
3 | * | ||
4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | #ifndef __LOCAL_ST_NCI_SE_H_ | ||
19 | #define __LOCAL_ST_NCI_SE_H_ | ||
20 | |||
21 | /* | ||
22 | * ref ISO7816-3 chap 8.1. the initial character TS is followed by a | ||
23 | * sequence of at most 32 characters. | ||
24 | */ | ||
25 | #define ST_NCI_ESE_MAX_LENGTH 33 | ||
26 | #define ST_NCI_HCI_HOST_ID_ESE 0xc0 | ||
27 | |||
28 | struct st_nci_se_info { | ||
29 | u8 atr[ST_NCI_ESE_MAX_LENGTH]; | ||
30 | struct completion req_completion; | ||
31 | |||
32 | struct timer_list bwi_timer; | ||
33 | int wt_timeout; /* in msecs */ | ||
34 | bool bwi_active; | ||
35 | |||
36 | struct timer_list se_active_timer; | ||
37 | bool se_active; | ||
38 | |||
39 | bool xch_error; | ||
40 | |||
41 | se_io_cb_t cb; | ||
42 | void *cb_context; | ||
43 | }; | ||
44 | |||
45 | int st_nci_se_init(struct nci_dev *ndev); | ||
46 | void st_nci_se_deinit(struct nci_dev *ndev); | ||
47 | |||
48 | int st_nci_discover_se(struct nci_dev *ndev); | ||
49 | int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx); | ||
50 | int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx); | ||
51 | int st_nci_se_io(struct nci_dev *ndev, u32 se_idx, | ||
52 | u8 *apdu, size_t apdu_length, | ||
53 | se_io_cb_t cb, void *cb_context); | ||
54 | int st_nci_hci_load_session(struct nci_dev *ndev); | ||
55 | void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe, | ||
56 | u8 event, struct sk_buff *skb); | ||
57 | void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd, | ||
58 | struct sk_buff *skb); | ||
59 | |||
60 | |||
61 | #endif /* __LOCAL_ST_NCI_SE_H_ */ | ||
diff --git a/drivers/nfc/st21nfcb/Kconfig b/drivers/nfc/st21nfcb/Kconfig deleted file mode 100644 index e0322dd03a70..000000000000 --- a/drivers/nfc/st21nfcb/Kconfig +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | config NFC_ST21NFCB | ||
2 | tristate "STMicroelectronics ST21NFCB NFC driver" | ||
3 | depends on NFC_NCI | ||
4 | default n | ||
5 | ---help--- | ||
6 | STMicroelectronics ST21NFCB core driver. It implements the chipset | ||
7 | NCI logic and hooks into the NFC kernel APIs. Physical layers will | ||
8 | register against it. | ||
9 | |||
10 | To compile this driver as a module, choose m here. The module will | ||
11 | be called st21nfcb. | ||
12 | Say N if unsure. | ||
13 | |||
14 | config NFC_ST21NFCB_I2C | ||
15 | tristate "NFC ST21NFCB i2c support" | ||
16 | depends on NFC_ST21NFCB && I2C | ||
17 | ---help--- | ||
18 | This module adds support for the STMicroelectronics st21nfcb i2c interface. | ||
19 | Select this if your platform is using the i2c bus. | ||
20 | |||
21 | If you choose to build a module, it'll be called st21nfcb_i2c. | ||
22 | Say N if unsure. | ||
diff --git a/drivers/nfc/st21nfcb/Makefile b/drivers/nfc/st21nfcb/Makefile deleted file mode 100644 index ce659a9e5a1a..000000000000 --- a/drivers/nfc/st21nfcb/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for ST21NFCB NCI based NFC driver | ||
3 | # | ||
4 | |||
5 | st21nfcb_nci-objs = ndlc.o st21nfcb.o st21nfcb_se.o | ||
6 | obj-$(CONFIG_NFC_ST21NFCB) += st21nfcb_nci.o | ||
7 | |||
8 | st21nfcb_i2c-objs = i2c.o | ||
9 | obj-$(CONFIG_NFC_ST21NFCB_I2C) += st21nfcb_i2c.o | ||
diff --git a/drivers/nfc/st21nfcb/st21nfcb.c b/drivers/nfc/st21nfcb/st21nfcb.c deleted file mode 100644 index a16c3a3d3fff..000000000000 --- a/drivers/nfc/st21nfcb/st21nfcb.c +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | /* | ||
2 | * NCI based Driver for STMicroelectronics NFC Chip | ||
3 | * | ||
4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #include <linux/module.h> | ||
20 | #include <linux/nfc.h> | ||
21 | #include <net/nfc/nci.h> | ||
22 | #include <net/nfc/nci_core.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <linux/delay.h> | ||
25 | |||
26 | #include "st21nfcb.h" | ||
27 | #include "st21nfcb_se.h" | ||
28 | |||
29 | #define DRIVER_DESC "NCI NFC driver for ST21NFCB" | ||
30 | |||
31 | #define ST21NFCB_NCI1_X_PROPRIETARY_ISO15693 0x83 | ||
32 | |||
33 | static int st21nfcb_nci_init(struct nci_dev *ndev) | ||
34 | { | ||
35 | struct nci_mode_set_cmd cmd; | ||
36 | |||
37 | cmd.cmd_type = ST21NFCB_NCI_SET_NFC_MODE; | ||
38 | cmd.mode = 1; | ||
39 | |||
40 | return nci_prop_cmd(ndev, ST21NFCB_NCI_CORE_PROP, | ||
41 | sizeof(struct nci_mode_set_cmd), (__u8 *)&cmd); | ||
42 | } | ||
43 | |||
44 | static int st21nfcb_nci_open(struct nci_dev *ndev) | ||
45 | { | ||
46 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | ||
47 | int r; | ||
48 | |||
49 | if (test_and_set_bit(ST21NFCB_NCI_RUNNING, &info->flags)) | ||
50 | return 0; | ||
51 | |||
52 | r = ndlc_open(info->ndlc); | ||
53 | if (r) | ||
54 | clear_bit(ST21NFCB_NCI_RUNNING, &info->flags); | ||
55 | |||
56 | return r; | ||
57 | } | ||
58 | |||
59 | static int st21nfcb_nci_close(struct nci_dev *ndev) | ||
60 | { | ||
61 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | ||
62 | |||
63 | if (!test_bit(ST21NFCB_NCI_RUNNING, &info->flags)) | ||
64 | return 0; | ||
65 | |||
66 | ndlc_close(info->ndlc); | ||
67 | |||
68 | clear_bit(ST21NFCB_NCI_RUNNING, &info->flags); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int st21nfcb_nci_send(struct nci_dev *ndev, struct sk_buff *skb) | ||
74 | { | ||
75 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | ||
76 | |||
77 | skb->dev = (void *)ndev; | ||
78 | |||
79 | if (!test_bit(ST21NFCB_NCI_RUNNING, &info->flags)) | ||
80 | return -EBUSY; | ||
81 | |||
82 | return ndlc_send(info->ndlc, skb); | ||
83 | } | ||
84 | |||
85 | static __u32 st21nfcb_nci_get_rfprotocol(struct nci_dev *ndev, | ||
86 | __u8 rf_protocol) | ||
87 | { | ||
88 | return rf_protocol == ST21NFCB_NCI1_X_PROPRIETARY_ISO15693 ? | ||
89 | NFC_PROTO_ISO15693_MASK : 0; | ||
90 | } | ||
91 | |||
92 | static int st21nfcb_nci_prop_rsp_packet(struct nci_dev *ndev, | ||
93 | struct sk_buff *skb) | ||
94 | { | ||
95 | __u8 status = skb->data[0]; | ||
96 | |||
97 | nci_req_complete(ndev, status); | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static struct nci_prop_ops st21nfcb_nci_prop_ops[] = { | ||
102 | { | ||
103 | .opcode = nci_opcode_pack(NCI_GID_PROPRIETARY, | ||
104 | ST21NFCB_NCI_CORE_PROP), | ||
105 | .rsp = st21nfcb_nci_prop_rsp_packet, | ||
106 | }, | ||
107 | }; | ||
108 | |||
109 | static struct nci_ops st21nfcb_nci_ops = { | ||
110 | .init = st21nfcb_nci_init, | ||
111 | .open = st21nfcb_nci_open, | ||
112 | .close = st21nfcb_nci_close, | ||
113 | .send = st21nfcb_nci_send, | ||
114 | .get_rfprotocol = st21nfcb_nci_get_rfprotocol, | ||
115 | .discover_se = st21nfcb_nci_discover_se, | ||
116 | .enable_se = st21nfcb_nci_enable_se, | ||
117 | .disable_se = st21nfcb_nci_disable_se, | ||
118 | .se_io = st21nfcb_nci_se_io, | ||
119 | .hci_load_session = st21nfcb_hci_load_session, | ||
120 | .hci_event_received = st21nfcb_hci_event_received, | ||
121 | .hci_cmd_received = st21nfcb_hci_cmd_received, | ||
122 | .prop_ops = st21nfcb_nci_prop_ops, | ||
123 | .n_prop_ops = ARRAY_SIZE(st21nfcb_nci_prop_ops), | ||
124 | }; | ||
125 | |||
126 | int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, | ||
127 | int phy_tailroom) | ||
128 | { | ||
129 | struct st21nfcb_nci_info *info; | ||
130 | int r; | ||
131 | u32 protocols; | ||
132 | |||
133 | info = devm_kzalloc(ndlc->dev, | ||
134 | sizeof(struct st21nfcb_nci_info), GFP_KERNEL); | ||
135 | if (!info) | ||
136 | return -ENOMEM; | ||
137 | |||
138 | protocols = NFC_PROTO_JEWEL_MASK | ||
139 | | NFC_PROTO_MIFARE_MASK | ||
140 | | NFC_PROTO_FELICA_MASK | ||
141 | | NFC_PROTO_ISO14443_MASK | ||
142 | | NFC_PROTO_ISO14443_B_MASK | ||
143 | | NFC_PROTO_ISO15693_MASK | ||
144 | | NFC_PROTO_NFC_DEP_MASK; | ||
145 | |||
146 | ndlc->ndev = nci_allocate_device(&st21nfcb_nci_ops, protocols, | ||
147 | phy_headroom, phy_tailroom); | ||
148 | if (!ndlc->ndev) { | ||
149 | pr_err("Cannot allocate nfc ndev\n"); | ||
150 | return -ENOMEM; | ||
151 | } | ||
152 | info->ndlc = ndlc; | ||
153 | |||
154 | nci_set_drvdata(ndlc->ndev, info); | ||
155 | |||
156 | r = nci_register_device(ndlc->ndev); | ||
157 | if (r) { | ||
158 | pr_err("Cannot register nfc device to nci core\n"); | ||
159 | nci_free_device(ndlc->ndev); | ||
160 | return r; | ||
161 | } | ||
162 | |||
163 | return st21nfcb_se_init(ndlc->ndev); | ||
164 | } | ||
165 | EXPORT_SYMBOL_GPL(st21nfcb_nci_probe); | ||
166 | |||
167 | void st21nfcb_nci_remove(struct nci_dev *ndev) | ||
168 | { | ||
169 | struct st21nfcb_nci_info *info = nci_get_drvdata(ndev); | ||
170 | |||
171 | ndlc_close(info->ndlc); | ||
172 | |||
173 | nci_unregister_device(ndev); | ||
174 | nci_free_device(ndev); | ||
175 | } | ||
176 | EXPORT_SYMBOL_GPL(st21nfcb_nci_remove); | ||
177 | |||
178 | MODULE_LICENSE("GPL"); | ||
179 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
diff --git a/drivers/nfc/st21nfcb/st21nfcb_se.h b/drivers/nfc/st21nfcb/st21nfcb_se.h deleted file mode 100644 index 52a323872bea..000000000000 --- a/drivers/nfc/st21nfcb/st21nfcb_se.h +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* | ||
2 | * NCI based Driver for STMicroelectronics NFC Chip | ||
3 | * | ||
4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | #ifndef __LOCAL_ST21NFCB_SE_H_ | ||
19 | #define __LOCAL_ST21NFCB_SE_H_ | ||
20 | |||
21 | /* | ||
22 | * ref ISO7816-3 chap 8.1. the initial character TS is followed by a | ||
23 | * sequence of at most 32 characters. | ||
24 | */ | ||
25 | #define ST21NFCB_ESE_MAX_LENGTH 33 | ||
26 | #define ST21NFCB_HCI_HOST_ID_ESE 0xc0 | ||
27 | |||
28 | struct st21nfcb_se_info { | ||
29 | u8 atr[ST21NFCB_ESE_MAX_LENGTH]; | ||
30 | struct completion req_completion; | ||
31 | |||
32 | struct timer_list bwi_timer; | ||
33 | int wt_timeout; /* in msecs */ | ||
34 | bool bwi_active; | ||
35 | |||
36 | struct timer_list se_active_timer; | ||
37 | bool se_active; | ||
38 | |||
39 | bool xch_error; | ||
40 | |||
41 | se_io_cb_t cb; | ||
42 | void *cb_context; | ||
43 | }; | ||
44 | |||
45 | int st21nfcb_se_init(struct nci_dev *ndev); | ||
46 | void st21nfcb_se_deinit(struct nci_dev *ndev); | ||
47 | |||
48 | int st21nfcb_nci_discover_se(struct nci_dev *ndev); | ||
49 | int st21nfcb_nci_enable_se(struct nci_dev *ndev, u32 se_idx); | ||
50 | int st21nfcb_nci_disable_se(struct nci_dev *ndev, u32 se_idx); | ||
51 | int st21nfcb_nci_se_io(struct nci_dev *ndev, u32 se_idx, | ||
52 | u8 *apdu, size_t apdu_length, | ||
53 | se_io_cb_t cb, void *cb_context); | ||
54 | int st21nfcb_hci_load_session(struct nci_dev *ndev); | ||
55 | void st21nfcb_hci_event_received(struct nci_dev *ndev, u8 pipe, | ||
56 | u8 event, struct sk_buff *skb); | ||
57 | void st21nfcb_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd, | ||
58 | struct sk_buff *skb); | ||
59 | |||
60 | |||
61 | #endif /* __LOCAL_ST21NFCB_NCI_H_ */ | ||
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st-nci.h index b023373d9874..d9d400a297bd 100644 --- a/include/linux/platform_data/st21nfcb.h +++ b/include/linux/platform_data/st-nci.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver include for the ST21NFCB NFC chip. | 2 | * Driver include for ST NCI NFC chip family. |
3 | * | 3 | * |
4 | * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved. | 4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -16,14 +16,14 @@ | |||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef _ST21NFCB_NCI_H_ | 19 | #ifndef _ST_NCI_H_ |
20 | #define _ST21NFCB_NCI_H_ | 20 | #define _ST_NCI_H_ |
21 | 21 | ||
22 | #define ST21NFCB_NCI_DRIVER_NAME "st21nfcb_nci" | 22 | #define ST_NCI_DRIVER_NAME "st_nci" |
23 | 23 | ||
24 | struct st21nfcb_nfc_platform_data { | 24 | struct st_nci_nfc_platform_data { |
25 | unsigned int gpio_reset; | 25 | unsigned int gpio_reset; |
26 | unsigned int irq_polarity; | 26 | unsigned int irq_polarity; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #endif /* _ST21NFCB_NCI_H_ */ | 29 | #endif /* _ST_NCI_H_ */ |
diff --git a/include/linux/platform_data/st_nci.h b/include/linux/platform_data/st_nci.h new file mode 100644 index 000000000000..d9d400a297bd --- /dev/null +++ b/include/linux/platform_data/st_nci.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Driver include for ST NCI NFC chip family. | ||
3 | * | ||
4 | * Copyright (C) 2014-2015 STMicroelectronics SAS. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #ifndef _ST_NCI_H_ | ||
20 | #define _ST_NCI_H_ | ||
21 | |||
22 | #define ST_NCI_DRIVER_NAME "st_nci" | ||
23 | |||
24 | struct st_nci_nfc_platform_data { | ||
25 | unsigned int gpio_reset; | ||
26 | unsigned int irq_polarity; | ||
27 | }; | ||
28 | |||
29 | #endif /* _ST_NCI_H_ */ | ||