mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-05-09 21:11:16 +00:00
2425d6e457
Readahead fixed! Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
114 lines
3.4 KiB
Diff
114 lines
3.4 KiB
Diff
From 061d6b14b3b59f140371baa0f98963f761a7080f Mon Sep 17 00:00:00 2001
|
|
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
|
Date: Thu, 2 Feb 2012 13:54:25 +0200
|
|
Subject: [PATCH 25/87] Revert "mtd: atmel_nand: optimize read/write buffer
|
|
functions"
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
commit 500823195d0c9eec2a4637484f30cc93ec633d4a upstream.
|
|
|
|
This reverts commit fb5427508abbd635e877fabdf55795488119c2d6.
|
|
|
|
The reason is that it breaks 16 bits NAND flash as it was reported by
|
|
Nikolaus Voss and confirmed by Eric Bénard.
|
|
|
|
Nicolas Ferre <nicolas.ferre@atmel.com> alco confirmed:
|
|
"After double checking with designers, I must admit that I misunderstood
|
|
the way of optimizing accesses to SMC. 16 bit nand is not so common
|
|
those days..."
|
|
|
|
Reported-by: Nikolaus Voss <n.voss@weinmann.de>
|
|
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
|
|
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
|
|
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
---
|
|
drivers/mtd/nand/atmel_nand.c | 45 +++++++++++++++++++++++++++++++++++++---
|
|
1 files changed, 41 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
|
|
index 23e5d77..ee6e26e 100644
|
|
--- a/drivers/mtd/nand/atmel_nand.c
|
|
+++ b/drivers/mtd/nand/atmel_nand.c
|
|
@@ -161,6 +161,37 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
|
|
!!host->board->rdy_pin_active_low;
|
|
}
|
|
|
|
+/*
|
|
+ * Minimal-overhead PIO for data access.
|
|
+ */
|
|
+static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len)
|
|
+{
|
|
+ struct nand_chip *nand_chip = mtd->priv;
|
|
+
|
|
+ __raw_readsb(nand_chip->IO_ADDR_R, buf, len);
|
|
+}
|
|
+
|
|
+static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len)
|
|
+{
|
|
+ struct nand_chip *nand_chip = mtd->priv;
|
|
+
|
|
+ __raw_readsw(nand_chip->IO_ADDR_R, buf, len / 2);
|
|
+}
|
|
+
|
|
+static void atmel_write_buf8(struct mtd_info *mtd, const u8 *buf, int len)
|
|
+{
|
|
+ struct nand_chip *nand_chip = mtd->priv;
|
|
+
|
|
+ __raw_writesb(nand_chip->IO_ADDR_W, buf, len);
|
|
+}
|
|
+
|
|
+static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len)
|
|
+{
|
|
+ struct nand_chip *nand_chip = mtd->priv;
|
|
+
|
|
+ __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2);
|
|
+}
|
|
+
|
|
static void dma_complete_func(void *completion)
|
|
{
|
|
complete(completion);
|
|
@@ -235,27 +266,33 @@ err_buf:
|
|
static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
|
|
{
|
|
struct nand_chip *chip = mtd->priv;
|
|
+ struct atmel_nand_host *host = chip->priv;
|
|
|
|
if (use_dma && len > mtd->oobsize)
|
|
/* only use DMA for bigger than oob size: better performances */
|
|
if (atmel_nand_dma_op(mtd, buf, len, 1) == 0)
|
|
return;
|
|
|
|
- /* if no DMA operation possible, use PIO */
|
|
- memcpy_fromio(buf, chip->IO_ADDR_R, len);
|
|
+ if (host->board->bus_width_16)
|
|
+ atmel_read_buf16(mtd, buf, len);
|
|
+ else
|
|
+ atmel_read_buf8(mtd, buf, len);
|
|
}
|
|
|
|
static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
|
|
{
|
|
struct nand_chip *chip = mtd->priv;
|
|
+ struct atmel_nand_host *host = chip->priv;
|
|
|
|
if (use_dma && len > mtd->oobsize)
|
|
/* only use DMA for bigger than oob size: better performances */
|
|
if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0)
|
|
return;
|
|
|
|
- /* if no DMA operation possible, use PIO */
|
|
- memcpy_toio(chip->IO_ADDR_W, buf, len);
|
|
+ if (host->board->bus_width_16)
|
|
+ atmel_write_buf16(mtd, buf, len);
|
|
+ else
|
|
+ atmel_write_buf8(mtd, buf, len);
|
|
}
|
|
|
|
/*
|
|
--
|
|
1.7.7.4
|
|
|