On Tue, 31 Jul 2007 16:36:33 +0100
David Vrabel <[email protected]> wrote:
> Extend sdio_readsb(), sdio_writesb(), sdio_memcpy_fromio(), and
> sdio_memcpy_toio() to handle any length of buffer by splitting the
> transfer into several IO_RW_EXTENDED commands. Typically, a transfer
> would be split into a single block mode transfer followed by a byte
> mode transfer for the remainder.
>
> For this to work the block size must be limited to the maximum size
> of a byte mode transfer (512 bytes). This limitation could be
> revisited if there are any cards out there that require a block size
> > 512.
>
> Signed-off-by: David Vrabel <[email protected]>
>
*snip*
> @@ -228,6 +235,39 @@ void sdio_writeb(struct sdio_func *func,
> unsigned char b, unsigned int addr,
> EXPORT_SYMBOL_GPL(sdio_writeb);
>
> +/* Split an arbitrarily sized data transfer into several
> + * IO_RW_EXTENDED commands. */
> +static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
> + unsigned fn, unsigned addr, int incr_addr, u8 *buf, unsigned
> size) +{
> + unsigned remainder = size;
> + int ret;
> +
> + while (remainder > func->block_size) {
> + unsigned blocks;
> +
> + blocks = remainder % func->block_size;
> + if (blocks > 511)
> + blocks = 511;
You need to check how many blocks the host supports in one go. Also,
the total size of the transfer might exceed the host's capabilities.
> @@ -113,18 +112,22 @@ int mmc_io_rw_extended(struct mmc_card *card,
> int write, unsigned fn, cmd.opcode = SD_IO_RW_EXTENDED;
> cmd.arg = write ? 0x80000000 : 0x00000000;
> cmd.arg |= fn << 28;
> - cmd.arg |= bang ? 0x00000000 : 0x04000000;
> + cmd.arg |= incr_addr ? 0x04000000 : 0x00000000;
> cmd.arg |= addr << 9;
> - cmd.arg |= (size == 512) ? 0 : size;
> + if (blocks > 1) {
> + cmd.arg |= 0x08000000;
> + cmd.arg |= blocks;
> + } else
> + cmd.arg |= (blksz == 512) ? 0 : blksz;
> cmd.flags = MMC_RSP_R5 | MMC_CMD_ADTC;
>
Until this function is made complete, I'd like some kind of test that
blksz <= 512 when blocks == 1.
--
-- Pierre Ossman
Linux kernel, MMC maintainer http://www.kernel.org
PulseAudio, core developer http://pulseaudio.org
rdesktop, core developer http://www.rdesktop.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]