From patchwork Thu Feb 2 09:14:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 9551437 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0249460236 for ; Thu, 2 Feb 2017 09:15:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E780128425 for ; Thu, 2 Feb 2017 09:14:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D96F72842E; Thu, 2 Feb 2017 09:14:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57A0828425 for ; Thu, 2 Feb 2017 09:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750984AbdBBJO4 (ORCPT ); Thu, 2 Feb 2017 04:14:56 -0500 Received: from nbd.name ([46.4.11.11]:53179 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750921AbdBBJOy (ORCPT ); Thu, 2 Feb 2017 04:14:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=aBAFQelX/6Oz3KR96AEgB9zmqisLW1gqARab0/gTGgA=; b=n/z6iPSS++wWLYFle6ekyKub+LCi3kOjH/Dk0mEZJTMm73IwEbImThgW6mCLfnQCkVIpfArfqjzqmXD+m5Dz74NxmZBrk+jinuFykdu3gGG6Y+2BpEAfusI8pxuXWb8uBu1HOeVttwkIfU/p9mLRF2e24KXaCt3/SGoqmewunVo=; Received: by nf-4.local (Postfix, from userid 501) id 30AEA18B2523A; Thu, 2 Feb 2017 10:14:52 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org Subject: [PATCH v2 2/3] ath9k_hw: check if the chip failed to wake up Date: Thu, 2 Feb 2017 10:14:51 +0100 Message-Id: <20170202091452.11939-2-nbd@nbd.name> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170202091452.11939-1-nbd@nbd.name> References: <20170202091452.11939-1-nbd@nbd.name> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In an RFC patch, Sven Eckelmann and Simon Wunderlich reported: "QCA 802.11n chips (especially AR9330/AR9340) sometimes end up in a state in which a read of AR_CFG always returns 0xdeadbeef. This should not happen when when the power_mode of the device is ATH9K_PM_AWAKE." Include the check for the default register state in the existing MAC hang check. Signed-off-by: Felix Fietkau --- drivers/net/wireless/ath/ath9k/hw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index ac36873d6da4..8c5c2dd8fa7f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -1603,6 +1603,10 @@ bool ath9k_hw_check_alive(struct ath_hw *ah) int count = 50; u32 reg, last_val; + /* Check if chip failed to wake up */ + if (REG_READ(ah, AR_CFG) == 0xdeadbeef) + return false; + if (AR_SREV_9300(ah)) return !ath9k_hw_detect_mac_hang(ah);