I'm trying to write data to MTD device like this topic: Write on a mtd block device
But when I use /dev/mtd0, I just read right first byte, another byte still 0xFF, like:
MTD Type: 3
MTD total size: 200000 bytes
MTD erase size: 1000 bytes
buf[0] = 0xde
buf[1] = 0xff
buf[2] = 0xff
buf[3] = 0xff
...
buf[18] = 0xff
buf[19] = 0xff
When I use /dev/mtdblock0, this working right.
MTD Type: 10
MTD total size: befcfb60 bytes
MTD erase size: 0 bytes
buf[0] = 0xde
buf[1] = 0xad
buf[2] = 0xbe
buf[3] = 0xef
...
buf[18] = 0xbe
buf[19] = 0xef
Furthermore, when I check flash content by hexdump /dev/mtd0 -n64 -C and hexdump /dev/mtdblock0 -n64 -C then the contents of both are same.
Final purpose is use /dev/mtd0 not mtdblock, please help me
I was researched and realize this issue occurs due to my flash device
I saw where performing multi-byte writes to a SST25VF016B would fail. To fix it, we can fix the application from write multi-byte to write every byte like:
Or we can fix into kernel with reference patches at: https://lore.kernel.org/lkml/[email protected]/T/