Re: [PATCH] AT91RM9200 NAND support

Thomas Gleixner
2006-06-20T15:52:56Z

Savin,

On Tue, 2006-06-20 at 17:53 +0200, Savin Zlobec wrote:
> >
> The problem is in nand_wait, the function is called (when writting files
> to jffs2) with
> chip->state=FL_READING and state=FL_WRITING and consequently the waiting
> is terminated instantly (chip->state != state) leaving the chip in busy
> state.

The problem is the calling code. Doh - where is the brown paperbag ?

Thanks for tracking that down.

tglx

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 77406fc..0fd1052 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -501,7 +501,6 @@ static void nand_command(struct mtd_info
case NAND_CMD_ERASE2:
case NAND_CMD_SEQIN:
case NAND_CMD_STATUS:
- chip->cmd_ctrl(mtd, NAND_CMD_NONE, NAND_NCE);
return;

case NAND_CMD_RESET:
@@ -1532,7 +1531,7 @@ static int nand_write(struct mtd_info *m
if (!len)
return 0;

- nand_get_device(chip, mtd, FL_READING);
+ nand_get_device(chip, mtd, FL_WRITING);

chip->ops.len = len;
chip->ops.datbuf = (uint8_t *)buf;
@@ -1659,7 +1658,7 @@ static int nand_write_oob(struct mtd_inf
return -EINVAL;
}

- nand_get_device(chip, mtd, FL_READING);
+ nand_get_device(chip, mtd, FL_WRITING);

switch(ops->mode) {