From patchwork Thu Feb 21 16:21:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10824339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB7881399 for ; Thu, 21 Feb 2019 16:22:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B44F8319AF for ; Thu, 21 Feb 2019 16:22:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B255E319E3; Thu, 21 Feb 2019 16:22:18 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5AF89319AF for ; Thu, 21 Feb 2019 16:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=brUu8fHK8N+/BdvugmqKrqPi8f1YDm2a3xhcAN1IzXQ=; b=QyHqOp8EoO6DbT3gikYkO5mQmF WcAmUKq2iFhK9MBUgJLujby/gMGFCsDsOXoa1btZnRE45a707mzD7oKbgxnu7V6Wuejz8l6PKnZkJ UO5jYyO21a17NjHvs+U09J6j8SvD6fS8xXrBQFxmWqzitqsDYBzRkRVb+zIFs+dQeIW0MsMPKYpuV vwE5rcrYCdcPsCq9ltHQLI1YbVZgvqlbNfcGExkfo90WFJkzO1DL7+PqabyPQ7JBmao+bFNRAOpY+ 6AuJLvUIv1m/QYovz3Ym7uUz370ogaECEAYvn5ro0fTvu19SCjr2vcuSn57z8ywja46gisQrvnFYy gJ6sitMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwr72-0002MG-Vo; Thu, 21 Feb 2019 16:22:17 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwr6v-0002By-AS for ath10k@lists.infradead.org; Thu, 21 Feb 2019 16:22:12 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BF0A560F5E; Thu, 21 Feb 2019 16:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1550766129; bh=DDs6j/F8yOv6tSIvgbDGoBA8/v5XDogrxOMJI3Vq3IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iYQpX4n+n4GwMYotrGUq8VShQHDvDNot8YjfoRL6aR1GIIWBXw7bqgZ7+IkYy2VsA QVkPkC5FrqaOSvLeD0pm/dAxR5dFuzCBFI+th2OBE91TWhc1G2e+HNFWy0r7LBZIFl 2Ss6V0Kd8adYefeNKJ7TuKyRiEGTyF7IHomhYrT0= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5FC9360F2F; Thu, 21 Feb 2019 16:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1550766127; bh=DDs6j/F8yOv6tSIvgbDGoBA8/v5XDogrxOMJI3Vq3IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXqHF0yB1TEvgJ7QMeUnLY1wdGWZfoDfoNSPtZGvGQrX16uMObk9ydTBMS3MX/5mC dDL0A6TY0CN4mROX+CHmaU7IJFMUd8ovcB/uOGc8eSJ7BWeLRRNOA2haSyr7BB5PqO k7t0u4oCl7tAPFnnWqsURoZfP6W/6tnGK0f3D9To= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5FC9360F2F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: ath10k@lists.infradead.org Subject: [PATCH 3/4] ath10k: sdio: reset chip on power_down() Date: Thu, 21 Feb 2019 18:21:57 +0200 Message-Id: <1550766118-31703-4-git-send-email-kvalo@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550766118-31703-1-git-send-email-kvalo@codeaurora.org> References: <1550766118-31703-1-git-send-email-kvalo@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190221_082209_589261_E4CA9F03 X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Wen Gong MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wen Gong The target device needs to be reset during power_down(), otherwise only the first power_up() will work. And as ath10k calls power_up() during driver initialisation the driver would be otherwise unusable. Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00005-QCARMSWP-1. Signed-off-by: Wen Gong Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/sdio.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index d62502f386f2..fae56c67766f 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -1382,6 +1382,12 @@ static int ath10k_sdio_hif_power_up(struct ath10k *ar, ath10k_dbg(ar, ATH10K_DBG_BOOT, "sdio power on\n"); + ret = ath10k_sdio_config(ar); + if (ret) { + ath10k_err(ar, "failed to config sdio: %d\n", ret); + return ret; + } + sdio_claim_host(func); ret = sdio_enable_func(func); @@ -1419,11 +1425,19 @@ static void ath10k_sdio_hif_power_down(struct ath10k *ar) /* Disable the card */ sdio_claim_host(ar_sdio->func); + ret = sdio_disable_func(ar_sdio->func); - sdio_release_host(ar_sdio->func); + if (ret) { + ath10k_warn(ar, "unable to disable sdio function: %d\n", ret); + sdio_release_host(ar_sdio->func); + return; + } + ret = mmc_hw_reset(ar_sdio->func->card->host); if (ret) - ath10k_warn(ar, "unable to disable sdio function: %d\n", ret); + ath10k_warn(ar, "unable to reset sdio: %d\n", ret); + + sdio_release_host(ar_sdio->func); ar_sdio->is_disabled = true; } @@ -2028,12 +2042,6 @@ static int ath10k_sdio_probe(struct sdio_func *func, ath10k_sdio_set_mbox_info(ar); - ret = ath10k_sdio_config(ar); - if (ret) { - ath10k_err(ar, "failed to config sdio: %d\n", ret); - goto err_free_wq; - } - bus_params.dev_type = ATH10K_DEV_TYPE_HL; /* TODO: don't know yet how to get chip_id with SDIO */ bus_params.chip_id = 0;