r3632 - developers/sameo/patches/ar6k-ng

sameo at sita.openmoko.org sameo at sita.openmoko.org
Tue Dec 11 22:04:06 CET 2007


Author: sameo
Date: 2007-12-11 22:04:05 +0100 (Tue, 11 Dec 2007)
New Revision: 3632

Added:
   developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch
Modified:
   developers/sameo/patches/ar6k-ng/series
Log:
ar6k-ng: Added a generic SDIO rw function.


Added: developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch
===================================================================
--- developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch	2007-12-11 20:57:55 UTC (rev 3631)
+++ developers/sameo/patches/ar6k-ng/155-sdio_io_generic_rw.patch	2007-12-11 21:04:05 UTC (rev 3632)
@@ -0,0 +1,75 @@
+---
+ drivers/mmc/core/sdio_io.c |   60 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 60 insertions(+)
+
+Index: linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c
+===================================================================
+--- linux-2.6.22-atheros-ng.orig/drivers/mmc/core/sdio_io.c	2007-12-11 22:00:41.000000000 +0100
++++ linux-2.6.22-atheros-ng/drivers/mmc/core/sdio_io.c	2007-12-11 22:01:56.000000000 +0100
+@@ -254,6 +254,66 @@
+ 	return 0;
+ }
+ 
++int sdio_io_rw(struct sdio_func *func, int write, int block, int block_size, int block_count,
++	       unsigned addr, int incr_addr, u8 *buf, unsigned size)
++{
++	unsigned remainder = size;
++	unsigned max_blocks;
++	int ret;
++
++	/* Do the bulk of the transfer using block mode (if supported). */
++	if (func->card->cccr.multi_block && block) {
++		/* Blocks per command is limited by host count, host transfer
++		 * size (we only use a single sg entry) and the maximum for
++		 * IO_RW_EXTENDED of 511 blocks. */
++		max_blocks = min(min(
++			func->card->host->max_blk_count,
++			func->card->host->max_seg_size / block_size),
++			511u);
++
++		while (remainder > block_size) {
++			if (block_count > max_blocks) {
++				printk("Request block count %d > max %d\n", block_count, max_blocks);
++				block_count = max_blocks;
++			}
++			size = block_count * block_size;
++
++			ret = mmc_io_rw_extended(func->card, write,
++						 func->num, addr, incr_addr, buf,
++						 block_count, block_size);
++			if (ret)
++				return ret;
++
++			remainder -= size;
++			buf += size;
++			if (incr_addr)
++				addr += size;
++		}
++	}
++
++	/* Write the remainder using byte mode. */
++	while (remainder > 0) {
++		size = remainder;
++		if (size > block_size)
++			size = block_size;
++		if (size > 512)
++			size = 512; /* maximum size for byte mode */
++
++		ret = mmc_io_rw_extended(func->card, write, func->num, addr,
++					 incr_addr, buf, 1, size);
++		if (ret)
++			return ret;
++
++		remainder -= size;
++		buf += size;
++		if (incr_addr)
++			addr += size;
++	}
++	return 0;
++}
++
++EXPORT_SYMBOL_GPL(sdio_io_rw);
++
+ /**
+  *	sdio_readb - read a single byte from a SDIO function
+  *	@func: SDIO function to access

Modified: developers/sameo/patches/ar6k-ng/series
===================================================================
--- developers/sameo/patches/ar6k-ng/series	2007-12-11 20:57:55 UTC (rev 3631)
+++ developers/sameo/patches/ar6k-ng/series	2007-12-11 21:04:05 UTC (rev 3632)
@@ -4,3 +4,5 @@
 130-gta02v2.patch
 140-s3c24xx_mci_platform.patch
 150-mmc_powerup_delay.patch
+155-sdio_io_generic_rw.patch
+160-ar6k_ng.patch





More information about the commitlog mailing list