On Wed, 14 Jul 2021 at 17:51, Marek Behún <marek.be...@nic.cz> wrote: > > The spi_nor_erase() function does not call mtd_erase_callback() as it > should. > > The mtdpart code currently implements the subtraction of partition > offset in mtd_erase_callback(). > > This results in partition offset being added prior calling > spi_nor_erase(), but not subtracted back on return. The result is that > the `mtd erase` command does not erase the whole partition, only some of > it's blocks: > > => mtd erase "Rescue system" > Erasing 0x00000000 ... 0x006fffff (1792 eraseblock(s)) > jedec_spi_nor spi-nor@0: at 0x100000, len 4096 > jedec_spi_nor spi-nor@0: at 0x201000, len 4096 > jedec_spi_nor spi-nor@0: at 0x302000, len 4096 > jedec_spi_nor spi-nor@0: at 0x403000, len 4096 > jedec_spi_nor spi-nor@0: at 0x504000, len 4096 > jedec_spi_nor spi-nor@0: at 0x605000, len 4096 > jedec_spi_nor spi-nor@0: at 0x706000, len 4096 > > This is obviously wrong. > > Add proper calling of mtd_erase_callback() into the spi_nor_erase() > function. > > Signed-off-by: Marek Behún <marek.be...@nic.cz> > Reported-by: Masami Hiramatsu <masami.hirama...@linaro.org> > Tested-by: Masami Hiramatsu <masami.hirama...@linaro.org> > --- > drivers/mtd/spi/spi-nor-core.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) >
Reviewed-by: Simon Glass <s...@chromium.org>