[U-Boot] [U-boot] sf: API for spi_flash_get_sector_size

Wolfgang Denk wd at denx.de
Tue Feb 8 15:40:08 CET 2011


Dear Richard Retanubun,

In message <4D514F6E.6040101 at RuggedCom.com> you wrote:
> 
> When calling spi_flash_erase, which eventually calls stmicro_erase, one must do so while knowing
> what the sector_size is of the flash. Is there a recommened API to getting this from struct stmicro_spi_flash_params?

Why would you need to know the sector size?

To align your erase command accordingly?  I think you are taking the
wrong approach here.  Look at how NOR flash is handled: we don't need
to know the sector sizes there either.  Instead we support the format
"+N" (often used as "+${fileszize}") which will _internally_ round up
N to match the next erase block boundary.

Do the same for SPI flash.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The first thing we do is kill all the lawyers.
(Shakespeare. II Henry VI, Act IV, scene ii)


More information about the U-Boot mailing list