Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fw_setenv: fix bug when SPI flash write size != sector size
Some SPI flash have a write size that is different (smaller) than the sector size. For example, the sst25vf016b has an erase size of 4096, but a write size of 1 byte. For this flash device, the write() function will be called with a size equal to the sector size of 4096, and the return value will incorrectly be set to 4096, indicating that 4096 bytes have been written to the device. However, after inspecting the flash content, only the first byte is written to the device, and the remaining 4095 bytes are all 0xFF. Fix this incorrect behavior by adapting mtdwrite() to use the write size obtained from the MEMGETINFO ioctl when writing data. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Stefano Babic <sbabic@denx.de>
- Loading branch information