From patchwork Wed Jan 25 16:36:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 9537451 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 777046046A for ; Wed, 25 Jan 2017 16:37:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68F2C27F99 for ; Wed, 25 Jan 2017 16:37:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DD5327FB0; Wed, 25 Jan 2017 16:37:06 +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 2C7AD27FB1 for ; Wed, 25 Jan 2017 16:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751660AbdAYQhD (ORCPT ); Wed, 25 Jan 2017 11:37:03 -0500 Received: from nbd.name ([46.4.11.11]:33760 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbdAYQhC (ORCPT ); Wed, 25 Jan 2017 11:37:02 -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=igcOpPrhyXp1dQAZUV1CK8m548h0aL+vpUJqNGQ0NJk=; b=DjYpLLqfFSrU8FONjOHQgqvBNEYpppYgC2oDHgKMgYI2irWNRFC5sV84j0xPur2l/RlxRKb4EEDFVnynsl5KZihTWWZ0yTzFidt/xrnyYEobaVlQBRBw0t4bptGyXYv2NnD7KcFok60fw5t2rOH6Hs39nd1ysJ5S4YgYcau3Rms=; Received: by nf-4.local (Postfix, from userid 501) id D285E188C3E90; Wed, 25 Jan 2017 17:36:54 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org Subject: [PATCH 2/4] ath9k_hw: check if the chip failed to wake up Date: Wed, 25 Jan 2017 17:36:52 +0100 Message-Id: <20170125163654.66431-2-nbd@nbd.name> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170125163654.66431-1-nbd@nbd.name> References: <20170125163654.66431-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 6989f89b3116..11fd98df2c43 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c @@ -1623,6 +1623,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);