[U-Boot] [PATCH v3 14/28] sf: probe: Add support for erase sector selection flag
Sascha Silbe
t-uboot at infra-silbe.de
Sat Sep 21 20:59:54 CEST 2013
Hi Jagannadha,
Jagannadha Sutradharudu Teki <jagannadha.sutradharudu-teki at xilinx.com>
writes:
> SECT_4K, SECT_32K and SECT_64K opeartions are performed to
> to specific flash by adding a SECT* flag on respective
> spi_flash_params.flag param.
[...]
[drivers/mtd/spi/spi_flash_ops.c]
> @@ -153,17 +153,13 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)
> u8 cmd[4];
> int ret = -1;
>
> - erase_size = flash->sector_size;
> + erase_size = flash->erase_size;
> if (offset % erase_size || len % erase_size) {
> debug("SF: Erase offset/length not multiple of erase size\n");
> return -1;
> }
>
> - if (erase_size == 4096)
> - cmd[0] = CMD_ERASE_4K;
> - else
> - cmd[0] = CMD_ERASE_64K;
> -
> + cmd[0] = flash->erase_cmd;
[...]
[drivers/mtd/spi/spi_flash_probe.c]
[...]
> + {"W25Q32BV", 0xef4016, 0x0, 64 * 1024, 64, SEC_4K},
[...]
I don't quite see the point of this patch. AFAICT, at least the Winbond
chips support _both_ sector-sized and block-sized (32KiB, 64KiB)
erases. The latter are just a more efficient way of erasing larger
regions. So selecting the command to use should be based on the size and
alignment of the region that's going to be erased, not based on the size
of the chip.
In addition, a couple of typos (SEC_* instead of SECT_*) break the
build.
Sascha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/5ea9ed3c/attachment.pgp>
More information about the U-Boot
mailing list