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.

Linux/AM3352: NAND firmware update issue

Part Number: AM3352

Tool/software: Linux

Hi all

My custom board use Macronix MX30LF1GE8AB nand flash, with 128MiB, SLC, page size = 2048, OOB size = 64

and other nand info:

Page size       2048b

OOB size        64b

Erase size       131072b

subpagesize    512b

options             0x4000000c

bbt options       0x8000

Now I want to upgrade my firmware in user space, so I write code like this:

fd = open("/dev/mtdN", O_RDWR|O_SYNC);
assert(/* open check */);

do{

  do_erase(fd, 0x20000); /* erase 128k */

  do{
     wlen = write(fd, buf+offser, 1k);
     fsync(fd);
  }while(/* run 128 times */);

}while(/* all firmware size */);

but when write 126times the nand flash write say only 1 byte data wire in,

but my code says 1k byte data was in,

the log show like this:

User space: the wlen return 1024byte

driver: nand driver ops: nand_write 1 byte nand: attempt to write non page aligned data

the user_space write return 1k, but driver show only 1byte data write in

my rootfs format is ubifs, so I use fsync() to sync it!

help me~plz