From: Tudor Ambarus <tudor.ambarus@linaro.org> To: michael@walle.cc, pratyush@kernel.org Cc: miquel.raynal@bootlin.com, richard@nod.at, Takahiro.Kuwano@infineon.com, bacem.daassi@infineon.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Tudor Ambarus <tudor.ambarus@linaro.org>, stable@vger.kernel.org Subject: [PATCH v5 08/10] mtd: spi-nor: core: Update flash's current address mode when changing address mode Date: Fri, 31 Mar 2023 07:46:04 +0000 [thread overview] Message-ID: <20230331074606.3559258-9-tudor.ambarus@linaro.org> (raw) In-Reply-To: <20230331074606.3559258-1-tudor.ambarus@linaro.org> The bug was obswerved while reading code. There are not many users of addr_mode_nbytes. Anyway, we should update the flash's current address mode when changing the address mode, fix it. We don't care for now about the set_4byte_addr_mode(nor, false) from spi_nor_restore(), as it is used at driver remove and shutdown. Fixes: d7931a215063 ("mtd: spi-nor: core: Track flash's internal address mode") Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org> Cc: stable@vger.kernel.org --- drivers/mtd/spi-nor/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 0517a61975e4..4f0d90d3dad5 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3135,6 +3135,7 @@ static int spi_nor_quad_enable(struct spi_nor *nor) static int spi_nor_init(struct spi_nor *nor) { + struct spi_nor_flash_parameter *params = nor->params; int err; err = spi_nor_octal_dtr_enable(nor, true); @@ -3176,9 +3177,10 @@ static int spi_nor_init(struct spi_nor *nor) */ WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, "enabling reset hack; may not recover from unexpected reboots\n"); - err = nor->params->set_4byte_addr_mode(nor, true); + err = params->set_4byte_addr_mode(nor, true); if (err && err != -ENOTSUPP) return err; + params->addr_mode_nbytes = 4; } return 0; -- 2.40.0.348.gf938b09366-goog
WARNING: multiple messages have this Message-ID (diff)
From: Tudor Ambarus <tudor.ambarus@linaro.org> To: michael@walle.cc, pratyush@kernel.org Cc: miquel.raynal@bootlin.com, richard@nod.at, Takahiro.Kuwano@infineon.com, bacem.daassi@infineon.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Tudor Ambarus <tudor.ambarus@linaro.org>, stable@vger.kernel.org Subject: [PATCH v5 08/10] mtd: spi-nor: core: Update flash's current address mode when changing address mode Date: Fri, 31 Mar 2023 07:46:04 +0000 [thread overview] Message-ID: <20230331074606.3559258-9-tudor.ambarus@linaro.org> (raw) In-Reply-To: <20230331074606.3559258-1-tudor.ambarus@linaro.org> The bug was obswerved while reading code. There are not many users of addr_mode_nbytes. Anyway, we should update the flash's current address mode when changing the address mode, fix it. We don't care for now about the set_4byte_addr_mode(nor, false) from spi_nor_restore(), as it is used at driver remove and shutdown. Fixes: d7931a215063 ("mtd: spi-nor: core: Track flash's internal address mode") Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org> Cc: stable@vger.kernel.org --- drivers/mtd/spi-nor/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 0517a61975e4..4f0d90d3dad5 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3135,6 +3135,7 @@ static int spi_nor_quad_enable(struct spi_nor *nor) static int spi_nor_init(struct spi_nor *nor) { + struct spi_nor_flash_parameter *params = nor->params; int err; err = spi_nor_octal_dtr_enable(nor, true); @@ -3176,9 +3177,10 @@ static int spi_nor_init(struct spi_nor *nor) */ WARN_ONCE(nor->flags & SNOR_F_BROKEN_RESET, "enabling reset hack; may not recover from unexpected reboots\n"); - err = nor->params->set_4byte_addr_mode(nor, true); + err = params->set_4byte_addr_mode(nor, true); if (err && err != -ENOTSUPP) return err; + params->addr_mode_nbytes = 4; } return 0; -- 2.40.0.348.gf938b09366-goog ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2023-03-31 7:46 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-31 7:45 [PATCH v5 00/10] mtd: spi-nor: Address mode discovery (BFPT method & current address mode) Tudor Ambarus 2023-03-31 7:45 ` Tudor Ambarus 2023-03-31 7:45 ` [PATCH v5 01/10] mtd: spi-nor: core: Move generic method to core - micron_st_nor_set_4byte_addr_mode Tudor Ambarus 2023-03-31 7:45 ` Tudor Ambarus 2023-04-03 12:43 ` Michael Walle 2023-04-03 12:43 ` Michael Walle 2023-03-31 7:45 ` [PATCH v5 02/10] mtd: spi-nor: core: Update name and description of micron_st_nor_set_4byte_addr_mode Tudor Ambarus 2023-03-31 7:45 ` Tudor Ambarus 2023-04-03 12:44 ` Michael Walle 2023-04-03 12:44 ` Michael Walle 2023-03-31 7:45 ` [PATCH v5 03/10] mtd: spi-nor: core: Update name and description of spansion_set_4byte_addr_mode Tudor Ambarus 2023-03-31 7:45 ` Tudor Ambarus 2023-04-03 12:45 ` Michael Walle 2023-04-03 12:45 ` Michael Walle 2023-03-31 7:46 ` [PATCH v5 04/10] mtd: spi-nor: core: Update name and description of spi_nor_set_4byte_addr_mode Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus 2023-04-03 12:46 ` Michael Walle 2023-04-03 12:46 ` Michael Walle 2023-03-31 7:46 ` [PATCH v5 05/10] mtd: spi-nor: core: Make spi_nor_set_4byte_addr_mode_brwr public Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus 2023-04-03 12:48 ` Michael Walle 2023-04-03 12:48 ` Michael Walle 2023-03-31 7:46 ` [PATCH v5 06/10] mtd: spi-nor: Set the 4-Byte Address Mode method based on SFDP data Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus 2023-03-31 7:46 ` [PATCH v5 07/10] mtd: spi-nor: Stop exporting spi_nor_restore() Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus [this message] 2023-03-31 7:46 ` [PATCH v5 08/10] mtd: spi-nor: core: Update flash's current address mode when changing address mode Tudor Ambarus 2023-03-31 7:46 ` [PATCH v5 09/10] mtd: spi-nor: core: Introduce spi_nor_set_4byte_addr_mode() Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus 2023-03-31 7:46 ` [PATCH v5 10/10] mtd: spi-nor: spansion: Determine current address mode Tudor Ambarus 2023-03-31 7:46 ` Tudor Ambarus 2023-04-04 5:40 ` Takahiro Kuwano 2023-04-04 5:40 ` Takahiro Kuwano 2023-04-04 6:46 ` [PATCH v5 00/10] mtd: spi-nor: Address mode discovery (BFPT method & current address mode) Tudor Ambarus 2023-04-04 6:46 ` Tudor Ambarus
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=20230331074606.3559258-9-tudor.ambarus@linaro.org \ --to=tudor.ambarus@linaro.org \ --cc=Takahiro.Kuwano@infineon.com \ --cc=bacem.daassi@infineon.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=michael@walle.cc \ --cc=miquel.raynal@bootlin.com \ --cc=pratyush@kernel.org \ --cc=richard@nod.at \ --cc=stable@vger.kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.