Commit 6d7d579a authored by Brian Norris's avatar Brian Norris Committed by Kalle Valo

mwifiex: pcie: add card_reset() support

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: default avatarBrian Norris <briannorris@chromium.org>
Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 21f569af
...@@ -2822,6 +2822,13 @@ static void mwifiex_pcie_device_dump_work(struct mwifiex_adapter *adapter) ...@@ -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); 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) static void mwifiex_pcie_work(struct work_struct *work)
{ {
struct pcie_service_card *card = struct pcie_service_card *card =
...@@ -2830,6 +2837,9 @@ static void mwifiex_pcie_work(struct work_struct *work) ...@@ -2830,6 +2837,9 @@ static void mwifiex_pcie_work(struct work_struct *work)
if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, if (test_and_clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP,
&card->work_flags)) &card->work_flags))
mwifiex_pcie_device_dump_work(card->adapter); 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 */ /* This function dumps FW information */
...@@ -2842,6 +2852,14 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter) ...@@ -2842,6 +2852,14 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter)
schedule_work(&card->work); 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) static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
{ {
struct pcie_service_card *card = adapter->card; struct pcie_service_card *card = adapter->card;
...@@ -3271,6 +3289,7 @@ static struct mwifiex_if_ops pcie_ops = { ...@@ -3271,6 +3289,7 @@ static struct mwifiex_if_ops pcie_ops = {
.cleanup_mpa_buf = NULL, .cleanup_mpa_buf = NULL,
.init_fw_port = mwifiex_pcie_init_fw_port, .init_fw_port = mwifiex_pcie_init_fw_port,
.clean_pcie_ring = mwifiex_clean_pcie_ring_buf, .clean_pcie_ring = mwifiex_clean_pcie_ring_buf,
.card_reset = mwifiex_pcie_card_reset,
.reg_dump = mwifiex_pcie_reg_dump, .reg_dump = mwifiex_pcie_reg_dump,
.device_dump = mwifiex_pcie_device_dump, .device_dump = mwifiex_pcie_device_dump,
.down_dev = mwifiex_pcie_down_dev, .down_dev = mwifiex_pcie_down_dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment