[PATCH] mtd: spi-nor: Add support for Cypress s25hl-t/s25hs-t

Pratyush Yadav p.yadav at ti.com
Fri Sep 25 12:11:16 CEST 2020


On 25/09/20 03:13PM, Pratyush Yadav wrote:
> > +	if (instr->addr < erasesize) {
> > +		instr_4k.addr = 0;
> > +		ret = spi_nor_erase(mtd, &instr_4k);
> > +	}
> > +	if (!ret && instr->addr + instr->len >= mtd->size - erasesize) {
> > +		instr_4k.addr = mtd->size - instr_4k.len;
> > +		ret = spi_nor_erase(mtd, &instr_4k);

I missed this before, but say I want to erase all but the last sector on 
a 64Mb flash. So I would issue an erase from 0x0 with length 0x3fc0000. 
So instr->addr + instr->len == 0x3fc0000. And mtd->size == 0x4000000 and 
erasesize == 0x40000. So, mtd->size - erasesize == 0x3fc0000, making 
this condition true. This means that even if I want to erase all but the 
last sector I will end up erasing the last 128k as well.

The '=' needs to be dropped from the comparison.

-- 
Regards,
Pratyush Yadav
Texas Instruments India


More information about the U-Boot mailing list