From patchwork Tue Oct 3 22:13:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9983593 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 ABA34602B8 for ; Tue, 3 Oct 2017 22:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A31DA1FE95 for ; Tue, 3 Oct 2017 22:14:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 976B11FF13; Tue, 3 Oct 2017 22:14: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=-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 1A0F31FE95 for ; Tue, 3 Oct 2017 22:14:22 +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=dXfuReeF6zujmPZBnnXxVM+5Ge68vZaX1bHT8pzt0jc=; b=knA 6bQ2A/S9aZYZvGn3AEb/27DDLPHi4M88hyFnA2yOW4t5zxcDRbrUoP1hKUx6ZVLx7Us09GB+uv3sq Ut2WRpofllDwq/gLkPjtM0roOgqu7qo2ATomICUOQNW/6CbknFRumIxCCktVq3oLjXLbC1+xYO31p S30k0qHPhl43AwJIKi/FDMAkHSHY75cXBGH+hQJdZAqwDhkcQiEQCS/mSMLJZAhxgITxcFOApMQa7 68XsCL26bpEv+LMwVGYqC3geKOXymrcXLx6If3d9lHQdPrcXruJFE0qOt9qpIQLy81yx05D/hM22S R50Yt3wBRSPK1oTVvEl9xUm/j/x157Q==; 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 1dzVS8-0004mQ-TG; Tue, 03 Oct 2017 22:14:12 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzVS5-0004jz-PN for ath10k@lists.infradead.org; Tue, 03 Oct 2017 22:14:11 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 073DB40A5A2; Tue, 3 Oct 2017 15:13:49 -0700 (PDT) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Subject: [PATCH v2] ath10k: Retry pci probe on failure. Date: Tue, 3 Oct 2017 15:13:46 -0700 Message-Id: <1507068826-14677-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-20171003_151409_855809_7B2C8C7D X-CRM114-Status: GOOD ( 10.38 ) 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 --- v2: Change to mdelay instead of udelay to fix compile issue on ARM. 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 77beb13..0861f7f 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3487,8 +3487,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; @@ -3672,6 +3672,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); + mdelay(10); /* 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);