From: Kalle Valo <kvalo@qca.qualcomm.com>
To: ath10k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 1/8] ath10k: cleanup ath10k_pci_wait_for_target_init()
Date: Tue, 25 Mar 2014 11:15:05 +0200 [thread overview]
Message-ID: <20140325091505.16651.15554.stgit@potku.adurom.net> (raw)
In-Reply-To: <20140325091311.16651.15747.stgit@potku.adurom.net>
ath10k_pci_wait_for_target_init() did really follow the style used elsewhere in
ath10k. Use ath10k_pci_read/write() wrappers, simplify the while loop and
improve warning messages.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/pci.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index 9d242d801d9d..0425c76daf3f 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2385,30 +2385,37 @@ static int ath10k_pci_deinit_irq(struct ath10k *ar)
static int ath10k_pci_wait_for_target_init(struct ath10k *ar)
{
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
- int wait_limit = 300; /* 3 sec */
+ const int wait = 3000; /* ms */
+ unsigned long timeout;
int ret;
+ u32 val;
ret = ath10k_pci_wake(ar);
if (ret) {
- ath10k_err("failed to wake up target: %d\n", ret);
+ ath10k_err("failed to wake up target for init: %d\n", ret);
return ret;
}
- while (wait_limit-- &&
- !(ioread32(ar_pci->mem + FW_INDICATOR_ADDRESS) &
- FW_IND_INITIALIZED)) {
+ timeout = jiffies + msecs_to_jiffies(wait);
+
+ do {
+ val = ath10k_pci_read32(ar, FW_INDICATOR_ADDRESS);
+ if (val == FW_IND_INITIALIZED)
+ break;
+
if (ar_pci->num_msi_intrs == 0)
/* Fix potential race by repeating CORE_BASE writes */
- iowrite32(PCIE_INTR_FIRMWARE_MASK |
- PCIE_INTR_CE_MASK_ALL,
- ar_pci->mem + (SOC_CORE_BASE_ADDRESS |
- PCIE_INTR_ENABLE_ADDRESS));
+ ath10k_pci_soc_write32(ar, PCIE_INTR_ENABLE_ADDRESS,
+ PCIE_INTR_FIRMWARE_MASK |
+ PCIE_INTR_CE_MASK_ALL);
+
mdelay(10);
- }
+ } while (time_before(jiffies, timeout));
- if (wait_limit < 0) {
- ath10k_err("target stalled\n");
- ret = -EIO;
+ if (val != FW_IND_INITIALIZED) {
+ ath10k_err("failed to receive initialized event from target after %d ms: %d\n",
+ wait, val);
+ ret = -ETIMEDOUT;
goto out;
}
next prev parent reply other threads:[~2014-03-25 9:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 9:14 [PATCH 0/8] ath10k: small cleanups to pci.c Kalle Valo
2014-03-25 9:15 ` Kalle Valo [this message]
2014-03-25 9:32 ` [PATCH 1/8] ath10k: cleanup ath10k_pci_wait_for_target_init() Michal Kazior
2014-03-26 9:28 ` Kalle Valo
2014-03-26 9:52 ` Michal Kazior
2014-03-26 11:10 ` Kalle Valo
2014-03-25 9:15 ` [PATCH 2/8] ath10k: add module parameter to disable cold reset Kalle Valo
2014-03-25 9:15 ` [PATCH 3/8] ath10k: fix name of target_ps module parameter Kalle Valo
2014-03-25 9:15 ` [PATCH 4/8] ath10k: advertise only firmware API 2 files Kalle Valo
2014-03-25 9:15 ` [PATCH 5/8] ath10k: delete ar_pci->fw_indicator_address Kalle Valo
2014-03-25 9:15 ` [PATCH 6/8] ath10k: improve pci debug messages Kalle Valo
2014-03-25 9:15 ` [PATCH 7/8] ath10k: add module parameter values to the pci info print Kalle Valo
2014-03-25 9:15 ` [PATCH 8/8] ath10k: print chip id during boot Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140325091505.16651.15554.stgit@potku.adurom.net \
--to=kvalo@qca.qualcomm.com \
--cc=ath10k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox