From patchwork Mon Oct 27 08:43:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Markowski X-Patchwork-Id: 5158711 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 91B9CC11AC for ; Mon, 27 Oct 2014 08:44:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD9B620254 for ; Mon, 27 Oct 2014 08:44:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 010FC2024D for ; Mon, 27 Oct 2014 08:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751315AbaJ0IoL (ORCPT ); Mon, 27 Oct 2014 04:44:11 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:32791 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751181AbaJ0IoK (ORCPT ); Mon, 27 Oct 2014 04:44:10 -0400 Received: by mail-lb0-f182.google.com with SMTP id f15so4340422lbj.13 for ; Mon, 27 Oct 2014 01:44:08 -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=uhynNzh8GM3LJ+RAFJKaEvqpJrAbeXuQYSkTrDXx2LA=; b=VTSkjd/ZJKHsN8/mb2M7oD9MpZnBgLAAPUvdU6XgcLkxXCITnY6zBLxWrkXjbmABEk 0uuUtSj1HfXJO4pjI2ZTORMjQ/Zb5ix7ejncpOtsRTspGwMoeDT8wmEOPPNG4cNCXgFX fMfOSaEy3N7dI5KzS46fLtSBF5foOy1prAACQ= 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=uhynNzh8GM3LJ+RAFJKaEvqpJrAbeXuQYSkTrDXx2LA=; b=lVGxbvxrDkpbkv8stSIGk53E4KiTMSADNGvJEINgMDRj8rgv/VHh4rJlHXCs+HPRCg 5YRnDkP1cELHhEo3gqSckjJg3IuDr+thdTxEfWRKsTXys+7pZELqEpO6CNbAy3JYHT/h ZGzZXw1K3D81K57+CE+0UGAPxa6vqo3eRbzXNQgWVoN6+QSNgO73AM3fys2Srnb5EFQD CLq9w9UH/ybOMzp2ALu/fBuWfuJUilj7H9PX8TaiRdcdFWsr6sIUK5G2S5IQzKouyWgH fjER02g3hW6772JBsTZA8mke5WfwUHH8R7HmYpd5gH1dFQhFFjWhOE9aVs0sm049IERv 2NZw== X-Gm-Message-State: ALoCoQnzWnZ+W2Zwz15r6agoIUs/qEHIjAO17axfCNZZw8gkic5r+hZBxWmoLWnx/7cRXKuHvOJEKcSDWkypXm/gJlTPol9DiApkLGOlWnI1LkL6X2ZjvFMWvjfm5O8X5txwm05GatXN X-Received: by 10.112.224.162 with SMTP id rd2mr1584477lbc.95.1414399448519; Mon, 27 Oct 2014 01:44:08 -0700 (PDT) Received: from uw000975.eu.tieto.com ([91.198.246.10]) by mx.google.com with ESMTPSA id ry6sm4717237lbb.26.2014.10.27.01.44.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 01:44:07 -0700 (PDT) From: Bartosz Markowski To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Bartosz Markowski Subject: [PATCH v2] ath10k: fix pm resume after suspend Date: Mon, 27 Oct 2014 09:43:56 +0100 Message-Id: <1414399436-7047-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.3 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 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 4a4740b..d31488b 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -1877,10 +1877,16 @@ static int ath10k_pci_hif_power_up_warm(struct ath10k *ar) static int ath10k_pci_hif_power_up(struct ath10k *ar) { - int ret; + int ret = 0; 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; + } + /* * Hardware CUS232 version 2 has some issues with cold reset and the * preferred (and safer) way to perform a device reset is through a @@ -1895,7 +1901,7 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) ret); if (ath10k_pci_reset_mode == ATH10K_PCI_RESET_WARM_ONLY) - return ret; + goto err_sleep; ath10k_warn(ar, "trying cold reset\n"); @@ -1903,11 +1909,15 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) if (ret) { ath10k_err(ar, "failed to power up target using cold reset too (%d)\n", ret); - return ret; + goto err_sleep; } } - return 0; + return ret; + +err_sleep: + ath10k_pci_sleep(ar); + return ret; } static void ath10k_pci_hif_power_down(struct ath10k *ar) @@ -1915,6 +1925,7 @@ static void ath10k_pci_hif_power_down(struct ath10k *ar) ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power down\n"); ath10k_pci_warm_reset(ar); + ath10k_pci_sleep(ar); } #ifdef CONFIG_PM @@ -2516,6 +2527,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); @@ -2567,7 +2580,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); }