* [PATCH 0/3] mwifiex PCIe power save updates
@ 2013-03-23 4:49 Bing Zhao
2013-03-23 4:49 ` [PATCH 1/3] mwifiex: do not enable PCIe interrupt in Power Save sleep state Bing Zhao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bing Zhao @ 2013-03-23 4:49 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Avinash Patil, Yogesh Powar, Amitkumar Karwar,
Nishant Sarmukadam, Frank Huang, Bing Zhao
These patches update PCIe power save handling
Avinash Patil (3):
mwifiex: do not enable PCIe interrupt in Power Save sleep state
mwifiex: avoid waking up device in awake state
mwifiex: use fw_status register to wake up PCIe card
drivers/net/wireless/mwifiex/pcie.c | 47 ++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 17 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] mwifiex: do not enable PCIe interrupt in Power Save sleep state
2013-03-23 4:49 [PATCH 0/3] mwifiex PCIe power save updates Bing Zhao
@ 2013-03-23 4:49 ` Bing Zhao
2013-03-23 4:49 ` [PATCH 2/3] mwifiex: avoid waking up device in awake state Bing Zhao
2013-03-23 4:49 ` [PATCH 3/3] mwifiex: use fw_status register to wake up PCIe card Bing Zhao
2 siblings, 0 replies; 4+ messages in thread
From: Bing Zhao @ 2013-03-23 4:49 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Avinash Patil, Yogesh Powar, Amitkumar Karwar,
Nishant Sarmukadam, Frank Huang, Bing Zhao
From: Avinash Patil <patila@marvell.com>
Enabling PCIe host interrupt may accidently wake up the card
when it's in sleep.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/pcie.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 8cd8cdc..112649a 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -2112,7 +2112,8 @@ static int mwifiex_process_int_status(struct mwifiex_adapter *adapter)
}
dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n",
adapter->cmd_sent, adapter->data_sent);
- mwifiex_pcie_enable_host_int(adapter);
+ if (adapter->ps_state != PS_STATE_SLEEP)
+ mwifiex_pcie_enable_host_int(adapter);
return 0;
}
--
1.7.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] mwifiex: avoid waking up device in awake state
2013-03-23 4:49 [PATCH 0/3] mwifiex PCIe power save updates Bing Zhao
2013-03-23 4:49 ` [PATCH 1/3] mwifiex: do not enable PCIe interrupt in Power Save sleep state Bing Zhao
@ 2013-03-23 4:49 ` Bing Zhao
2013-03-23 4:49 ` [PATCH 3/3] mwifiex: use fw_status register to wake up PCIe card Bing Zhao
2 siblings, 0 replies; 4+ messages in thread
From: Bing Zhao @ 2013-03-23 4:49 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Avinash Patil, Yogesh Powar, Amitkumar Karwar,
Nishant Sarmukadam, Frank Huang, Bing Zhao
From: Avinash Patil <patila@marvell.com>
We have received interrupt from device means FW is not sleeping.
In this case make sure wakeup handler for PCIe is not invoked by
setting adapter->pm_wakeup_fw_try to false.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/pcie.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 112649a..63c2921 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -1984,12 +1984,13 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter)
}
}
} else if (!adapter->pps_uapsd_mode &&
- adapter->ps_state == PS_STATE_SLEEP) {
+ adapter->ps_state == PS_STATE_SLEEP &&
+ mwifiex_pcie_ok_to_access_hw(adapter)) {
/* Potentially for PCIe we could get other
* interrupts like shared. Don't change power
* state until cookie is set */
- if (mwifiex_pcie_ok_to_access_hw(adapter))
- adapter->ps_state = PS_STATE_AWAKE;
+ adapter->ps_state = PS_STATE_AWAKE;
+ adapter->pm_wakeup_fw_try = false;
}
}
}
--
1.7.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] mwifiex: use fw_status register to wake up PCIe card
2013-03-23 4:49 [PATCH 0/3] mwifiex PCIe power save updates Bing Zhao
2013-03-23 4:49 ` [PATCH 1/3] mwifiex: do not enable PCIe interrupt in Power Save sleep state Bing Zhao
2013-03-23 4:49 ` [PATCH 2/3] mwifiex: avoid waking up device in awake state Bing Zhao
@ 2013-03-23 4:49 ` Bing Zhao
2 siblings, 0 replies; 4+ messages in thread
From: Bing Zhao @ 2013-03-23 4:49 UTC (permalink / raw)
To: linux-wireless
Cc: John W. Linville, Avinash Patil, Yogesh Powar, Amitkumar Karwar,
Nishant Sarmukadam, Frank Huang, Bing Zhao
From: Avinash Patil <patila@marvell.com>
FW can be woken up even by accessing device registers; we need
not explicitily enable interrupts for doing this. Future PCIe
devices will not be woken up by writing to host registers.
This patch enables driver to wake up device by reading FW status
register.
Also devices with sleep cookie enabled need some more time before
proceeding with processing. Handle this by adding a delay loop.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
---
drivers/net/wireless/mwifiex/pcie.c | 37 ++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 63c2921..856959b 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -287,18 +287,13 @@ static int mwifiex_read_reg(struct mwifiex_adapter *adapter, int reg, u32 *data)
}
/*
- * This function wakes up the card.
- *
- * A host power up command is written to the card configuration
- * register to wake up the card.
+ * This function adds delay loop to ensure FW is awake before proceeding.
*/
-static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
+static void mwifiex_pcie_dev_wakeup_delay(struct mwifiex_adapter *adapter)
{
int i = 0;
- struct pcie_service_card *card = adapter->card;
- const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
- while (reg->sleep_cookie && mwifiex_pcie_ok_to_access_hw(adapter)) {
+ while (mwifiex_pcie_ok_to_access_hw(adapter)) {
i++;
usleep_range(10, 20);
/* 50ms max wait */
@@ -306,16 +301,32 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
break;
}
+ return;
+}
+
+/* This function wakes up the card by reading fw_status register. */
+static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
+{
+ u32 fw_status;
+ struct pcie_service_card *card = adapter->card;
+ const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
+
dev_dbg(adapter->dev, "event: Wakeup device...\n");
- /* Enable interrupts or any chip access will wakeup device */
- if (mwifiex_write_reg(adapter, PCIE_HOST_INT_MASK, HOST_INTR_MASK)) {
- dev_warn(adapter->dev, "Enable host interrupt failed\n");
+ if (reg->sleep_cookie)
+ mwifiex_pcie_dev_wakeup_delay(adapter);
+
+ /* Reading fw_status register will wakeup device */
+ if (mwifiex_read_reg(adapter, reg->fw_status, &fw_status)) {
+ dev_warn(adapter->dev, "Reading fw_status register failed\n");
return -1;
}
- dev_dbg(adapter->dev, "PCIE wakeup: Setting PS_STATE_AWAKE\n");
- adapter->ps_state = PS_STATE_AWAKE;
+ if (reg->sleep_cookie) {
+ mwifiex_pcie_dev_wakeup_delay(adapter);
+ dev_dbg(adapter->dev, "PCIE wakeup: Setting PS_STATE_AWAKE\n");
+ adapter->ps_state = PS_STATE_AWAKE;
+ }
return 0;
}
--
1.7.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-23 4:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-23 4:49 [PATCH 0/3] mwifiex PCIe power save updates Bing Zhao
2013-03-23 4:49 ` [PATCH 1/3] mwifiex: do not enable PCIe interrupt in Power Save sleep state Bing Zhao
2013-03-23 4:49 ` [PATCH 2/3] mwifiex: avoid waking up device in awake state Bing Zhao
2013-03-23 4:49 ` [PATCH 3/3] mwifiex: use fw_status register to wake up PCIe card Bing Zhao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.