From patchwork Mon May 1 18:45:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9706827 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 1E5CF60387 for ; Mon, 1 May 2017 18:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1445427F95 for ; Mon, 1 May 2017 18:45:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06C4A280FC; Mon, 1 May 2017 18:45: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 8A30427F95 for ; Mon, 1 May 2017 18:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751703AbdEASp5 (ORCPT ); Mon, 1 May 2017 14:45:57 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:36469 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750957AbdEASpz (ORCPT ); Mon, 1 May 2017 14:45:55 -0400 Received: by mail-pf0-f173.google.com with SMTP id q66so33751913pfi.3 for ; Mon, 01 May 2017 11:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c+VMCnlfjwTbhOjWXSRP6nEzYEsWwlg6MyTif17OnrU=; b=kXyDIqTb12zLgj2gvEN+so76j4XKy2DQGJFoGlf7fxIu1Gagyw5LuvHvgk3D1TkFgh MyTr3Q9wX7slJ2W5h71lno+xw6VB9WvGGTWA2Uqi4jVaohGf+u0vKvwsY4NLE/fBZNRS IZKtNb/WvdKjdwwbkdZcQIKn56/pGid37YeFw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c+VMCnlfjwTbhOjWXSRP6nEzYEsWwlg6MyTif17OnrU=; b=BO6ZEKXP+TvOH+3s5zsHZSzmGuIH18JGAFxkWQoHjtEKh+6QHvnQx70+92SJqNwNmB 6cBK9zsBNB3BABvIpZ24Q3Ri5jiPr45GlPPs+19uqDMstAhDWN2xnq7rKqRZxK3Z8eAd PMXsTxlrWX9etkQRvGgTMWV8LXzVMHwN4ao9PpR8nIBhPizR0TsDcMgVwh0K0k6qGU7b TnyJCERiUCK430uwqqMLYCxWiWsREBixoSCve+eNju4F5bul/YsXHbIYSjYbnf/V1WY6 CwoTUBIpFmKYQ6VJK63OD+fXAf6C0Y+CRdDiGNzg5oWEYtZBocklypNsackm8LwfIc/n A+mQ== X-Gm-Message-State: AN3rC/4dizWjyYmatTJmWR5I8xj91KooAKzS7F6/ZWLDU14jdfKAb7t9 N5FvTwH8c+ZMWcmN X-Received: by 10.84.211.65 with SMTP id b59mr35791195pli.17.1493664354327; Mon, 01 May 2017 11:45:54 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id x1sm23646250pgb.43.2017.05.01.11.45.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 May 2017 11:45:53 -0700 (PDT) From: Brian Norris To: Ganapathi Bhat , Nishant Sarmukadam Cc: , Dmitry Torokhov , Kalle Valo , linux-wireless@vger.kernel.org, Brian Norris Subject: [PATCH v2 2/2] mwifiex: pcie: add card_reset() support Date: Mon, 1 May 2017 11:45:49 -0700 Message-Id: <20170501184549.52896-2-briannorris@chromium.org> X-Mailer: git-send-email 2.13.0.rc0.306.g87b477812d-goog In-Reply-To: <20170501184549.52896-1-briannorris@chromium.org> References: <20170501184549.52896-1-briannorris@chromium.org> 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 Similar to the SDIO driver, we should implement this so that we will automatically reset the device whenever there's a command timeout or similar. Signed-off-by: Brian Norris --- v2: use atomic test/set, based on Dmitry's suggestion --- drivers/net/wireless/marvell/mwifiex/pcie.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 8e7d6f41a952..78688ff6ecd0 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -2822,6 +2822,13 @@ static void mwifiex_pcie_device_dump_work(struct mwifiex_adapter *adapter) mwifiex_upload_device_dump(adapter, drv_info, drv_info_size); } +static void mwifiex_pcie_card_reset_work(struct mwifiex_adapter *adapter) +{ + struct pcie_service_card *card = adapter->card; + + pci_reset_function(card->dev); +} + static void mwifiex_pcie_work(struct work_struct *work) { struct pcie_service_card *card = @@ -2830,6 +2837,9 @@ static void mwifiex_pcie_work(struct work_struct *work) if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags)) mwifiex_pcie_device_dump_work(card->adapter); + if (test_and_clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, + &card->work_flags)) + mwifiex_pcie_card_reset_work(card->adapter); } /* This function dumps FW information */ @@ -3279,6 +3289,7 @@ static struct mwifiex_if_ops pcie_ops = { .cleanup_mpa_buf = NULL, .init_fw_port = mwifiex_pcie_init_fw_port, .clean_pcie_ring = mwifiex_clean_pcie_ring_buf, + .card_reset = mwifiex_pcie_card_reset, .reg_dump = mwifiex_pcie_reg_dump, .device_dump = mwifiex_pcie_device_dump, .down_dev = mwifiex_pcie_down_dev,