public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bryan Wu <cooloney@kernel.org>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Cliff Cai <cliff.cai@analog.com>, Bryan Wu <cooloney@kernel.org>
Subject: [PATCH] wireless: introduce POWEROF2_BLOCKSIZE_ONLY option
Date: Thu,  5 Feb 2009 15:30:02 +0800	[thread overview]
Message-ID: <1233819002-6912-1-git-send-email-cooloney@kernel.org> (raw)

From: Cliff Cai <cliff.cai@analog.com>

Introduce POWEROF2_BLOCKSIZE_ONLY option for those SD/SDIO host
which only support transferring block with size of power-of-2

[ Bryan Wu <cooloney@kernel.org>:
 - remove some useless coding style cleanup
 - using roundup() function as upstream does
]

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/net/wireless/Kconfig            |    6 ++++++
 drivers/net/wireless/libertas/if_sdio.c |   16 ++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index e4f9f74..a2685fa 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -151,6 +151,12 @@ config LIBERTAS_SDIO
 	---help---
 	  A driver for Marvell Libertas 8385 and 8686 SDIO devices.
 
+config POWEROF2_BLOCKSIZE_ONLY
+	bool "Support transferring block with size of power-of-2 only"
+	depends on LIBERTAS_SDIO
+	---help---
+	  For SD/SDIO host which only supports transferring block with size of power-of-2.
+
 config LIBERTAS_DEBUG
 	bool "Enable full debugging output in the Libertas module."
 	depends on LIBERTAS
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 4519d73..5efc056 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -272,6 +272,11 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)
 	 */
 	chunk = sdio_align_size(card->func, size);
 
+/* For SD/SDIO host which only supports transferring block with size of power-of-2 */
+#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY)
+	chunk = (chunk + card->func->cur_blksize - 1) /
+			card->func->cur_blksize * card->func->cur_blksize;
+#endif
 	ret = sdio_readsb(card->func, card->buffer, card->ioport, chunk);
 	if (ret)
 		goto out;
@@ -581,8 +586,14 @@ static int if_sdio_prog_real(struct if_sdio_card *card)
 			lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n",
 				chunk_size, (chunk_size + 31) / 32 * 32);
 */
+/* For SD/SDIO host which only supports transferring block with size of power-of-2 */
+#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY)
+  			ret = sdio_writesb(card->func, card->ioport,
+ 				chunk_buffer, roundup(chunk_size, 256);
+#else
 			ret = sdio_writesb(card->func, card->ioport,
 				chunk_buffer, roundup(chunk_size, 32));
+#endif
 			if (ret)
 				goto release;
 
@@ -699,6 +710,11 @@ static int if_sdio_host_to_card(struct lbs_private *priv,
 	 */
 	size = sdio_align_size(card->func, nb + 4);
 
+/* For SD/SDIO host which only supports transferring block with size of power-of-2 */
+#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY)
+	size = (size + card->func->cur_blksize - 1) /
+			card->func->cur_blksize * card->func->cur_blksize;
+#endif
 	packet = kzalloc(sizeof(struct if_sdio_packet) + size,
 			GFP_ATOMIC);
 	if (!packet) {
-- 
1.5.6.3

             reply	other threads:[~2009-02-05  7:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05  7:30 Bryan Wu [this message]
2009-02-05 15:03 ` [PATCH] wireless: introduce POWEROF2_BLOCKSIZE_ONLY option Dan Williams
2009-02-06  7:47   ` Bryan Wu
2009-02-06  8:00     ` Bryan Wu
2009-02-10 16:04       ` John W. Linville
2009-02-10 16:26         ` Dan Williams
2009-02-11  3:32           ` Bryan Wu

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=1233819002-6912-1-git-send-email-cooloney@kernel.org \
    --to=cooloney@kernel.org \
    --cc=cliff.cai@analog.com \
    --cc=linux-kernel@vger.kernel.org \
    --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