aboutsummaryrefslogtreecommitdiff
path: root/common/spl/spl_spi.c
diff options
context:
space:
mode:
authorVaishnav Achath <vaishnav.a@ti.com>2022-05-09 14:03:32 +0530
committerJagan Teki <jagan@edgeble.ai>2022-07-18 19:15:19 +0530
commitcd2f9031e492ca03d2baddce0f7506036e9f2124 (patch)
tree4e1768cb0c6374a1ceaea54e34696054e82d71cb /common/spl/spl_spi.c
parentbebdc237507caa177dee9bfa9af4105d91ddc670 (diff)
downloadu-boot-cd2f9031e492ca03d2baddce0f7506036e9f2124.zip
u-boot-cd2f9031e492ca03d2baddce0f7506036e9f2124.tar.gz
u-boot-cd2f9031e492ca03d2baddce0f7506036e9f2124.tar.bz2
spl: spl_spi: add spi_nor_remove() to soft reset flash
On probe, the SPI NOR core will put a flash in 8D mode if it supports it. But Linux as of now expects to get the flash in 1S mode. Handing the flash to Linux in Octal DTR mode means the kernel will fail to detect the flash. This commit adds an option to soft reset the flash after spl_spi_load_image() so that the flash can be reset to 1S mode and subsequent spi-nor probe in Linux does not fail, since spl_spi_load_image() performs spi_flash_probe() the remove is added after completion loading images in spi_flash_probe() itself. Tested on J721E EVM with 5.10 Linux kernel. Linux spi-nor probe without the fix: root@j7-evm:~# dmesg | grep spi-nor [ 4.928023] spi-nor spi0.0: unrecognized JEDEC id bytes: ff ff ff ff ff ff [ 4.934938] spi-nor: probe of spi0.0 failed with error -2 Linux spi-nor probe with the fix: root@j7-evm:~# dmesg | grep spi-nor [ 4.904484] spi-nor spi0.0: mt35xu512aba (65536 Kbytes) Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com> Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'common/spl/spl_spi.c')
-rw-r--r--common/spl/spl_spi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 3eef2f8..d959ad1 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -172,6 +172,11 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
spl_image->size,
(void *)spl_image->load_addr);
}
+ if (IS_ENABLED(CONFIG_SPI_FLASH_SOFT_RESET)) {
+ err = spi_nor_remove(flash);
+ if (err)
+ return err;
+ }
}
return err;