aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmc
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2011-06-24 08:57:56 -0400
committerChris Ball <cjb@laptop.org>2011-07-20 17:21:00 -0400
commit34b664a20e2664de0d0d7990ca60276b96c08c75 (patch)
tree15d2d1ef438f9418bf1ccfadb5ec30bad772d6d1 /include/linux/mmc
parentb86d825323b4c5d0c406e5b1a85af614acf0cf5a (diff)
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>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r--include/linux/mmc/dw_mmc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 01db1a0b3dd1..f3f68ee08a1e 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -76,6 +76,9 @@ struct mmc_data;
76 * @slot: Slots sharing this MMC controller. 76 * @slot: Slots sharing this MMC controller.
77 * @fifo_depth: depth of FIFO. 77 * @fifo_depth: depth of FIFO.
78 * @data_shift: log2 of FIFO item size. 78 * @data_shift: log2 of FIFO item size.
79 * @part_buf_start: Start index in part_buf.
80 * @part_buf_count: Bytes of partial data in part_buf.
81 * @part_buf: Simple buffer for partial fifo reads/writes.
79 * @push_data: Pointer to FIFO push function. 82 * @push_data: Pointer to FIFO push function.
80 * @pull_data: Pointer to FIFO pull function. 83 * @pull_data: Pointer to FIFO pull function.
81 * @quirks: Set of quirks that apply to specific versions of the IP. 84 * @quirks: Set of quirks that apply to specific versions of the IP.
@@ -149,6 +152,13 @@ struct dw_mci {
149 /* FIFO push and pull */ 152 /* FIFO push and pull */
150 int fifo_depth; 153 int fifo_depth;
151 int data_shift; 154 int data_shift;
155 u8 part_buf_start;
156 u8 part_buf_count;
157 union {
158 u16 part_buf16;
159 u32 part_buf32;
160 u64 part_buf;
161 };
152 void (*push_data)(struct dw_mci *host, void *buf, int cnt); 162 void (*push_data)(struct dw_mci *host, void *buf, int cnt);
153 void (*pull_data)(struct dw_mci *host, void *buf, int cnt); 163 void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
154 164