Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6010725ybc; Wed, 27 Nov 2019 13:21:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzbZ9Z04kAkcJn2IBtzmWRhOhoIPc/6Wo3IvgRduC9KrurF4W5i1Hhps0kccv5j8bt+VjBg X-Received: by 2002:a17:906:374d:: with SMTP id e13mr9454363ejc.129.1574889662943; Wed, 27 Nov 2019 13:21:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574889662; cv=none; d=google.com; s=arc-20160816; b=oX0/e9gXFOUbWHbnBBDFIHGCAqVpXI1WNBdO6D9TwmCFNg1BpD8ybb5ftylsphrSIe 6WIGXRm5paCqHV7TEGXomv/lLj8C5Gh5pTb/Y9KPuJsOSBpBdUjgzlVcRYPFqhAMzOt3 0NpYNTBdDC7q9oJvquggCp29PIAisaIPD5vFb3LG16CnDGtfPxmG3sx2ktzDkrzUJ9mP TKPiqAI9pYvHl2tVKsm2Oed4NjxuSkSWEU5RMkgHoWiPpBCEqzifB9vPr1phDPCQ/aYR UkEiCCKTXb22/coH2F29I0UAYRyfiSLstV2ioRM+L4FnTl6nApfbPZDOlqnjH2PcPwl6 Pakw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OgHsXnbntyV4EI7RIObgRZ7V8UBTXw3HDDuMlutR+Lw=; b=GDnMWGpfsrfffORrZkIZWiy4Y9BZ9NTijs6KMEIqLxAuCzAX2x+rXQqHGRP1h9ByOq k1SKcN+oweQl1mvpszbfax2hgklj0hExonLHxiM+jEAwIOdvzGFv/BzA3+YWyRbm48fB e4dj7qRjwpqrnh9L71fS90WHo6sEJ8Osd/IvX4m7TCM66d1uJdYk5R4aKa83l7pHsiQL 3XsKhzLK7reKGHGAoXpoljbtxN22+nSQfPkpA2XL3H0KtzHB59LpdL0Cm869t/Ik88pQ 4UIL9UEzhLwDUoIZyxEI+wkVzLUAGhXbjbtwlvLRKnJCCytiBz+A9CzTUcTWQ67gqBXa vUGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WkqSmkcG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gt1si1858342ejb.144.2019.11.27.13.20.39; Wed, 27 Nov 2019 13:21:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WkqSmkcG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730964AbfK0VMs (ORCPT + 99 others); Wed, 27 Nov 2019 16:12:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:43860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731430AbfK0VMo (ORCPT ); Wed, 27 Nov 2019 16:12:44 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 321CB215F1; Wed, 27 Nov 2019 21:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574889163; bh=zCgDrU9ezIbzq7CMalImPFPEn0zCQPijFbbT/nGqanM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WkqSmkcGrwxNvmvwyM/No4Q0f4V8n9Ny57HvShTygMAfxOsNLAVKK3nW51yIJ34f2 BAI2okHkr5EoSsSuTOQnkgG4fTJEHaaFUPCWOe2ZeRaG9+8HjWtHqwosAZt6t4H9Nq ZOYkkIBvrAy+aNUZlHTkZoSyR1hnXIf9VNxRXurE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Lamparter , Kalle Valo Subject: [PATCH 5.4 05/66] ath10k: restore QCA9880-AR1A (v1) detection Date: Wed, 27 Nov 2019 21:32:00 +0100 Message-Id: <20191127202642.423138310@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127202632.536277063@linuxfoundation.org> References: <20191127202632.536277063@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian Lamparter commit f8914a14623a79b73f72b2b1ee4cd9b2cb91b735 upstream. This patch restores the old behavior that read the chip_id on the QCA988x before resetting the chip. This needs to be done in this order since the unsupported QCA988x AR1A chips fall off the bus when resetted. Otherwise the next MMIO Op after the reset causes a BUS ERROR and panic. Cc: stable@vger.kernel.org Fixes: 1a7fecb766c8 ("ath10k: reset chip before reading chip_id in probe") Signed-off-by: Christian Lamparter Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath10k/pci.c | 36 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3490,7 +3490,7 @@ static int ath10k_pci_probe(struct pci_d struct ath10k_pci *ar_pci; enum ath10k_hw_rev hw_rev; struct ath10k_bus_params bus_params = {}; - bool pci_ps; + bool pci_ps, is_qca988x = false; int (*pci_soft_reset)(struct ath10k *ar); int (*pci_hard_reset)(struct ath10k *ar); u32 (*targ_cpu_to_ce_addr)(struct ath10k *ar, u32 addr); @@ -3500,6 +3500,7 @@ static int ath10k_pci_probe(struct pci_d case QCA988X_2_0_DEVICE_ID: hw_rev = ATH10K_HW_QCA988X; pci_ps = false; + is_qca988x = true; pci_soft_reset = ath10k_pci_warm_reset; pci_hard_reset = ath10k_pci_qca988x_chip_reset; targ_cpu_to_ce_addr = ath10k_pci_qca988x_targ_cpu_to_ce_addr; @@ -3619,25 +3620,34 @@ static int ath10k_pci_probe(struct pci_d goto err_deinit_irq; } + bus_params.dev_type = ATH10K_DEV_TYPE_LL; + bus_params.link_can_suspend = true; + /* Read CHIP_ID before reset to catch QCA9880-AR1A v1 devices that + * fall off the bus during chip_reset. These chips have the same pci + * device id as the QCA9880 BR4A or 2R4E. So that's why the check. + */ + if (is_qca988x) { + bus_params.chip_id = + ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); + if (bus_params.chip_id != 0xffffffff) { + if (!ath10k_pci_chip_is_supported(pdev->device, + bus_params.chip_id)) + goto err_unsupported; + } + } + ret = ath10k_pci_chip_reset(ar); if (ret) { ath10k_err(ar, "failed to reset chip: %d\n", ret); goto err_free_irq; } - bus_params.dev_type = ATH10K_DEV_TYPE_LL; - bus_params.link_can_suspend = true; bus_params.chip_id = ath10k_pci_soc_read32(ar, SOC_CHIP_ID_ADDRESS); - if (bus_params.chip_id == 0xffffffff) { - ath10k_err(ar, "failed to get chip id\n"); - goto err_free_irq; - } + if (bus_params.chip_id == 0xffffffff) + goto err_unsupported; - if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) { - ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n", - pdev->device, bus_params.chip_id); + if (!ath10k_pci_chip_is_supported(pdev->device, bus_params.chip_id)) goto err_free_irq; - } ret = ath10k_core_register(ar, &bus_params); if (ret) { @@ -3647,6 +3657,10 @@ static int ath10k_pci_probe(struct pci_d return 0; +err_unsupported: + ath10k_err(ar, "device %04x with chip_id %08x isn't supported\n", + pdev->device, bus_params.chip_id); + err_free_irq: ath10k_pci_free_irq(ar); ath10k_pci_rx_retry_sync(ar);