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

Kuwano Takahiro tkuw584924 at gmail.com
Mon Sep 28 09:22:33 CEST 2020



On 9/25/2020 7:11 PM, Pratyush Yadav wrote:
> 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.
> 

Thanks for pointing out this. Will fix.

--
Best Regards,
Takahiro Kuwano


More information about the U-Boot mailing list