Re: [PATCH v5 1/5] mtd: spi-nor: core: add manufacturer flags

Erez
2024-09-23T10:32:21Z

On Mon, 23 Sept 2024 at 08:04, Tudor Ambarus <tudor.ambarus@linaro.org> wrote:
>
> Hi,
>
> On 9/20/24 7:12 PM, Erez Geva wrote:
> > From: Erez Geva <ErezGeva2@gmail.com>
> >
> > Add flag for always trying reading SFDP:
> > Some vendors reuse all JEDEC IDs on manufacture table
> > with new chips that support SFDP.
> >
> > Add flag for reading OTP parameters from device tree.
> > Some vendors reuse JEDEC IDs
> > with several chips with different OTP parameters.
> > Alternatively we read parameters from SFDP.
> > But the OTP parameters are absent from the SFDP.
>
> Do you have some specific flashes that you try to identify? Why can't
> they be differentiated at runtime?

You can not figure OTP parameters based on JEDEC ID and SFDP existence.
I did send a few examples.

One of them:
"How?

When using mx25l12805d, we do not read SFDP.
As it uses the no-SFDP flags.
When using mx25l12833f hardware with mx25l12805d driver, it did not
try to read the SFDP.
Yet mx25l12833f does have SFDP, when I remove the no-SFDP flags, the
driver fetch the SFDP.

Secondly SFDP does not contain OTP information.

mx25l12805d has two OTP regions of 128 KiB and 384 KiB (yes asymmetric).
While mx25l12833f has two OTP regions of 512 KiB.

How do we handle it?
I would gladly remove the obsolete mx25l12805d.
And skp compatibles all together."

>
> > So there is not other way but to add the OTP parameters in the device tree.
> >
>
> If there isn't any way to distinguish the flashes at runtime (which I
> doubt/challenge btw), then as a last resort we introduce a dedicated
> compatible for the flash in cause and specify all needed parameters in a
> dedicated flash entry. This shall be more generic as further flash
> parameters can be statically specified in the dedicated flash entry,
> less invasive for dt, and less confusing for people when they decide
> whether to use OTP or not. OTP params in device tree is a no-go.
>
> But again, you have to prove why you can't distinguish the flash at
> runtime before introducing a new flash compatible. So don't go this path
> before sharing with us what you're trying to achieve.

You keep sending me contradictory messages.

I told you we can not "guess" OTP settings based on JEDEC ID and SFDP existence.
It may be partial and Macronix may add new chips in the future.
They reuse JEDEC ID only retaining flash size and blocks.
This is why compatibilities work with new Macronix chips . Although by
reading the SFDP, we can use higher speeds.
We can use SFDP parameters to read flash size, blocks and speed.
But it does not contain any OTP parameters.
I found only one Macronix chip with an enterprise SFDP table with a
boolean flag for OTP, this does not help us much.
Macronix technical support was explicit on OTP settings. You can not
deduce them. You must know what chip you use.
As far as I can see, Macronix does not reuse module names (god thanks for that).

I do not mind using flash compatible.
Just clarify that point.
And I will send the patches accordingly.

Thanks
Erez

>
> Cheers,
> ta