* [U-Boot] [PATCH] s3c2410_nand add missing functions for CONFIG_NAND_SPL
@ 2009-10-29 9:12 Hui.Tang
2009-10-29 23:51 ` Scott Wood
0 siblings, 1 reply; 3+ messages in thread
From: Hui.Tang @ 2009-10-29 9:12 UTC (permalink / raw)
To: u-boot
add missing functios nand_read_byte(), nand_write_buf(), nand_read_buf() for CONFIG_NAND_SPL config, also set nand->select_chip = NULL, since in nand_boot() we will check it to do a select_chip action.
---
drivers/mtd/nand/s3c2410_nand.c | 39 +++++++++++++++++++++++++++++++++++++--
1 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index f2f3e72..fe61ab4 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -36,6 +36,32 @@
#define S3C2410_ADDR_NALE 4
#define S3C2410_ADDR_NCLE 8
+#ifdef CONFIG_NAND_SPL
+static u_char nand_read_byte(struct mtd_info *mtd)
+{
+ struct nand_chip *this = mtd->priv;
+ return readb(this->IO_ADDR_R);
+}
+
+static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
+{
+ int i;
+ struct nand_chip *this = mtd->priv;
+
+ for (i = 0; i < len; i++)
+ writeb(buf[i], this->IO_ADDR_W);
+}
+
+static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+ int i;
+ struct nand_chip *this = mtd->priv;
+
+ for (i = 0; i < len; i++)
+ buf[i] = readb(this->IO_ADDR_R);
+}
+#endif
+
static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct nand_chip *chip = mtd->priv;
@@ -100,7 +126,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
read_ecc[2] == calc_ecc[2])
return 0;
- printf("s3c2410_nand_correct_data: not implemented\n");
+ DEBUGN("s3c2410_nand_correct_data: not implemented\n");
return -1;
}
#endif
@@ -130,8 +156,15 @@ int board_nand_init(struct nand_chip *nand)
/* initialize nand_chip data structure */
nand->IO_ADDR_R = nand->IO_ADDR_W = (void *)&nand_reg->NFDATA;
+ nand->select_chip = NULL;
+
/* read_buf and write_buf are default */
/* read_byte and write_byte are default */
+#ifdef CONFIG_NAND_SPL
+ nand->read_byte = nand_read_byte;
+ nand->write_buf = nand_write_buf;
+ nand->read_buf = nand_read_buf;
+#endif
/* hwcontrol always must be implemented */
nand->cmd_ctrl = s3c2410_hwcontrol;
@@ -142,7 +175,9 @@ int board_nand_init(struct nand_chip *nand)
nand->ecc.hwctl = s3c2410_nand_enable_hwecc;
nand->ecc.calculate = s3c2410_nand_calculate_ecc;
nand->ecc.correct = s3c2410_nand_correct_data;
- nand->ecc.mode = NAND_ECC_HW3_512;
+ nand->ecc.mode = NAND_ECC_HW;
+ nand->ecc.size = CONFIG_SYS_NAND_ECCSIZE;
+ nand->ecc.bytes = CONFIG_SYS_NAND_ECCBYTES;
#else
nand->ecc.mode = NAND_ECC_SOFT;
#endif
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] s3c2410_nand add missing functions for CONFIG_NAND_SPL
2009-10-29 9:12 [U-Boot] [PATCH] s3c2410_nand add missing functions for CONFIG_NAND_SPL Hui.Tang
@ 2009-10-29 23:51 ` Scott Wood
2009-10-30 4:20 ` Hui Tang
0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2009-10-29 23:51 UTC (permalink / raw)
To: u-boot
On Thu, Oct 29, 2009 at 05:12:14PM +0800, Hui.Tang wrote:
> add missing functios nand_read_byte(), nand_write_buf(), nand_read_buf()
> for CONFIG_NAND_SPL config, also set nand->select_chip = NULL, since in
> nand_boot() we will check it to do a select_chip action.
Why do you need to write to the buffer in the NAND SPL? I don't think you
need read_byte either.
-Scott
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] s3c2410_nand add missing functions for CONFIG_NAND_SPL
2009-10-29 23:51 ` Scott Wood
@ 2009-10-30 4:20 ` Hui Tang
0 siblings, 0 replies; 3+ messages in thread
From: Hui Tang @ 2009-10-30 4:20 UTC (permalink / raw)
To: u-boot
Dear Scott,
> Why do you need to write to the buffer in the NAND SPL? ?I don't think you
> need read_byte either.
Yes, we don't use nand_read_byte() and nand_write_buf(), it's just
copy from drivers/mtd/nand/s3c64xx.c.
BR.
Hui.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-30 4:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 9:12 [U-Boot] [PATCH] s3c2410_nand add missing functions for CONFIG_NAND_SPL Hui.Tang
2009-10-29 23:51 ` Scott Wood
2009-10-30 4:20 ` Hui Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox