From patchwork Fri Oct 31 08:03:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Markowski X-Patchwork-Id: 5203051 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D5D89F318 for ; Fri, 31 Oct 2014 08:03:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93DCD20160 for ; Fri, 31 Oct 2014 08:03:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DFD92011D for ; Fri, 31 Oct 2014 08:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752676AbaJaIDv (ORCPT ); Fri, 31 Oct 2014 04:03:51 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:44812 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbaJaIDt (ORCPT ); Fri, 31 Oct 2014 04:03:49 -0400 Received: by mail-wi0-f178.google.com with SMTP id q5so576967wiv.11 for ; Fri, 31 Oct 2014 01:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=rRGi4zBRgctkArNQAnuJLbhJlopeU3tuUbHIXtOMJjs=; b=5JEngUeNUtmDUmYWdr93yEwcBbnCFrZDHViak6mmCIPGnWBMuemx03w6sfxrdg+UcE mxRhtr5C2H+PdSrEb0bT04Hj2m/O2Vr/rwPiX3YLHu4nF5D6zAMdx54zsPEkpmen6x24 mDU5aDzzd1S89RtM3BejVJLBJUZokwdg7w02Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rRGi4zBRgctkArNQAnuJLbhJlopeU3tuUbHIXtOMJjs=; b=VFLKAK9NFrnih/X2XBDxXSvFa+wzB7Ye7Rb0uNNkE3djmibQfTb0pfAR6iCjIOWjs9 iu7Unn/rTwcM6ENt369obTC/QYDlnlQo1MZUrJeAdQ/p+PSYAxzKGp/D9zxlIHYcdddz D629LSSE7Ru3HDZnnbj98UtqDOHQHL4Kn7DxOE4NDC4cujTGdZDcgbJVPOqLCt7Ybjhx /YiCogXWkBu60p61UgXGeI6XQsHTdU4VYyWpztpqG+1Hvf+MGKh/FWDIypV13fgMPkVr /menaSi2GrByxJPb9CvbJXzph76VeEf7VBuksSV8Ziiqzt/FVOvBGoK2lLFBsmDnOMpA oRFw== X-Gm-Message-State: ALoCoQncR+Kf0sFEaRa4ObIkaKOWuNY/JGBLGwj6V4F0j5rGSibObQL9F43NicvrIEQEZzaFgCLf2Sk9ybHZcq8+tAen1Z1Z7eRVLBBhCNx4otnEVV8hpRAxG/z1sEASY3c8TIQTLPKk X-Received: by 10.180.207.226 with SMTP id lz2mr2102836wic.46.1414742628372; Fri, 31 Oct 2014 01:03:48 -0700 (PDT) Received: from uw000975.eu.tieto.com ([91.198.246.10]) by mx.google.com with ESMTPSA id q5sm24707727wiy.16.2014.10.31.01.03.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 01:03:47 -0700 (PDT) From: Bartosz Markowski To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Bartosz Markowski Subject: [PATCH v3] ath10k: fix pm resume after suspend Date: Fri, 31 Oct 2014 09:03:43 +0100 Message-Id: <1414742623-308-1-git-send-email-bartosz.markowski@tieto.com> X-Mailer: git-send-email 1.8.2 X-DomainID: tieto.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=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Firmware was crashing when we were trying to warm reset it after suspend. This was due to the fact that target registeres can be accessed only if the hardware is awaken. This patch makes sure to awake the device also on the hif up, not only in case of probe call. Signed-off-by: Bartosz Markowski --- drivers/net/wireless/ath/ath10k/pci.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index f5e426e..3a6b8a5 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1875,6 +1875,12 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power up\n"); + ret = ath10k_pci_wake(ar); + if (ret) { + ath10k_err(ar, "failed to wake up target: %d\n", ret); + return ret; + } + /* * Bring the target up cleanly. * @@ -1888,13 +1894,13 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) ret = ath10k_pci_chip_reset(ar); if (ret) { ath10k_err(ar, "failed to reset chip: %d\n", ret); - goto err; + goto err_sleep; } ret = ath10k_pci_init_pipes(ar); if (ret) { ath10k_err(ar, "failed to initialize CE: %d\n", ret); - goto err; + goto err_sleep; } ret = ath10k_pci_init_config(ar); @@ -1914,7 +1920,8 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) err_ce: ath10k_pci_ce_deinit(ar); -err: +err_sleep: + ath10k_pci_sleep(ar); return ret; } @@ -1925,6 +1932,8 @@ static void ath10k_pci_hif_power_down(struct ath10k *ar) /* Currently hif_power_up performs effectively a reset and hif_stop * resets the chip as well so there's no point in resetting here. */ + + ath10k_pci_sleep(ar); } #ifdef CONFIG_PM @@ -2526,6 +2535,8 @@ static int ath10k_pci_probe(struct pci_dev *pdev, goto err_deinit_irq; } + ath10k_pci_sleep(ar); + ret = ath10k_core_register(ar, chip_id); if (ret) { ath10k_err(ar, "failed to register driver core: %d\n", ret); @@ -2577,7 +2588,6 @@ static void ath10k_pci_remove(struct pci_dev *pdev) ath10k_pci_deinit_irq(ar); ath10k_pci_ce_deinit(ar); ath10k_pci_free_pipes(ar); - ath10k_pci_sleep(ar); ath10k_pci_release(ar); ath10k_core_destroy(ar); }