From patchwork Wed Apr 5 07:06:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 9663103 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DDC5602B8 for ; Wed, 5 Apr 2017 07:10:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D99E28514 for ; Wed, 5 Apr 2017 07:10:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3245F28532; Wed, 5 Apr 2017 07:10:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85A8F28514 for ; Wed, 5 Apr 2017 07:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbdDEHKT (ORCPT ); Wed, 5 Apr 2017 03:10:19 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:52114 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752702AbdDEHKS (ORCPT ); Wed, 5 Apr 2017 03:10:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1491376218; x=1522912218; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VvrNiIYhkYh8Wam25GrXGXc98EUKHFnQsYhAoES3V9Q=; b=By2lKpFZP0jyOeZtaohmf71JoTduLWchZ2YG9cBnIkdwqYZe1zA4+F8l lLMLkcp8o19hQ7XhsP8l1Zhxlc/VxfuEt/HNSEt7GUVujVyVc70nWedYr J4B4SqnQmGPuHfJmF7A1GLuSg3x34X7ui3x1ARqBtgsgxDTHT3FTNw1lE M=; X-IronPort-AV: E=Sophos;i="5.36,277,1486454400"; d="scan'208";a="276077414" Received: from unknown (HELO Ironmsg04-L.qualcomm.com) ([10.53.140.111]) by wolverine01.qualcomm.com with ESMTP; 05 Apr 2017 00:07:05 -0700 X-IronPort-AV: E=McAfee;i="5800,7501,8488"; a="1322595803" X-MGA-submission: =?us-ascii?q?MDHvY9t/PJUyb08YltkyMaK/i6ThuNXpS6EwTi?= =?us-ascii?q?iFGhXpX/EZfl1Q8ZHeWEn/H94YA1wFa0SAxJf83961E0dIkPEJdggTh+?= =?us-ascii?q?Qu63n4Dtxzr3QuFA8s2lxRGibf5n4aCZq1AYiQRyKtLaVfyDUqZ+Uf9u?= =?us-ascii?q?Ef?= Received: from nasanexm01e.na.qualcomm.com ([10.85.0.31]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 05 Apr 2017 00:07:04 -0700 Received: from euamsexm01a.eu.qualcomm.com (10.251.127.40) by NASANEXM01E.na.qualcomm.com (10.85.0.31) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 5 Apr 2017 00:07:04 -0700 Received: from potku.adurom.net (10.80.80.8) by euamsexm01a.eu.qualcomm.com (10.251.127.40) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 5 Apr 2017 09:06:59 +0200 Subject: [PATCH 3/7] ath10k: add ath10k_sdio_read() From: Kalle Valo To: CC: Date: Wed, 5 Apr 2017 10:06:53 +0300 Message-ID: <149137601370.4898.4600249077985000688.stgit@potku.adurom.net> In-Reply-To: <149137591893.4898.2318291094351440261.stgit@potku.adurom.net> References: <149137591893.4898.2318291094351440261.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01B.na.qualcomm.com (10.85.0.82) To euamsexm01a.eu.qualcomm.com (10.251.127.40) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/sdio.c | 40 +++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index 56728d44dd12..bbd8317de861 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -343,6 +343,31 @@ static int ath10k_sdio_read32(struct ath10k *ar, u32 addr, u32 *val) return ret; } +static int ath10k_sdio_read(struct ath10k *ar, u32 addr, void *buf, size_t len) +{ + struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + struct sdio_func *func = ar_sdio->func; + int ret; + + sdio_claim_host(func); + + ret = sdio_memcpy_fromio(func, buf, addr, len); + if (ret) { + ath10k_warn(ar, "failed to read from address 0x%x: %d\n", + addr, ret); + goto out; + } + + ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio read addr 0x%x buf 0x%p len %zu\n", + addr, buf, len); + ath10k_dbg_dump(ar, ATH10K_DBG_SDIO_DUMP, NULL, "sdio read ", buf, len); + +out: + sdio_release_host(func); + + return ret; +} + /* HIF mbox functions */ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar, @@ -859,11 +884,8 @@ static int ath10k_sdio_mbox_read_int_status(struct ath10k *ar, * will yield us the value of different int status * registers and the lookahead registers. */ - ret = ath10k_sdio_read_write_sync(ar, - MBOX_HOST_INT_STATUS_ADDRESS, - (u8 *)irq_proc_reg, - sizeof(*irq_proc_reg), - HIF_RD_SYNC_BYTE_INC); + ret = ath10k_sdio_read(ar, MBOX_HOST_INT_STATUS_ADDRESS, + irq_proc_reg, sizeof(*irq_proc_reg)); if (ret) goto out; @@ -1175,9 +1197,7 @@ static int ath10k_sdio_bmi_exchange_msg(struct ath10k *ar, /* We always read from the start of the mbox address */ addr = ar_sdio->mbox_info.htc_addr; - ret = ath10k_sdio_read_write_sync(ar, addr, ar_sdio->bmi_buf, - *resp_len, - HIF_RD_SYNC_BYTE_INC); + ret = ath10k_sdio_read(ar, addr, ar_sdio->bmi_buf, *resp_len); if (ret) { ath10k_warn(ar, "unable to read the bmi data from the device: %d\n", @@ -1538,9 +1558,7 @@ static int ath10k_sdio_hif_diag_read(struct ath10k *ar, u32 address, void *buf, } /* read the data */ - ret = ath10k_sdio_read_write_sync(ar, MBOX_WINDOW_DATA_ADDRESS, - (u8 *)buf, buf_len, - HIF_RD_SYNC_BYTE_INC); + ret = ath10k_sdio_read(ar, MBOX_WINDOW_DATA_ADDRESS, buf, buf_len); if (ret) { ath10k_warn(ar, "failed to read from mbox window data addrress: %d\n", ret);