All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/10] mtd: nand: s3c: Add S3C2440 buffer reading
Date: Sat, 11 Oct 2014 18:42:54 +0200	[thread overview]
Message-ID: <1413045778-5690-6-git-send-email-marex@denx.de> (raw)
In-Reply-To: <1413045778-5690-1-git-send-email-marex@denx.de>

Add buffer reading code, should make the IO a little faster.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/mtd/nand/s3c2410_nand.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index 4971342..91db6ca 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -10,6 +10,7 @@
 #include <nand.h>
 #include <asm/arch/s3c24x0_cpu.h>
 #include <asm/io.h>
+#include <asm/unaligned.h>
 
 #define S3C2410_NFCONF_EN          (1<<15)
 #define S3C2440_NFCONT_EN          (1<<0)
@@ -45,6 +46,39 @@ static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	for (i = 0; i < len; i++)
 		buf[i] = readb(this->IO_ADDR_R);
 }
+#elif !defined(CONFIG_S3C2410)
+static void s3c2440_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+	struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
+	uint32_t data;
+
+	while (len >= 4) {
+		data = readl(&nand->nfdata);
+		put_unaligned_le32(data, buf);
+		buf += 4;
+		len -= 4;
+	}
+
+	for (; len & 3; len--)
+		*buf++ = readb(&nand->nfdata);
+}
+
+static void s3c2440_write_buf(struct mtd_info *mtd, const u_char *buf,
+			      int len)
+{
+	struct s3c24x0_nand *nand = s3c24x0_get_base_nand();
+	uint32_t data;
+
+	while (len >= 4) {
+		data = get_unaligned_le32(buf);
+		writel(data, &nand->nfdata);
+		buf += 4;
+		len -= 4;
+	}
+
+	for (; len & 3; len--, buf++)
+		writeb(*buf, &nand->nfdata);
+}
 #endif
 
 static void s3c24x0_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
@@ -177,6 +211,9 @@ int board_nand_init(struct nand_chip *nand)
 	/* read_byte and write_byte are default */
 #ifdef CONFIG_NAND_SPL
 	nand->read_buf = nand_read_buf;
+#elif !defined(CONFIG_S3C2410)
+	nand->read_buf = s3c2440_read_buf;
+	nand->write_buf = s3c2440_write_buf;
 #endif
 
 	/* hwcontrol always must be implemented */
-- 
2.1.1

  parent reply	other threads:[~2014-10-11 16:42 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-11 16:42 [U-Boot] [PATCH 01/10] video: Add S3C24xx framebuffer support Marek Vasut
2014-10-11 16:42 ` [U-Boot] [PATCH 02/10] arm: s3c24xx: Fix incorrect CONFIG_SYS_S3C2410_NAND_HWECC name Marek Vasut
2014-11-27  2:03   ` [U-Boot] [U-Boot, " Scott Wood
2015-05-02  0:46     ` Marek Vasut
2015-05-02  1:11       ` Scott Wood
2015-05-02  1:18         ` Marek Vasut
2015-05-02  3:41           ` Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 03/10] mtd: nand: s3c: Fix data type width in debug() Marek Vasut
2014-11-27  2:06   ` [U-Boot] [U-Boot, " Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 04/10] mtd: nand: s3c: Unify the register definition and naming Marek Vasut
2014-10-11 16:42 ` [U-Boot] [PATCH 05/10] mtd: nand: s3c: Add S3C2440 specifics Marek Vasut
2014-11-27  2:20   ` [U-Boot] [U-Boot,05/10] " Scott Wood
2015-05-02  0:48     ` Marek Vasut
2015-05-02  1:05       ` Scott Wood
2014-10-11 16:42 ` Marek Vasut [this message]
2014-10-11 16:42 ` [U-Boot] [PATCH 07/10] mtd: nand: s3c: Add missing correction and select_chip functions Marek Vasut
2014-10-28 22:45   ` Scott Wood
2016-01-14  1:41     ` Marek Vasut
2016-02-12 23:18       ` Scott Wood
2016-02-19 17:53         ` Marek Vasut
2016-02-19 17:54           ` Scott Wood
2014-10-11 16:42 ` [U-Boot] [PATCH 08/10] i2c: s3c: Implant support for S3C2440 Marek Vasut
2015-05-02  1:12   ` Marek Vasut
2015-05-06  8:02     ` Minkyu Kang
2014-10-11 16:42 ` [U-Boot] [PATCH 09/10] gpio: s3c: Fix the GPIO driver Marek Vasut
2015-05-02  1:12   ` Marek Vasut
2015-05-06  8:02     ` Minkyu Kang
2014-10-11 16:42 ` [U-Boot] [PATCH 10/10] net: smc911x: Keep MAC programmed Marek Vasut
2014-11-10 21:29   ` [U-Boot] [U-Boot,10/10] " Tom Rini
2014-10-16  9:28 ` [U-Boot] [PATCH 01/10] video: Add S3C24xx framebuffer support Anatolij Gustschin
2015-05-02  1:12   ` Marek Vasut
2016-02-19 18:02     ` Anatolij Gustschin
2016-02-19 18:37       ` Marek Vasut
2016-02-22 17:10 ` Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413045778-5690-6-git-send-email-marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.