]> git.baikalelectronics.ru Git - uboot.git/commit
cmd: sf: Handle unaligned 'update' start offset
authorMarek Vasut <marex@denx.de>
Wed, 28 Sep 2022 16:45:04 +0000 (18:45 +0200)
committerJagan Teki <jagan@edgeble.ai>
Tue, 25 Oct 2022 04:47:33 +0000 (10:17 +0530)
commitd8356e4c62f02bc0cf24beef3bc34c018cd8ae9c
treea3ec1cec885e4c84d27efb7e2ec9cb33b5087704
parente383e700e6b87191b357ea7db9aebeee43e8d833
cmd: sf: Handle unaligned 'update' start offset

Currently the 'sf update' command fails in case the 'start' offset is
not aligned to SPI NOR erase block size. Add the missing alignment
calculation. In case the start offset is in the middle of erase block,
round start address down to the nearest aligned one, compare only the
updated data between what is in the SPI NOR and what is being written,
copy new data at offset of the compare buffer, and write back the entire
erase block.

This is useful e.g. on i.MX6Q where the u-boot-with-spl.imx is at
offset 0x400 in the SPI NOR, while the SPI NOR may have erase block
size e.g. 0x1000 bytes.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
cmd/sf.c