From patchwork Mon May 9 23:11:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9051701 X-Patchwork-Delegate: kvalo@adurom.com 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 A339EBF440 for ; Mon, 9 May 2016 23:18:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 937EE20142 for ; Mon, 9 May 2016 23:18:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B81022012B for ; Mon, 9 May 2016 23:18:48 +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 1azuRn-0000Se-SN; Mon, 09 May 2016 23:18:43 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1azuRg-0000MK-Er for ath10k@bombadil.infradead.org; Mon, 09 May 2016 23:18:36 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by merlin.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1azuRf-0007Ul-9h for ath10k@lists.infradead.org; Mon, 09 May 2016 23:18:35 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 339D840C1FA; Mon, 9 May 2016 16:11:28 -0700 (PDT) From: greearb@candelatech.com To: ath10k@lists.infradead.org Subject: [PATCH 20/21] ath10k: read firmware crash over ioread32 if CE fails. Date: Mon, 9 May 2016 16:11:14 -0700 Message-Id: <1462835475-11079-21-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1462835475-11079-1-git-send-email-greearb@candelatech.com> References: <1462835475-11079-1-git-send-email-greearb@candelatech.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160509_191835_483009_6547867E X-CRM114-Status: GOOD ( 14.21 ) X-Spam-Score: -4.0 (----) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear , linux-wireless@vger.kernel.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 From: Ben Greear This might work around problem where sometimes host cannot access firmware crash over normal CE transport. Requires CT firmware with matching logic in it's assert handler (-13 and higher releases). Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/hw.h | 5 ++++ drivers/net/wireless/ath/ath10k/pci.c | 56 ++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index d3f37d5..5ff1fac 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -603,6 +603,7 @@ enum ath10k_hw_4addr_pad { #define PCIE_INTR_ENABLE_ADDRESS 0x0008 #define PCIE_INTR_CAUSE_ADDRESS 0x000c #define PCIE_INTR_CLR_ADDRESS ar->regs->pcie_intr_clr_address +#define SCRATCH_2_ADDRESS 0x002c #define SCRATCH_3_ADDRESS ar->regs->scratch_3_address #define CPU_INTR_ADDRESS 0x0010 @@ -614,6 +615,10 @@ enum ath10k_hw_4addr_pad { #define FW_IND_INITIALIZED 2 #define FW_IND_HOST_READY 0x80000000 +/* CT firmware only */ +#define FW_IND_SCRATCH2_WR (1<<14) /* scratch2 has data written to it */ +#define FW_IND_SCRATCH2_RD (1<<15) /* scratch2 has been read (by host) */ + /* HOST_REG interrupt from firmware */ #define PCIE_INTR_FIRMWARE_MASK ar->regs->pcie_intr_fw_mask #define PCIE_INTR_CE_MASK_ALL ar->regs->pcie_intr_ce_mask_all diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 2adc459..330c150 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1507,6 +1507,54 @@ static void ath10k_pci_dump_exc_stack(struct ath10k *ar, hi_err_stack); } +/* Only CT firmware can do this. Attempt to read crash dump over pci + * registers since normal CE transport is not working. + */ +static int ath10k_ct_fw_crash_regs_harder(struct ath10k *ar, + __le32 *reg_dump_values, + int len) +{ + u32 val; + int i; + int q; +#define MAX_SPIN_TRIES 1000000 + + if (!test_bit(ATH10K_FW_FEATURE_WMI_10X_CT, + ar->running_fw->fw_file.fw_features)) { + return -EINVAL; + } + + for (i = 0; i