Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 369084
b: refs/heads/master
c: c0880a2
h: refs/heads/master
v: v3
  • Loading branch information
Avinash Patil authored and John W. Linville committed Mar 27, 2013
1 parent 8b18c82 commit 4ef111e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c24d992ab6b6f067f78585b723fa0c95b3a9c8bf
refs/heads/master: c0880a2902aacdfb387da1928fa1ba7778584339
37 changes: 24 additions & 13 deletions trunk/drivers/net/wireless/mwifiex/pcie.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,35 +287,46 @@ 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 */
if (i == 5000)
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;
}
Expand Down

0 comments on commit 4ef111e

Please sign in to comment.