linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Franky Lin" <frankyl@broadcom.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 03/11] brcmfmac: decouple set_sbaddr_window from register write interface
Date: Fri, 4 May 2012 18:27:30 -0700	[thread overview]
Message-ID: <1336181258-7305-4-git-send-email-frankyl@broadcom.com> (raw)
In-Reply-To: <1336181258-7305-1-git-send-email-frankyl@broadcom.com>

brcmf_sdcard_set_sbaddr_window configures 3 registers on SDIO
function misc bank to change current silicon backplane programming
window. This patch makes it call brcmf_sdioh_request_byte directly
in order to prepare for the write register interface unification.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |   37 ++++++++++++++--------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index 7c9bc2b..f971fa8 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -205,19 +205,30 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
 int
 brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_dev *sdiodev, u32 address)
 {
-	int err = 0;
-	brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW,
-			 (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err);
-	if (!err)
-		brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1,
-				       SBSDIO_FUNC1_SBADDRMID,
-				       (address >> 16) & SBSDIO_SBADDRMID_MASK,
-				       &err);
-	if (!err)
-		brcmf_sdcard_cfg_write(sdiodev, SDIO_FUNC_1,
-				       SBSDIO_FUNC1_SBADDRHIGH,
-				       (address >> 24) & SBSDIO_SBADDRHIGH_MASK,
-				       &err);
+	int err = 0, i;
+	u8 addr[3];
+	s32 retry;
+
+	addr[0] = (address >> 8) & SBSDIO_SBADDRLOW_MASK;
+	addr[1] = (address >> 16) & SBSDIO_SBADDRMID_MASK;
+	addr[2] = (address >> 24) & SBSDIO_SBADDRHIGH_MASK;
+
+	for (i = 0; i < 3; i++) {
+		retry = 0;
+		do {
+			if (retry)
+				usleep_range(1000, 2000);
+			err = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE,
+					SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW + i,
+					&addr[i]);
+		} while (err != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
+
+		if (err) {
+			brcmf_dbg(ERROR, "failed at addr:0x%0x\n",
+				  SBSDIO_FUNC1_SBADDRLOW + i);
+			break;
+		}
+	}
 
 	return err;
 }
-- 
1.7.9.5



  parent reply	other threads:[~2012-05-05  1:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05  1:27 [PATCH 00/11] brcmfmac: unify register access interface Franky Lin
2012-05-05  1:27 ` [PATCH 01/11] brcmfmac: remove unused parameter of brcmf_sdcard_reg_read Franky Lin
2012-05-05  1:27 ` [PATCH 02/11] brcmfmac: remove unused parameter of brcmf_sdcard_reg_write Franky Lin
2012-05-05  1:27 ` Franky Lin [this message]
2012-05-05  1:27 ` [PATCH 04/11] brcmfmac: introduce unified register access interface for SDIO Franky Lin
2012-05-05  1:27 ` [PATCH 05/11] brcmfmac: replace brcmf_sdcard_cfg_read with brcmf_sdio_regrb Franky Lin
2012-05-05  1:27 ` [PATCH 06/11] brcmfmac: replace brcmf_sdcard_cfg_write with brcmf_sdio_regwb Franky Lin
2012-05-05  1:27 ` [PATCH 07/11] brcmfmac: replace brcmf_sdcard_reg_read with brcmf_sdio_regrl Franky Lin
2012-05-05  1:27 ` [PATCH 08/11] brcmfmac: replace brcmf_sdcard_reg_write with brcmf_sdio_regwl Franky Lin
2012-05-05  1:27 ` [PATCH 09/11] brcmfmac: remove redundant retries for SDIO core register access Franky Lin
2012-05-05  1:27 ` [PATCH 10/11] brcmfmac: remove function brcmf_sdcard_regfail Franky Lin
2012-05-05  1:27 ` [PATCH 11/11] brcmfmac: replace brcmf_sdioh_card_regread with brcmf_sdio_regrl Franky Lin

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=1336181258-7305-4-git-send-email-frankyl@broadcom.com \
    --to=frankyl@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).