aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Ricard <christophe-h.ricard@st.com>2015-10-26 00:55:22 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2015-10-26 00:55:22 -0400
commitf5876627715e3584db379a0549f8ce6f3f06e2bc (patch)
tree7828cb85ecfb4c76249b261bc62ef607686dcca7
parenta06347c04c13e380afce0c9816df51f00b83faf1 (diff)
NFC: st-nci: Align st-nci driver with other nfc driver
Align st-nci driver with other NFC drivers: - Remove st-nci_ prefix - Merge se.h in st-nci.h Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/st-nci/core.c1
-rw-r--r--drivers/nfc/st-nci/se.c1
-rw-r--r--drivers/nfc/st-nci/se.h61
-rw-r--r--drivers/nfc/st-nci/st-nci.h40
4 files changed, 39 insertions, 64 deletions
diff --git a/drivers/nfc/st-nci/core.c b/drivers/nfc/st-nci/core.c
index 5443caa0d55e..07bfc0f00050 100644
--- a/drivers/nfc/st-nci/core.c
+++ b/drivers/nfc/st-nci/core.c
@@ -24,7 +24,6 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25 25
26#include "st-nci.h" 26#include "st-nci.h"
27#include "se.h"
28 27
29#define DRIVER_DESC "NCI NFC driver for ST_NCI" 28#define DRIVER_DESC "NCI NFC driver for ST_NCI"
30 29
diff --git a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c
index bb8d1dd98c85..4acb945ac252 100644
--- a/drivers/nfc/st-nci/se.c
+++ b/drivers/nfc/st-nci/se.c
@@ -23,7 +23,6 @@
23#include <net/nfc/nci_core.h> 23#include <net/nfc/nci_core.h>
24 24
25#include "st-nci.h" 25#include "st-nci.h"
26#include "se.h"
27 26
28struct st_nci_pipe_info { 27struct st_nci_pipe_info {
29 u8 pipe_state; 28 u8 pipe_state;
diff --git a/drivers/nfc/st-nci/se.h b/drivers/nfc/st-nci/se.h
deleted file mode 100644
index ea66e879d67f..000000000000
--- a/drivers/nfc/st-nci/se.h
+++ /dev/null
@@ -1,61 +0,0 @@
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
28struct 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
45int st_nci_se_init(struct nci_dev *ndev);
46void st_nci_se_deinit(struct nci_dev *ndev);
47
48int st_nci_discover_se(struct nci_dev *ndev);
49int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx);
50int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx);
51int 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);
54int st_nci_hci_load_session(struct nci_dev *ndev);
55void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe,
56 u8 event, struct sk_buff *skb);
57void 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/st-nci/st-nci.h b/drivers/nfc/st-nci/st-nci.h
index b39b8cc63dcb..90c21eab3058 100644
--- a/drivers/nfc/st-nci/st-nci.h
+++ b/drivers/nfc/st-nci/st-nci.h
@@ -19,7 +19,6 @@
19#ifndef __LOCAL_ST_NCI_H_ 19#ifndef __LOCAL_ST_NCI_H_
20#define __LOCAL_ST_NCI_H_ 20#define __LOCAL_ST_NCI_H_
21 21
22#include "se.h"
23#include "ndlc.h" 22#include "ndlc.h"
24 23
25/* Define private flags: */ 24/* Define private flags: */
@@ -28,6 +27,13 @@
28#define ST_NCI_CORE_PROP 0x01 27#define ST_NCI_CORE_PROP 0x01
29#define ST_NCI_SET_NFC_MODE 0x02 28#define ST_NCI_SET_NFC_MODE 0x02
30 29
30/*
31 * ref ISO7816-3 chap 8.1. the initial character TS is followed by a
32 * sequence of at most 32 characters.
33 */
34#define ST_NCI_ESE_MAX_LENGTH 33
35#define ST_NCI_HCI_HOST_ID_ESE 0xc0
36
31struct nci_mode_set_cmd { 37struct nci_mode_set_cmd {
32 u8 cmd_type; 38 u8 cmd_type;
33 u8 mode; 39 u8 mode;
@@ -37,6 +43,23 @@ struct nci_mode_set_rsp {
37 u8 status; 43 u8 status;
38} __packed; 44} __packed;
39 45
46struct st_nci_se_info {
47 u8 atr[ST_NCI_ESE_MAX_LENGTH];
48 struct completion req_completion;
49
50 struct timer_list bwi_timer;
51 int wt_timeout; /* in msecs */
52 bool bwi_active;
53
54 struct timer_list se_active_timer;
55 bool se_active;
56
57 bool xch_error;
58
59 se_io_cb_t cb;
60 void *cb_context;
61};
62
40struct st_nci_info { 63struct st_nci_info {
41 struct llt_ndlc *ndlc; 64 struct llt_ndlc *ndlc;
42 unsigned long flags; 65 unsigned long flags;
@@ -47,4 +70,19 @@ void st_nci_remove(struct nci_dev *ndev);
47int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, 70int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
48 int phy_tailroom); 71 int phy_tailroom);
49 72
73int st_nci_se_init(struct nci_dev *ndev);
74void st_nci_se_deinit(struct nci_dev *ndev);
75
76int st_nci_discover_se(struct nci_dev *ndev);
77int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx);
78int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx);
79int st_nci_se_io(struct nci_dev *ndev, u32 se_idx,
80 u8 *apdu, size_t apdu_length,
81 se_io_cb_t cb, void *cb_context);
82int st_nci_hci_load_session(struct nci_dev *ndev);
83void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe,
84 u8 event, struct sk_buff *skb);
85void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd,
86 struct sk_buff *skb);
87
50#endif /* __LOCAL_ST_NCI_H_ */ 88#endif /* __LOCAL_ST_NCI_H_ */