Title: [6030] trunk/drivers/net/wireless: task[#4214]For SD/SDIO host which only support transferring block with size of power-of-2
Revision
6030
Author
cliff
Date
2009-01-21 21:58:52 -0600 (Wed, 21 Jan 2009)

Log Message

task[#4214]For SD/SDIO host which only support transferring block with size of power-of-2

Modified Paths

Diff

Modified: trunk/drivers/net/wireless/Kconfig (6029 => 6030)


--- trunk/drivers/net/wireless/Kconfig	2009-01-22 03:25:32 UTC (rev 6029)
+++ trunk/drivers/net/wireless/Kconfig	2009-01-22 03:58:52 UTC (rev 6030)
@@ -294,6 +294,12 @@
 	---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

Modified: trunk/drivers/net/wireless/libertas/if_sdio.c (6029 => 6030)


--- trunk/drivers/net/wireless/libertas/if_sdio.c	2009-01-22 03:25:32 UTC (rev 6029)
+++ trunk/drivers/net/wireless/libertas/if_sdio.c	2009-01-22 03:58:52 UTC (rev 6030)
@@ -263,7 +263,6 @@
 		}
 		mdelay(1);
 	}
-
 	/*
 	 * The transfer must be in one transaction or the firmware
 	 * goes suicidal. There's no way to guarantee that for all
@@ -271,6 +270,11 @@
 	 */
 	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;
@@ -337,7 +341,6 @@
 	lbs_deb_enter(LBS_DEB_SDIO);
 
 	card = container_of(work, struct if_sdio_card, packet_worker);
-
 	while (1) {
 		spin_lock_irqsave(&card->lock, flags);
 		packet = card->packets;
@@ -363,7 +366,6 @@
 			}
 			mdelay(1);
 		}
-
 		ret = sdio_writesb(card->func, card->ioport,
 				packet->buffer, packet->nb);
 		if (ret)
@@ -580,8 +582,15 @@
 			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, (chunk_size + 255) / 256 * 256);
+#else
+			ret = sdio_writesb(card->func, card->ioport,
 				chunk_buffer, (chunk_size + 31) / 32 * 32);
+#endif
 			if (ret)
 				goto release;
 
@@ -690,7 +699,6 @@
 		ret = -EINVAL;
 		goto out;
 	}
-
 	/*
 	 * The transfer must be in one transaction or the firmware
 	 * goes suicidal. There's no way to guarantee that for all
@@ -698,6 +706,11 @@
 	 */
 	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) {
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to