From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: tkuw584924@gmail.com, linux-mtd@lists.infradead.org
Cc: pratyush@kernel.org, mwalle@kernel.org,
miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
Bacem.Daassi@infineon.com,
Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Subject: Re: [PATCH v2] mtd: spi-nor: spansion: Fixup params->set_4byte_addr_mode for SEMPER
Date: Thu, 12 Jun 2025 09:35:42 +0100 [thread overview]
Message-ID: <831d6528-2185-4e4d-a712-590041b68d91@linaro.org> (raw)
In-Reply-To: <20250612074427.22263-1-Takahiro.Kuwano@infineon.com>
On 6/12/25 8:44 AM, tkuw584924@gmail.com wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
>
> Infineon SEMPER flash family does not support E9h opcode as Exit 4-byte
> mode (EX4B). Therefore, params->set_4byte_addr_mode is not determined by
> BFPT parse. Fixup it up by introducing vendor specific EX4B opcode (B8h)
> and function.
>
> Fixes: c87c9b11c53ce ("mtd: spi-nor: spansion: Determine current address mode")
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com>
Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> ---
> Changes in v2:
> - Move set_4byte_addr_mode() assignment to post_bfpt fixup
>
> drivers/mtd/spi-nor/spansion.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
> index bf08dbf5e742..b9f156c0f8bc 100644
> --- a/drivers/mtd/spi-nor/spansion.c
> +++ b/drivers/mtd/spi-nor/spansion.c
> @@ -17,6 +17,7 @@
>
> #define SPINOR_OP_CLSR 0x30 /* Clear status register 1 */
> #define SPINOR_OP_CLPEF 0x82 /* Clear program/erase failure flags */
> +#define SPINOR_OP_CYPRESS_EX4B 0xB8 /* Exit 4-byte address mode */
> #define SPINOR_OP_CYPRESS_DIE_ERASE 0x61 /* Chip (die) erase */
> #define SPINOR_OP_RD_ANY_REG 0x65 /* Read any register */
> #define SPINOR_OP_WR_ANY_REG 0x71 /* Write any register */
> @@ -58,6 +59,13 @@
> SPI_MEM_OP_DUMMY(ndummy, 0), \
> SPI_MEM_OP_DATA_IN(1, buf, 0))
>
> +#define CYPRESS_NOR_EN4B_EX4B_OP(enable) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(enable ? SPINOR_OP_EN4B : \
> + SPINOR_OP_CYPRESS_EX4B, 0), \
> + SPI_MEM_OP_NO_ADDR, \
> + SPI_MEM_OP_NO_DUMMY, \
> + SPI_MEM_OP_NO_DATA)
> +
> #define SPANSION_OP(opcode) \
> SPI_MEM_OP(SPI_MEM_OP_CMD(opcode, 0), \
> SPI_MEM_OP_NO_ADDR, \
> @@ -356,6 +364,20 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)
> return 0;
> }
>
> +static int cypress_nor_set_4byte_addr_mode(struct spi_nor *nor, bool enable)
> +{
> + int ret;
> + struct spi_mem_op op = CYPRESS_NOR_EN4B_EX4B_OP(enable);
> +
> + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
> +
> + ret = spi_mem_exec_op(nor->spimem, &op);
> + if (ret)
> + dev_dbg(nor->dev, "error %d setting 4-byte mode\n", ret);
> +
> + return ret;
> +}
> +
> /**
> * cypress_nor_determine_addr_mode_by_sr1() - Determine current address mode
> * (3 or 4-byte) by querying status
> @@ -526,6 +548,9 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor,
> struct spi_mem_op op;
> int ret;
>
> + /* Assign 4-byte address mode method that is not determined in BFPT */
> + nor->params->set_4byte_addr_mode = cypress_nor_set_4byte_addr_mode;
> +
> ret = cypress_nor_set_addr_mode_nbytes(nor);
> if (ret)
> return ret;
> @@ -591,6 +616,9 @@ s25hx_t_post_bfpt_fixup(struct spi_nor *nor,
> {
> int ret;
>
> + /* Assign 4-byte address mode method that is not determined in BFPT */
> + nor->params->set_4byte_addr_mode = cypress_nor_set_4byte_addr_mode;
> +
> ret = cypress_nor_set_addr_mode_nbytes(nor);
> if (ret)
> return ret;
> @@ -718,6 +746,9 @@ static int s28hx_t_post_bfpt_fixup(struct spi_nor *nor,
> const struct sfdp_parameter_header *bfpt_header,
> const struct sfdp_bfpt *bfpt)
> {
> + /* Assign 4-byte address mode method that is not determined in BFPT */
> + nor->params->set_4byte_addr_mode = cypress_nor_set_4byte_addr_mode;
> +
> return cypress_nor_set_addr_mode_nbytes(nor);
> }
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2025-06-12 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 7:44 [PATCH v2] mtd: spi-nor: spansion: Fixup params->set_4byte_addr_mode for SEMPER tkuw584924
2025-06-12 8:35 ` Tudor Ambarus [this message]
2025-06-13 12:47 ` Pratyush Yadav
2025-07-03 14:58 ` Pratyush Yadav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831d6528-2185-4e4d-a712-590041b68d91@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=Bacem.Daassi@infineon.com \
--cc=Takahiro.Kuwano@infineon.com \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=tkuw584924@gmail.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox