mbox series

[0/2] introduce SNOR_ID3()

Message ID 20220510140232.3519184-1-michael@walle.cc
Headers show
Series introduce SNOR_ID3() | expand

Message

Michael Walle May 10, 2022, 2:02 p.m. UTC
For support which rely solely on the SFDP data, all we need to know is its
JEDEC ID. All further information should be fetched from SFDP. For this,
introduce a SNOR_ID3() macro which should be used for all new flashes with
SFDP.

The dropped information are page size, number of sectors and sector size.
The number of sectors (together with sector size) is only used to calculate
the total flash size. In case of SFDP, this is read from there. The sector
size is also used to select a proper erase opcode. We can just keep that
one zero and the selection algorithm will select the same erase opcode;
that is the opcode for the largest erase size (which is btw rather odd..).
The page size is also taken from SFDP. There is one exception: older SFDP
tables. These doesn't contain this data. So if there will be flashes with
that, we should assume some sane value.

Shaik, could you please re-test your w25q512nwm support with this patch. I
read through the SFDP data and it should behave exactly the same as before.

Michael Walle (2):
  mtd: spi-nor: introduce SNOR_ID3()
  mtd: spi-nor: winbond: use SNOR_ID3() for w25q512nwm

 drivers/mtd/spi-nor/core.c    | 7 +++++--
 drivers/mtd/spi-nor/core.h    | 9 +++++++++
 drivers/mtd/spi-nor/winbond.c | 3 +--
 3 files changed, 15 insertions(+), 4 deletions(-)

Comments

Michael Walle May 10, 2022, 2:03 p.m. UTC | #1
[proper subject]

Am 2022-05-10 16:02, schrieb Michael Walle:
> For support which rely solely on the SFDP data, all we need to know is 
> its
> JEDEC ID. All further information should be fetched from SFDP. For 
> this,
> introduce a SNOR_ID3() macro which should be used for all new flashes 
> with
> SFDP.
> 
> The dropped information are page size, number of sectors and sector 
> size.
> The number of sectors (together with sector size) is only used to 
> calculate
> the total flash size. In case of SFDP, this is read from there. The 
> sector
> size is also used to select a proper erase opcode. We can just keep 
> that
> one zero and the selection algorithm will select the same erase opcode;
> that is the opcode for the largest erase size (which is btw rather 
> odd..).
> The page size is also taken from SFDP. There is one exception: older 
> SFDP
> tables. These doesn't contain this data. So if there will be flashes 
> with
> that, we should assume some sane value.
> 
> Shaik, could you please re-test your w25q512nwm support with this 
> patch. I
> read through the SFDP data and it should behave exactly the same as 
> before.
> 
> Michael Walle (2):
>   mtd: spi-nor: introduce SNOR_ID3()
>   mtd: spi-nor: winbond: use SNOR_ID3() for w25q512nwm
> 
>  drivers/mtd/spi-nor/core.c    | 7 +++++--
>  drivers/mtd/spi-nor/core.h    | 9 +++++++++
>  drivers/mtd/spi-nor/winbond.c | 3 +--
>  3 files changed, 15 insertions(+), 4 deletions(-)