Message ID | 1348155850-26174-1-git-send-email-arnout@mind.be (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, 2012-09-20 at 17:44 +0200, Arnout Vandecappelle (Essensium/Mind) wrote: > It's difficult to reproduce the error, because the buffers are > aligned most of the time. Can you just take one of the mtd tests (e.g., mtd_speedtest), amend it a little and make sure it uses unaligned buffers? > Perhaps a better method is to fetch the first few unaligned bytes > with the prefetch method, and then continue with DMA. However, > since it's hard to force an unaligned buffer, it's also hard to > test that this method works. Yes, this would be a lot cleaner.
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index c719b86..a313e83 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -441,7 +441,7 @@ out_copy: */ static void omap_read_buf_dma_pref(struct mtd_info *mtd, u_char *buf, int len) { - if (len <= mtd->oobsize) + if (len <= mtd->oobsize || !IS_ALIGNED((unsigned long)buf, 4)) omap_read_buf_pref(mtd, buf, len); else /* start transfer in DMA mode */ @@ -457,7 +457,7 @@ static void omap_read_buf_dma_pref(struct mtd_info *mtd, u_char *buf, int len) static void omap_write_buf_dma_pref(struct mtd_info *mtd, const u_char *buf, int len) { - if (len <= mtd->oobsize) + if (len <= mtd->oobsize || !IS_ALIGNED((unsigned long)buf, 4)) omap_write_buf_pref(mtd, buf, len); else /* start transfer in DMA mode */