All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
To: <u-boot@lists.denx.de>
Cc: <jagan@amarulasolutions.com>, <vigneshr@ti.com>,
	<michal.simek@amd.com>, <venkatesh.abbarapu@amd.com>,
	<git@amd.com>
Subject: [PATCH] mtd: spi-nor: Add support to exit 4-byte mode
Date: Thu, 28 Mar 2024 21:07:27 +0530	[thread overview]
Message-ID: <20240328153727.2939697-1-tejas.arvind.bhumkar@amd.com> (raw)

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


             reply	other threads:[~2024-03-28 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 15:37 Tejas Bhumkar [this message]
2024-03-29  0:44 ` [PATCH] mtd: spi-nor: Add support to exit 4-byte mode Greg Malysa
2024-04-24 11:02   ` Bhumkar, Tejas Arvind

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=20240328153727.2939697-1-tejas.arvind.bhumkar@amd.com \
    --to=tejas.arvind.bhumkar@amd.com \
    --cc=git@amd.com \
    --cc=jagan@amarulasolutions.com \
    --cc=michal.simek@amd.com \
    --cc=u-boot@lists.denx.de \
    --cc=venkatesh.abbarapu@amd.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 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.