From patchwork Wed May 11 17:02:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9073611 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 26F1CBF29F for ; Wed, 11 May 2016 17:16:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1BE6320142 for ; Wed, 11 May 2016 17:16:23 +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 27E392012B for ; Wed, 11 May 2016 17:16:22 +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 1b0Xk8-0001Na-1M; Wed, 11 May 2016 17:16:16 +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 1b0Xk6-0001EZ-Ru for ath10k@bombadil.infradead.org; Wed, 11 May 2016 17:16:14 +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 1b0Xk5-0005bw-Co for ath10k@lists.infradead.org; Wed, 11 May 2016 17:16:13 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id EE57140C6EC; Wed, 11 May 2016 10:02:44 -0700 (PDT) From: greearb@candelatech.com To: ath10k@lists.infradead.org Subject: [PATCH v2 20/21] ath10k: read firmware crash over ioread32 if CE fails. Date: Wed, 11 May 2016 10:02:32 -0700 Message-Id: <1462986153-16318-21-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1462986153-16318-1-git-send-email-greearb@candelatech.com> References: <1462986153-16318-1-git-send-email-greearb@candelatech.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160511_131613_556738_F0789F5B X-CRM114-Status: GOOD ( 13.87 ) X-Spam-Score: -3.3 (---) 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=-5.6 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