Lines Matching refs:ndev

126 static u8 st_nci_se_get_bwi(struct nci_dev *ndev)  in st_nci_se_get_bwi()  argument
130 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_se_get_bwi()
145 static void st_nci_se_get_atr(struct nci_dev *ndev) in st_nci_se_get_atr() argument
147 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_se_get_atr()
151 r = nci_hci_get_param(ndev, ST_NCI_APDU_READER_GATE, in st_nci_se_get_atr()
160 ST_NCI_BWI_TO_TIMEOUT(st_nci_se_get_bwi(ndev)); in st_nci_se_get_atr()
165 int st_nci_hci_load_session(struct nci_dev *ndev) in st_nci_hci_load_session() argument
191 r = nci_hci_connect_gate(ndev, ST_NCI_HOST_CONTROLLER_ID, in st_nci_hci_load_session()
198 r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE, in st_nci_hci_load_session()
207 r = nci_hci_send_cmd(ndev, ST_NCI_DEVICE_MGNT_GATE, in st_nci_hci_load_session()
239 ndev->hci_dev->init_data.gates[j].pipe = pipe_info[2]; in st_nci_hci_load_session()
241 ndev->hci_dev->gate2pipe[st_nci_gates[j].gate] = in st_nci_hci_load_session()
243 ndev->hci_dev->pipes[pipe_info[2]].gate = in st_nci_hci_load_session()
245 ndev->hci_dev->pipes[pipe_info[2]].host = in st_nci_hci_load_session()
255 r = nci_hci_connect_gate(ndev, ST_NCI_HOST_CONTROLLER_ID, in st_nci_hci_load_session()
264 static void st_nci_hci_admin_event_received(struct nci_dev *ndev, in st_nci_hci_admin_event_received() argument
267 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_hci_admin_event_received()
284 nfc_err(&ndev->nfc_dev->dev, "Unexpected event on admin gate\n"); in st_nci_hci_admin_event_received()
288 static int st_nci_hci_apdu_reader_event_received(struct nci_dev *ndev, in st_nci_hci_apdu_reader_event_received() argument
293 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_hci_apdu_reader_event_received()
309 nfc_err(&ndev->nfc_dev->dev, "Unexpected event on apdu reader gate\n"); in st_nci_hci_apdu_reader_event_received()
322 static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev, in st_nci_hci_connectivity_event_received() argument
327 struct device *dev = &ndev->nfc_dev->dev; in st_nci_hci_connectivity_event_received()
362 r = nfc_se_transaction(ndev->nfc_dev, host, transaction); in st_nci_hci_connectivity_event_received()
365 nfc_err(&ndev->nfc_dev->dev, "Unexpected event on connectivity gate\n"); in st_nci_hci_connectivity_event_received()
372 void st_nci_hci_event_received(struct nci_dev *ndev, u8 pipe, in st_nci_hci_event_received() argument
375 u8 gate = ndev->hci_dev->pipes[pipe].gate; in st_nci_hci_event_received()
376 u8 host = ndev->hci_dev->pipes[pipe].host; in st_nci_hci_event_received()
380 st_nci_hci_admin_event_received(ndev, event, skb); in st_nci_hci_event_received()
383 st_nci_hci_apdu_reader_event_received(ndev, event, skb); in st_nci_hci_event_received()
386 st_nci_hci_connectivity_event_received(ndev, host, event, skb); in st_nci_hci_event_received()
389 st_nci_hci_loopback_event_received(ndev, event, skb); in st_nci_hci_event_received()
396 void st_nci_hci_cmd_received(struct nci_dev *ndev, u8 pipe, u8 cmd, in st_nci_hci_cmd_received() argument
399 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_hci_cmd_received()
400 u8 gate = ndev->hci_dev->pipes[pipe].gate; in st_nci_hci_cmd_received()
407 ndev->hci_dev->pipes[pipe].host != ST_NCI_UICC_HOST_ID) in st_nci_hci_cmd_received()
408 ndev->hci_dev->count_pipes++; in st_nci_hci_cmd_received()
410 if (ndev->hci_dev->count_pipes == in st_nci_hci_cmd_received()
411 ndev->hci_dev->expected_pipes) { in st_nci_hci_cmd_received()
414 ndev->hci_dev->count_pipes = 0; in st_nci_hci_cmd_received()
422 static int st_nci_control_se(struct nci_dev *ndev, u8 se_idx, in st_nci_control_se() argument
425 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_control_se()
432 ndev->hci_dev->count_pipes = 0; in st_nci_control_se()
433 ndev->hci_dev->expected_pipes = ST_NCI_SE_COUNT_PIPE_UICC; in st_nci_control_se()
436 ndev->hci_dev->count_pipes = 0; in st_nci_control_se()
437 ndev->hci_dev->expected_pipes = ST_NCI_SE_COUNT_PIPE_EMBEDDED; in st_nci_control_se()
448 r = nci_nfcee_mode_set(ndev, se_idx, state); in st_nci_control_se()
468 r = nci_hci_get_param(ndev, NCI_HCI_ADMIN_GATE, in st_nci_control_se()
486 int st_nci_disable_se(struct nci_dev *ndev, u32 se_idx) in st_nci_disable_se() argument
497 r = st_nci_control_se(ndev, se_idx, ST_NCI_SE_MODE_OFF); in st_nci_disable_se()
501 r = nci_hci_send_event(ndev, ST_NCI_APDU_READER_GATE, in st_nci_disable_se()
512 int st_nci_enable_se(struct nci_dev *ndev, u32 se_idx) in st_nci_enable_se() argument
523 r = st_nci_control_se(ndev, se_idx, ST_NCI_SE_MODE_ON); in st_nci_enable_se()
525 st_nci_se_get_atr(ndev); in st_nci_enable_se()
526 r = nci_hci_send_event(ndev, ST_NCI_APDU_READER_GATE, in st_nci_enable_se()
535 nfc_remove_se(ndev->nfc_dev, se_idx); in st_nci_enable_se()
543 static int st_nci_hci_network_init(struct nci_dev *ndev) in st_nci_hci_network_init() argument
545 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_hci_network_init()
561 spec_params.id = ndev->hci_dev->nfcee_id; in st_nci_hci_network_init()
565 r = nci_core_conn_create(ndev, NCI_DESTINATION_NFCEE, 1, in st_nci_hci_network_init()
572 conn_info = ndev->hci_dev->conn_info; in st_nci_hci_network_init()
576 ndev->hci_dev->init_data.gate_count = ARRAY_SIZE(st_nci_gates); in st_nci_hci_network_init()
577 memcpy(ndev->hci_dev->init_data.gates, st_nci_gates, in st_nci_hci_network_init()
590 scnprintf(ndev->hci_dev->init_data.session_id, in st_nci_hci_network_init()
591 sizeof(ndev->hci_dev->init_data.session_id), in st_nci_hci_network_init()
594 r = nci_hci_dev_session_init(ndev); in st_nci_hci_network_init()
604 r = nci_nfcee_mode_set(ndev, ndev->hci_dev->conn_info->id, in st_nci_hci_network_init()
607 r = nci_nfcee_mode_set(ndev, ndev->hci_dev->conn_info->id, in st_nci_hci_network_init()
617 int st_nci_discover_se(struct nci_dev *ndev) in st_nci_discover_se() argument
622 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_discover_se()
626 r = st_nci_hci_network_init(ndev); in st_nci_discover_se()
646 r = nci_hci_set_param(ndev, NCI_HCI_ADMIN_GATE, in st_nci_discover_se()
654 nfc_add_se(ndev->nfc_dev, ST_NCI_UICC_HOST_ID, NFC_SE_UICC); in st_nci_discover_se()
659 nfc_add_se(ndev->nfc_dev, ST_NCI_ESE_HOST_ID, NFC_SE_EMBEDDED); in st_nci_discover_se()
667 int st_nci_se_io(struct nci_dev *ndev, u32 se_idx, in st_nci_se_io() argument
671 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_se_io()
682 return nci_hci_send_event(ndev, ST_NCI_APDU_READER_GATE, in st_nci_se_io()
712 nci_hci_send_event(info->ndlc->ndev, ST_NCI_APDU_READER_GATE, in st_nci_se_wt_timeout()
716 nci_hci_send_event(info->ndlc->ndev, ST_NCI_DEVICE_MGNT_GATE, in st_nci_se_wt_timeout()
733 int st_nci_se_init(struct nci_dev *ndev, struct st_nci_se_status *se_status) in st_nci_se_init() argument
735 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_se_init()
761 void st_nci_se_deinit(struct nci_dev *ndev) in st_nci_se_deinit() argument
763 struct st_nci_info *info = nci_get_drvdata(ndev); in st_nci_se_deinit()