summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongjin Kim <tobetter@gmail.com>2021-12-13 09:30:19 +0300
committerDongjin Kim <tobetter@gmail.com>2021-12-30 12:51:22 +0300
commit37ebf598c43ed04692481ffd4f1f196732b28254 (patch)
tree201434f9917492ec88b82a383b2289a806d4e103
parentf9ec44d2b89a6124bb1af1ab40092a911415f98a (diff)
downloadu-boot-37ebf598c43ed04692481ffd4f1f196732b28254.tar.xz
ODROID-M1: fix incorrect SPI flash access
After applying the device tree from Kernel, not built-in one, SPI flash memory is mapped to different bus and this causes to access environmemnt in SPI flash memory due to failure creating MTD device. Change-Id: Ie6047b288093357f09e39fa01c2c02a61d75fe4b
-rw-r--r--board/hardkernel/odroid-m1/odroid-m1.c4
-rw-r--r--env/sf.c4
-rw-r--r--include/configs/odroid-m1.h4
3 files changed, 10 insertions, 2 deletions
diff --git a/board/hardkernel/odroid-m1/odroid-m1.c b/board/hardkernel/odroid-m1/odroid-m1.c
index 74e3e2ee6d..866fa60fae 100644
--- a/board/hardkernel/odroid-m1/odroid-m1.c
+++ b/board/hardkernel/odroid-m1/odroid-m1.c
@@ -54,7 +54,7 @@ int rk_board_late_init(void)
if (strcmp(env_get("skip_spiboot"), "true")) {
dev_desc = rockchip_get_bootdev();
if (dev_desc && (dev_desc->if_type == IF_TYPE_MTD
- && dev_desc->devnum == 2))
+ && dev_desc->devnum == 3))
snprintf(buf, sizeof(buf),
"cramfsload $scriptaddr boot.scr;"
"source $scriptaddr;"
@@ -168,7 +168,7 @@ int misc_init_r(void)
int ret;
snprintf(str, sizeof(str),
- "mtd read nor0 0x%08x 0x300000 0x%08x",
+ "sf read 0x%08x 0x300000 0x%08x",
loadaddr, (unsigned int)len);
ret = run_command(str, 0);
if (ret)
diff --git a/env/sf.c b/env/sf.c
index e51b1ae189..1582bedeb4 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -19,6 +19,10 @@
#include <errno.h>
#include <dm/device-internal.h>
+#if defined(CONFIG_TARGET_ODROID_M1)
+#undef CONFIG_DM_SPI_FLASH
+#endif
+
#ifndef CONFIG_ENV_SPI_BUS
# define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS
#endif
diff --git a/include/configs/odroid-m1.h b/include/configs/odroid-m1.h
index eec452c328..d9067726f4 100644
--- a/include/configs/odroid-m1.h
+++ b/include/configs/odroid-m1.h
@@ -62,5 +62,9 @@
#define CONFIG_VIDEO_BMP_GZIP
#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((1920 * 1080 * 4) + 54)
+#define CONFIG_ENV_SPI_BUS 4
+#define CONFIG_ENV_SPI_CS 0
+#define CONFIG_ENV_SPI_MAX_HZ 200000000
+
#endif
#endif