[PATCH v4 2/4] mtd: spi-nor-core: Adding different type of command extension in Soft Reset

Jagan Teki jagan at amarulasolutions.com
Mon Oct 25 09:00:57 CEST 2021


On Mon, Oct 18, 2021 at 11:54 AM JaimeLiao <jaimeliao.tw at gmail.com> wrote:
>
> Power-on-Reset is a method to restore flash back to 1S-1S-1S mode from 8D-8D-8D
> in the begging of probe.
>
> Command extension type is not standardized across flash vendors in DTR mode.
>
> For suiting different vendor flash devices, adding a flag to seperate types for
> soft reset on boot.
>
> Signed-off-by: JaimeLiao <jaimeliao.tw at gmail.com>
> ---
>  drivers/mtd/spi/Kconfig        | 7 +++++++
>  drivers/mtd/spi/spi-nor-core.c | 7 ++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig
> index 67599b32c9..8304d6c973 100644
> --- a/drivers/mtd/spi/Kconfig
> +++ b/drivers/mtd/spi/Kconfig
> @@ -97,6 +97,13 @@ config SPI_FLASH_SMART_HWCAPS
>          can support a type of operation in a much more refined way compared
>          to using flags like SPI_RX_DUAL, SPI_TX_QUAD, etc.
>
> +config SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT
> +       bool "Command extension type is INVERT for Software Reset on boot"
> +       default n
> +       help
> +        Because of SFDP information can not be get before boot.
> +        So define command extension type is INVERT when Software Reset on boot only.
> +
>  config SPI_FLASH_SOFT_RESET
>         bool "Software Reset support for SPI NOR flashes"
>         default n
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index fdaca0a0d3..87a7de7d60 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -3661,7 +3661,12 @@ static int spi_nor_soft_reset(struct spi_nor *nor)
>         enum spi_nor_cmd_ext ext;
>
>         ext = nor->cmd_ext_type;
> -       nor->cmd_ext_type = SPI_NOR_EXT_REPEAT;
> +       if (nor->cmd_ext_type == SPI_NOR_EXT_NONE) {
> +               nor->cmd_ext_type = SPI_NOR_EXT_REPEAT;
> +#if CONFIG_IS_ENABLED(SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT)
> +               nor->cmd_ext_type = SPI_NOR_EXT_INVERT;
> +#endif /* SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT */

I think we can get the SPI_NOR_EXT_INVERT by parsing bfpt, can you try
it that way instead of new macro?

Jagan.


More information about the U-Boot mailing list