[PATCH] mtd: spi-nor: Address the Macronix flash probe failure
Tom Rini
trini at konsulko.com
Fri Nov 15 15:16:52 CET 2024
On Fri, Nov 15, 2024 at 10:36:56AM +0530, Venkatesh Yadav Abbarapu wrote:
> When performing a soft reset on the OSPI flash, the default
> cmd_ext_type is set to SPI_NOR_EXT_REPEAT. However, Macronix
> flash requires the command type SPI_NOR_EXT_INVERT for soft
> reset.
>
> To address this issue, read the Manufacturer ID from the
> flash. If the Manufacturer ID indicates Macronix, then
> update the command type to SPI_NOR_EXT_INVERT.
>
> Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar at amd.com>
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
> ---
> drivers/mtd/spi/spi-nor-core.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index ec841fb13b..baf1941d76 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -4316,6 +4316,7 @@ static int spi_nor_soft_reset(struct spi_nor *nor)
> {
> struct spi_mem_op op;
> int ret;
> + u8 id[SPI_NOR_MAX_ID_LEN];
> enum spi_nor_cmd_ext ext;
>
> ext = nor->cmd_ext_type;
> @@ -4326,6 +4327,16 @@ static int spi_nor_soft_reset(struct spi_nor *nor)
> #endif /* SPI_NOR_BOOT_SOFT_RESET_EXT_INVERT */
> }
>
> + ret = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
> + if (ret < 0) {
> + dev_dbg(nor->dev, "error %d reading JEDEC ID\n", ret);
> + return ret;
> + }
> +
> + if (id[0] == SNOR_MFR_MACRONIX) {
> + nor->cmd_ext_type = SPI_NOR_EXT_INVERT;
> + }
> +
> op = (struct spi_mem_op)SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_SRSTEN, 0),
> SPI_MEM_OP_NO_DUMMY,
> SPI_MEM_OP_NO_ADDR,
Is this expected to fix the problem Jon was reporting still with commit
5d40b3d384dc ("mtd: spi-nor: Add parallel and stacked memories support")
? And if so, it's missing a Fixes tag as well.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20241115/ce266933/attachment.sig>
More information about the U-Boot
mailing list