From patchwork Tue Sep 26 20:23:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9972713 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 860056037E for ; Tue, 26 Sep 2017 20:25:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C36928F92 for ; Tue, 26 Sep 2017 20:25:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 712F528F89; Tue, 26 Sep 2017 20:25:05 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 EFB0028F9F for ; Tue, 26 Sep 2017 20:25:04 +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: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:In-Reply-To: References:List-Owner; bh=W1S5Wgvrh9maBcezPdtZZTm6oj7pbLVf2Kg0WBImkcc=; b=jEx n1QC5EThfAVn/ND0tQt8P6ZG8RU0JWzVP5WKeWf89NCdHAvlALlvcFNDvJLQ5x4oysJk1rhRdbWU3 vI5dYbrRrY5ro8vcaAZ7BudxnJPcq/MKYubx+NwRArVNxSJa5CWZr2J1efsCReOg/JOotOF5iKlh7 a1aQz1xCXn/QA6DWpIo3tkIuRNyLQpQZOadk8BLJIxyrlFUqnhGyuZW53dQTUYf9xcCKs5N9qqnwS faxmHSwHUd39BIGEpVzdL9/nHs3HA1F3A1ZH7OPcnTV1i9E2gFoBUnWTvPhH0x4tBOUAa0kaCTBTI L09/Tncbr3GWr/y987EreEZcUPyHLpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dwwOz-0000qf-Pc; Tue, 26 Sep 2017 20:24:21 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dwwOx-0000SF-3B for ath10k@lists.infradead.org; Tue, 26 Sep 2017 20:24:20 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 3501540A339; Tue, 26 Sep 2017 13:23:58 -0700 (PDT) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Subject: [PATCH] ath10k: Retry pci probe on failure. Date: Tue, 26 Sep 2017 13:23:55 -0700 Message-Id: <1506457435-26945-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170926_132419_179417_D73BF8FC X-CRM114-Status: UNSURE ( 9.88 ) X-CRM114-Notice: Please train this message. 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: Ben Greear , ath10k@lists.infradead.org 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: Ben Greear This works around a problem we see when sometimes the wifi NIC does not respond the first time. This seems to happen especially often on some of the 9984 NICs in mid-range platforms. Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/pci.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index e0a7b338..8f3c5b1 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3492,8 +3492,8 @@ static const struct ath10k_bus_ops ath10k_pci_bus_ops = { .get_num_banks = ath10k_pci_get_num_banks, }; -static int ath10k_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *pci_dev) +static int __ath10k_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *pci_dev) { int ret = 0; struct ath10k *ar; @@ -3668,6 +3668,22 @@ static int ath10k_pci_probe(struct pci_dev *pdev, return ret; } +static int ath10k_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *pci_dev) +{ + int cnt = 0; + int rv; + do { + rv = __ath10k_pci_probe(pdev, pci_dev); + if (rv == 0) + return rv; + pr_err("ath10k: failed to probe PCI : %d, retry-count: %d\n", rv, cnt); + udelay(10000); /* let the ath10k firmware gerbil take a small break */ + } while (cnt++ < 10); + return rv; +} + + static void ath10k_pci_remove(struct pci_dev *pdev) { struct ath10k *ar = pci_get_drvdata(pdev);