summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/omap_gpmc.c
diff options
context:
space:
mode:
authorJustin Waters <justin.waters@timesys.com>2013-05-14 16:19:57 -0400
committerJustin Waters <justin.waters@timesys.com>2013-05-14 16:19:57 -0400
commit266c19c9cd6808e0d2546ce084e97fa73a1e0a2c (patch)
treefcf8d5259327651441cab0d11465ccdbe77bc520 /drivers/mtd/nand/omap_gpmc.c
parent15473818068d8de6672d6a83a6888ed40b1f9811 (diff)
LogicPD Support for OMAP3/DM3/AM3 boards 2.4 Update
Diffstat (limited to 'drivers/mtd/nand/omap_gpmc.c')
-rw-r--r--drivers/mtd/nand/omap_gpmc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index 6bb37a5660a..82f7d4c318d 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -64,9 +64,10 @@ void omap_dma_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len)
return;
}
- /* Invalidate the datacache for the buffer, program the DMA and wait
- * for it to finish */
- invalidate_dcache_range((unsigned long)p, (unsigned long)(p + len));
+ /* Invalidate the data cache for the buffer, program the DMA and wait *
+ * for it to finish. buf is a word pointer, len is a byte count, so we *
+ * need to calculate the range using (len / 2) */
+ invalidate_dcache_range((unsigned long)p, (unsigned long)(p + (len / 2)));
/* Transfer the data(and wait to complete) */
@@ -657,7 +658,15 @@ void omap_nand_switch_ecc(enum omap_nand_ecc_mode mode)
nand->options |= NAND_OWN_BUFFERS;
- /* Reset ecc interface */
+#ifdef CONFIG_OMAP_DMA
+ omap3_dma_channel_init(DMA_CHANNEL_NAND, -1, CSDP_DATA_TYPE_32BIT, CCR_SRC_AMODE_CONSTANT, CCR_DST_AMODE_POST_INC);
+ if (nand->options & NAND_BUSWIDTH_16)
+ nand->read_buf = omap_dma_read_buf16;
+ else
+ printf("%s: Huh? not 16-bit for DMA\n", __FUNCTION__);
+#endif
+
+ /* Reset ecc interface */
nand->ecc.read_page = NULL;
nand->ecc.write_page = NULL;
nand->ecc.read_oob = NULL;
@@ -731,13 +740,6 @@ void omap_nand_switch_ecc(enum omap_nand_ecc_mode mode)
nand->ecc.hwctl = omap_enable_chip_hwecc;
nand->ecc.correct = omap_correct_chip_hwecc;
nand->ecc.read_oob = omap_read_oob_chipecc;
-#ifdef CONFIG_OMAP_DMA
- omap3_dma_channel_init(DMA_CHANNEL_NAND, -1, CSDP_DATA_TYPE_32BIT, CCR_SRC_AMODE_CONSTANT, CCR_DST_AMODE_POST_INC);
- if (nand->options & NAND_BUSWIDTH_16)
- nand->read_buf = omap_dma_read_buf16;
- else
- printf("%s: Huh? not 16-bit for DMA\n", __FUNCTION__);
-#endif
nand->ecc.mode = NAND_ECC_CHIP; /* internal to chip */
nand->ecc.layout = &chip_nand_oob;
if (nand->options & NAND_BUSWIDTH_16)