This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

mtd-utils nandwrite problem

We use DVRRDK 03.00.00.00 based software with DM8168 UDWORKS hardware. We have problem with mtd-utils 1.5.0 (mtd-utils-b0f3b6e). We use Nand FLASH K92G08U0B 256MB.

Errors occurs while writing to FLASH with nandwrite. At every erase/write other blocks are affected.

 

flash_erase /dev/mtd5 0 0

Erase MTD block /dev/mtd5 Erasing 128 Kibyte @ 4800000 -- 100 % complete

nandwrite -p /dev/mtd5 /var/update.bin

Write to MTD block /dev/mtd5 offs: len:34969332

Writing data to block 0 at offset 0x0

Writing data to block 1 at offset 0x20000

Writing data to block 2 at offset 0x40000

Writing data to block 3 at offset 0x60000

Writing data to block 4 at offset 0x80000

Writing data to block 5 at offset 0xa0000

Writing data to block 6 at offset 0xc0000

Writing data to block 7 at offset 0xe0000

Writing data to block 8 at offset 0x100000

Writing data to block 9 at offset 0x120000

Writing data to block 10 at offset 0x140000

Writing data to block 11 at offset 0x160000

 libmtd: error!: cannot write 2048 bytes to mtd5 (eraseblock 11, offset 14336)  

       error 5 (Input/output error)

 

Does anybody got similar problems with nandwrite ?

  • Found the Problem.

    In linux/drivers/mtd/nand/omap2.c

    I put timeout query into loop.

    This gives gpmc_nand_read() the opportunity to run before a timeout can occur.

     

    // while (time_before(jiffies, timeo))

    // {

    //  status = gpmc_nand_read(info->gpmc_cs, GPMC_NAND_DATA);

    //  if (status & NAND_STATUS_READY)

    //   break; //  cond_resched();

    // }

    //>>

     while(1)     {        

      status = gpmc_nand_read(info->gpmc_cs, GPMC_NAND_DATA);        

      if (status & NAND_STATUS_READY)

                 break;

      if( time_before(jiffies, timeo) )

                break;

      cond_resched();

    }

    //<<