Re: [PATCH 1/5] mtd: spi-nor: Refactor Read Status/Write Status support
From: Miquel Raynal
Date: Thu Aug 06 2026 - 03:43:48 EST
Hello Michael,
>> One thing that comes to mind is hardware write protection. If
>> there's nothing before that code which checks it, the verify might
>> fail if the hardware write protection is enabled. So we should
>> somehow check for that and drop the verify here.
>
> But how do you think we should handle it? Will the QE bit writing
> verification fail if HW WP is enabled?
Looking into this further: we shall return an error if the QE bit is not
set. It just tells the caller that quad mode cannot be used. Then up to
the caller to either hard fail or just degrade into single mode (maybe
because of a strapped WP). What we should do is to propose a DT property
to flag when WP is strapped in hardware, this would make the content of
the status registers immutable and we would just skip the entire write
operation in the first place, instead of deliberately trying and get a
100% failure rate. Nevertheless, the changes introduced here are kind of
orthogonal and do not alter the current behaviour; we shall however
listen if people start complaining about this and perhaps implement the
solution proposed above.
Thanks!
Miquèl