From patchwork Fri Jan 16 11:20:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5647411 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E1E88C058D for ; Fri, 16 Jan 2015 11:21:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14E99201ED for ; Fri, 16 Jan 2015 11:21:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A3C9201EC for ; Fri, 16 Jan 2015 11:21:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YC4y2-0006F2-TZ; Fri, 16 Jan 2015 11:21:30 +0000 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YC4xy-00065V-Sa for ath10k@lists.infradead.org; Fri, 16 Jan 2015 11:21:28 +0000 Received: by mail-wi0-f173.google.com with SMTP id r20so1575563wiv.0 for ; Fri, 16 Jan 2015 03:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=rbBsQoAQvfxBIqQYSlskifxrwkVlxgG5XE39GC/9RI8=; b=Tdz4KI/vDIpbsCyG6TgV/WrY4xxOkhVSEdaIn1FSm6FsrkkMhqboq9TZV9Me63ocnG VrsFh2l0NfbnRSsv5k0eXt5pKwlLZMo1fUx0PJOJX0kCz2fsK5f3X2NoNS3HPipadIrL D/NTK9TWLPMFEY74ChaACppHfJlGvLjgBQQRM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rbBsQoAQvfxBIqQYSlskifxrwkVlxgG5XE39GC/9RI8=; b=EOHbb6ht/lmIYNp+Y5xZoMYnPIYs4mnQtW45APwfP9gtZoabhjlGntX4JMnpLSgdhG HmAdvKjhSw+Pg7CaBBKf3K4tIURHoyb68+bRg8s92a8VMji47Z1LNu7HdMLJgh20N1Y8 5BFtJGYEeLmnD28ug7fjGRi2IDscF4CZkuzz4nbvT2zTHXqE9tz4CplVE3kMHYyb7iTP qXGikjvs2bdJDL8+WYcYEGSDkr8dXBLrofY9DUB47dXaaiVbTZ4gF3RyLGUQ5F6Be5Dc OmTcI97uwk2aJSL6gA80GFZ5pQIojHUhlu7VVG2r9GOXElZhZ6hd/VUwUO+IIBHb3U4Y HYbA== X-Gm-Message-State: ALoCoQkca3zEcT/kuGmGVkrheedeX/tnBRkCULziIDIUk6QIm2qtLnugPn4GZdk+Z8AP7eJYVny42pnGdsutEotZRutBX0cH0UzU7VoNwkTF85R3FvrPUmlzCN5kSYD1FoqOcDCTWNJcHVgZ0ZbC4hF1CmTopgpgcEJq9fjKNHyf1ggnLlXSySI= X-Received: by 10.194.143.12 with SMTP id sa12mr27960140wjb.101.1421407263930; Fri, 16 Jan 2015 03:21:03 -0800 (PST) Received: from bob.homerouter.cpe (apn-46-76-65-212.dynamic.gprs.plus.pl. [46.76.65.212]) by mx.google.com with ESMTPSA id i3sm5669843wjw.2.2015.01.16.03.21.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jan 2015 03:21:03 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 1/3] ath10k: reset chip before reading chip_id in probe Date: Fri, 16 Jan 2015 12:20:35 +0100 Message-Id: <1421407237-24159-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150116_032127_110049_C62BC6BF X-CRM114-Status: UNSURE ( 9.44 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 There are some very rare cases with some hardware configuration that the device doesn't init quickly enough in which case reading chip_id yielded 0. This caused driver to subsequently fail to setup the device. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/pci.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 3b40a86..6a512fb 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -2544,18 +2544,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev, goto err_release; } - chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); - if (chip_id == 0xffffffff) { - ath10k_err(ar, "failed to get chip id\n"); - goto err_sleep; - } - - if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) { - ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n", - pdev->device, chip_id); - goto err_sleep; - } - ret = ath10k_pci_alloc_pipes(ar); if (ret) { ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", @@ -2582,6 +2570,24 @@ static int ath10k_pci_probe(struct pci_dev *pdev, goto err_deinit_irq; } + ret = ath10k_pci_chip_reset(ar); + if (ret) { + ath10k_err(ar, "failed to reset chip: %d\n", ret); + goto err_free_irq; + } + + chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); + if (chip_id == 0xffffffff) { + ath10k_err(ar, "failed to get chip id\n"); + goto err_free_irq; + } + + if (!ath10k_pci_chip_is_supported(pdev->device, chip_id)) { + ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n", + pdev->device, chip_id); + goto err_sleep; + } + ath10k_pci_sleep(ar); ret = ath10k_core_register(ar, chip_id);