From patchwork Tue Feb 24 10:01:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Dolca X-Patchwork-Id: 5871381 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DB779F36A for ; Tue, 24 Feb 2015 10:06:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB96320640 for ; Tue, 24 Feb 2015 10:06:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A677F20650 for ; Tue, 24 Feb 2015 10:06:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753205AbbBXKFj (ORCPT ); Tue, 24 Feb 2015 05:05:39 -0500 Received: from mga02.intel.com ([134.134.136.20]:49799 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752971AbbBXKCd (ORCPT ); Tue, 24 Feb 2015 05:02:33 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 24 Feb 2015 02:02:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,637,1418112000"; d="scan'208";a="689920857" Received: from rdolca-desk.rb.intel.com ([10.237.104.134]) by orsmga002.jf.intel.com with ESMTP; 24 Feb 2015 02:02:28 -0800 From: Robert Dolca To: linux-nfc@lists.01.org, Lauro Ramos Venancio , Aloisio Almeida Jr , Samuel Ortiz Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Robert Dolca Subject: [PATCH 3/8] NFC: NCI: Adds NCI init and reset API for drivers Date: Tue, 24 Feb 2015 12:01:47 +0200 Message-Id: <1424772112-27399-4-git-send-email-robert.dolca@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424772112-27399-1-git-send-email-robert.dolca@intel.com> References: <1424772112-27399-1-git-send-email-robert.dolca@intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to communicate with the device during the setup phase, the driver may need to initialize the device. After the setup is done the driver should reset the device to leave it in the same state that it was before the setup function call. Signed-off-by: Robert Dolca --- include/net/nfc/nci_core.h | 2 ++ net/nfc/nci/core.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index 34a6e09..4358d0a 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h @@ -314,6 +314,8 @@ static inline void *nci_get_drvdata(struct nci_dev *ndev) return ndev->driver_data; } +int nci_init(struct nci_dev *ndev); +int nci_reset(struct nci_dev *ndev); void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb); void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb); void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb); diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 9605b9c..317b94b 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -458,6 +458,20 @@ static int nci_dev_down(struct nfc_dev *nfc_dev) return nci_close_device(ndev); } +int nci_init(struct nci_dev *ndev) +{ + return __nci_request(ndev, nci_init_req, 0, + msecs_to_jiffies(NCI_INIT_TIMEOUT)); +} +EXPORT_SYMBOL(nci_init); + +int nci_reset(struct nci_dev *ndev) +{ + return __nci_request(ndev, nci_reset_req, 0, + msecs_to_jiffies(NCI_RESET_TIMEOUT)); +} +EXPORT_SYMBOL(nci_reset); + int nci_set_config(struct nci_dev *ndev, __u8 id, size_t len, __u8 *val) { struct nci_set_config_param param;