All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Add support to exit 4-byte mode
@ 2024-03-28 15:37 Tejas Bhumkar
  2024-03-29  0:44 ` Greg Malysa
  0 siblings, 1 reply; 3+ messages in thread
From: Tejas Bhumkar @ 2024-03-28 15:37 UTC (permalink / raw)
  To: u-boot; +Cc: jagan, vigneshr, michal.simek, venkatesh.abbarapu, git

The Kria board features a recovery application that activates
when the FW_EN button is pressed.
Upon power-up flash operates in 3B mode, However, the recovery
application changes it back to 4B mode.
Following a reset, u-boot activates the CONFIG_SPI_FLASH_BAR
and expects the flash to be in 3B mode. However, there's no
code to handle this configuration. to address this issue, changes
were made to disable the 4B mode when the CONFIG_SPI_FLASH_BAR
is enabled.

Additionally, spi_nor_wait_till_ready() was included because there is
operation that places the device in a busy state before performing
a nor read.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
---
 drivers/mtd/spi/spi-nor-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index f86003ca8c..47f65a4f5e 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -1464,6 +1464,9 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 		else
 			read_len = remain_len;
 #endif
+		ret = spi_nor_wait_till_ready(nor);
+		if (ret)
+			goto read_err;
 
 		ret = nor->read(nor, addr, read_len, buf);
 		if (ret == 0) {
@@ -4161,6 +4164,7 @@ int spi_nor_scan(struct spi_nor *nor)
 #else
 	/* Configure the BAR - discover bank cmds and read current bank */
 	nor->addr_width = 3;
+	set_4byte(nor, info, 0);
 	ret = read_bar(nor, info);
 	if (ret < 0)
 		return ret;
-- 
2.37.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-24 11:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 15:37 [PATCH] mtd: spi-nor: Add support to exit 4-byte mode Tejas Bhumkar
2024-03-29  0:44 ` Greg Malysa
2024-04-24 11:02   ` Bhumkar, Tejas Arvind

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.