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: 9073221 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F6789F1C1 for ; Wed, 11 May 2016 17:02:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0CDD2010F for ; Wed, 11 May 2016 17:02:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9590020145 for ; Wed, 11 May 2016 17:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752609AbcEKRCs (ORCPT ); Wed, 11 May 2016 13:02:48 -0400 Received: from mail2.candelatech.com ([208.74.158.173]:53963 "EHLO mail2.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752597AbcEKRCq (ORCPT ); Wed, 11 May 2016 13:02:46 -0400 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 Cc: linux-wireless@vger.kernel.org, Ben Greear 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> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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