From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuwano Takahiro Date: Mon, 28 Sep 2020 16:22:33 +0900 Subject: [PATCH] mtd: spi-nor: Add support for Cypress s25hl-t/s25hs-t In-Reply-To: <20200925101114.fcgq6btoxi3gqw5p@ti.com> References: <20200924074302.7708-1-Takahiro.Kuwano@infineon.com> <20200925094324.h5zxqsukgzd4xntn@ti.com> <20200925101114.fcgq6btoxi3gqw5p@ti.com> Message-ID: <5d2be5c6-ee6a-67f4-e1ba-94be3cca5417@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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