struct mv_priv *priv = (struct mv_priv *)sata_dev_desc[port].priv;
struct crqb *req;
int slot;
+ u32 start;
if (len >= 64 * 1024) {
printf("We only support <64K transfers for now\n");
CRQB_SECTCOUNT_COUNT_EXP_MASK;
/* Flush data */
- flush_dcache_range((u32)req, (u32)req + sizeof(*req));
+ start = (u32)req & ~(ARCH_DMA_MINALIGN - 1);
+ flush_dcache_range(start,
+ start + ALIGN(sizeof(*req), ARCH_DMA_MINALIGN));
/* Trigger operation */
slot = get_next_reqip(port);
process_responses(port);
/* Invalidate data on read */
- if (buffer && len)
- invalidate_dcache_range((u32)buffer, (u32)buffer + len);
+ if (buffer && len) {
+ start = (u32)buffer & ~(ARCH_DMA_MINALIGN - 1);
+ invalidate_dcache_range(start,
+ start + ALIGN(len, ARCH_DMA_MINALIGN));
+ }
return len;
}