Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1633824 > unrolled thread

[PATCH v3 2/2] mwifiex: pcie: add card_reset() support

Started byBrian Norris <briannorris@chromium.org>
First post2017-05-01 21:40 +0200
Last post2017-05-01 21:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 2/2] mwifiex: pcie: add card_reset() support Brian Norris <briannorris@chromium.org> - 2017-05-01 21:40 +0200
    Re: [PATCH v3 2/2] mwifiex: pcie: add card_reset() support Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-05-01 21:40 +0200

#1633824 — [PATCH v3 2/2] mwifiex: pcie: add card_reset() support

FromBrian Norris <briannorris@chromium.org>
Date2017-05-01 21:40 +0200
Subject[PATCH v3 2/2] mwifiex: pcie: add card_reset() support
Message-ID<tCpkR-4KF-3@gated-at.bofh.it>
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 <briannorris@chromium.org>
---
v3: keep all the new reset code in patch 2, not patch 1

v2: use atomic test/set, based on Dmitry's suggestion
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 5f56e8e6d612..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 */
@@ -2842,6 +2852,14 @@ 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_and_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;
@@ -3271,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,
-- 
2.13.0.rc0.306.g87b477812d-goog

[toc] | [next] | [standalone]


#1633825

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-05-01 21:40 +0200
Message-ID<tCpkR-4KF-7@gated-at.bofh.it>
In reply to#1633824
On Mon, May 01, 2017 at 12:37:00PM -0700, Brian Norris wrote:
> 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 <briannorris@chromium.org>

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> ---
> v3: keep all the new reset code in patch 2, not patch 1
> 
> v2: use atomic test/set, based on Dmitry's suggestion
> ---
>  drivers/net/wireless/marvell/mwifiex/pcie.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
> index 5f56e8e6d612..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 */
> @@ -2842,6 +2852,14 @@ 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_and_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;
> @@ -3271,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,
> -- 
> 2.13.0.rc0.306.g87b477812d-goog
> 

-- 
Dmitry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web