From patchwork Fri Apr 28 17:28:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9705153 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 8DDAB602BE for ; Fri, 28 Apr 2017 17:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 872C22866F for ; Fri, 28 Apr 2017 17:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BD7C28697; Fri, 28 Apr 2017 17:30:13 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable 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 338F92866F for ; Fri, 28 Apr 2017 17:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422884AbdD1R3z (ORCPT ); Fri, 28 Apr 2017 13:29:55 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34985 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422830AbdD1R3x (ORCPT ); Fri, 28 Apr 2017 13:29:53 -0400 Received: by mail-pf0-f181.google.com with SMTP id v14so51554646pfd.2 for ; Fri, 28 Apr 2017 10:29:53 -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; bh=7anaVBS+xsx+2Bl/qOBDRsIhw5tDqB/+eLLzLRo7MPk=; b=Awm4UXd9BCSYobyHJMCzijmUhx5DhRizU/eGGy6BREDXClNbooYZc3EiQ8gku0zHhM RBjT2QckNyxZSgy/8vdA1agWtsnz4/VxN1y58aCJosDgjkO0W7yUiwmQphx0XhbWUT/Z YuXi251pOjkLLItvLutm/mlHAygpA+meU2Cak= 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; bh=7anaVBS+xsx+2Bl/qOBDRsIhw5tDqB/+eLLzLRo7MPk=; b=U7BjlOOTp/kgi8WvCyPu+pdhLG9Ym8VwAnzcn0yeUDxlYrteWxrMOFwf/mB5eSLzAB 99UUqtF4omtnthWjsCdoIsWLrUkiboviO3uLXzXeAyBvQuGCLzuMnZi0inkV5nqBu/KE 2+pcNnEu0CvYdWRDkbd7eI8WgOzRakoxIc3kxi0bpaMbEfhqntY9sAH6TkA5ZvpR6yxl zkAVw1/yM+DZADYhDZ70/Oeb1QvqkxJJaPsWkjhgm6yLXQEAQQioZNqkVGYKuhFMrJ0m NYf0cRPbsIX4AEmlGDuO90Jw3BaJY68N62ivdkYl9xfOVpM8eW6GV76GMFOl9BHOpoAa kihQ== X-Gm-Message-State: AN3rC/5UsNlivrQer+E8Wf1IsBTvNGqJ2CeoJADn4qi46Z0qYe75wboG elLSCLpvR5zdV3Qv X-Received: by 10.84.212.1 with SMTP id d1mr16669906pli.109.1493400593210; Fri, 28 Apr 2017 10:29:53 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id y69sm157296pfb.56.2017.04.28.10.29.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Apr 2017 10:29:52 -0700 (PDT) From: Brian Norris To: Ganapathi Bhat , Nishant Sarmukadam Cc: , Dmitry Torokhov , Kalle Valo , linux-wireless@vger.kernel.org, Brian Norris Subject: [PATCH] mwifiex: pcie: add card_reset() support Date: Fri, 28 Apr 2017 10:28:47 -0700 Message-Id: <20170428172847.34888-1-briannorris@chromium.org> X-Mailer: git-send-email 2.13.0.rc0.306.g87b477812d-goog 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 --- I still haven't found the reset sequence to work 100% reliably, but it's definitely better than nothing. drivers/net/wireless/marvell/mwifiex/pcie.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index ac62bce50e96..aaec4fdd7777 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 */ @@ -2845,6 +2855,18 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter) schedule_work(&card->work); } +static void mwifiex_pcie_card_reset(struct mwifiex_adapter *adapter) +{ + struct pcie_service_card *card = adapter->card; + + if (test_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags)) + return; + + set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); + + schedule_work(&card->work); +} + static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter) { struct pcie_service_card *card = adapter->card; @@ -3274,6 +3296,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,