]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: dw_mmc: handle unaligned buffers and sizes
authorJames Hogan <james.hogan@imgtec.com>
Fri, 24 Jun 2011 12:57:56 +0000 (13:57 +0100)
committerChris Ball <cjb@laptop.org>
Wed, 20 Jul 2011 21:21:00 +0000 (17:21 -0400)
commitcce1a346139cc8fed20ec6a952a03abf2eb62f1c
tree15d2d1ef438f9418bf1ccfadb5ec30bad772d6d1
parentedebfe2c3d82e58a023ded193b1c868ed400c062
mmc: dw_mmc: handle unaligned buffers and sizes

Update functions for PIO pushing and pulling data to and from the FIFO
so that they can handle unaligned output buffers and unaligned buffer
lengths. This makes more of the tests in mmc_test pass.

Unaligned lengths in pulls are handled by reading the full FIFO item,
and storing the remaining bytes in a small internal buffer (part_buf).
The next data pull will copy data out of this buffer first before
accessing the FIFO again. Similarly, for pushes the final bytes that
don't fill a FIFO item are stored in the part_buf (or sent anyway if
it's the last transfer), and then the part_buf is included at the
beginning of the next buffer pushed.

Unaligned buffers in pulls are handled specially if the architecture
cannot do efficient unaligned accesses, by reading FIFO items into a
aligned local buffer, and memcpy'ing them into the output buffer, again
storing any remaining bytes in the internal buffer. Similarly for pushes
the buffer is memcpy'd into an aligned local buffer then written to the
FIFO.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/dw_mmc.c
include/linux/mmc/dw_mmc.h