Re: [PATCH v4 00/16] mtd: spi-nor: add xSPI Octal DTR support
From: Vignesh Raghavendra
Date: Mon May 11 2020 - 05:44:47 EST
On 11/05/20 2:30 pm, Tudor.Ambarus@xxxxxxxxxxxxx wrote:
> Hi, Pratyush, Boris,
>
> On Friday, April 24, 2020 9:43:54 PM EEST Pratyush Yadav wrote:
>> This series adds support for octal DTR flashes in the spi-nor framework,
>
> I'm still learning about this, but I can give you my 2 cents as of now, to
> open the discussion. Enabling 2-2-2, 4-4-4, and 8-8-8 modes is dangerous
> because the flash may not recover from unexpected resets.
Unfortunately, xSPI compliant flashes need to support 1S-1S-1S and
8D-8D-8D (or 4S-4D-4D) mode only. So we have to start supporting
state-full modes
> Entering one of these modes can be:
> 1/ volatile selectable, the device return to the 1-1-1 protocol after the next
> power-on. I guess this is conditioned by the optional RESET pin, but I'll have
> to check. Also the flash can return to the 1-1-1 mode using the software reset
> or through writing to its Configuration Register, without power-on or power-
> off.
Right, I guess switching to octal mode be made conditional based upon
SNOR_F_BROKEN_RESET?
> 2/ non-volatile selectable in which RESET# and software reset are useless, the
> flash defaults to the mode selected in the non volatile Configuration Register
> bits. The only way to get back to 1-1-1 is to write to the Configuration
> Register.
>
In addition to reset issue, supporting flash that boot up in Octal DDR
mode (due to non-volatile setting) is still pretty difficult. Commands
like Read ID and READ SFDP (that are used for flash discovery at
runtime) follow different protocols across different vendors in Octal
DDR mode. So its almost impossible to support such flashes w/o a hint
about device type from DT (or somewhere else).
I would really stick to option 1 for now until someone makes a
compelling case to support option 2.
> Not recovering from unexpected resets is unacceptable. One should always
> prefer option 1/ and condition the entering in 2-2-2, 4-4-4 and 8-8-8 with the
> presence of the optional RESET pin.
>
> For the unfortunate flashes that support just option 2/, we should not enter
> these modes on our own, just by discovering the capabilities from the SFDP
> tables or by the flags in the flash_info struct. The best we can do for them
> is to move the responsibility to the user. Maybe to add a Kconfig option that
> is disabled by default with which we condition the entering in 2-2-2, 4-4-4 or
> 8-8-8 modes. Once entered in one of these modes, if an unexpected reset comes,
> you most likely are doomed, because early stage bootloaders may not work in
> these modes and you'll not be able to boot the board. Assuming that one uses
> other environment to boot the board, we should at least make sure that the
> flash works in linux after an unexpected reset. We should try to determine in
> which mode we are at init, so maybe an extension of the default_init hook is
> needed. But all this looks like a BIG compromise, I'm not yet sure if we
> should adress 2/. Thoughts?
>
Agree, lets not worry about option 2 for now...
Regards
Vignesh