summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongjin Kim <tobetter@gmail.com>2022-02-09 12:15:39 +0300
committerDongjin Kim <tobetter@gmail.com>2022-03-04 03:03:40 +0300
commit2781478659c1d57ad67991febb74a8d78857ad93 (patch)
treedd4f06f1081b94feca33f1582a785d546179b3be
parent361a4cf0092448bfbebbbdee50ac1a4aa3897436 (diff)
downloadu-boot-2781478659c1d57ad67991febb74a8d78857ad93.tar.xz
ODROID-M1: add to read 'ODROIDBIOS.BIN' when booted from SD Card
Signed-off-by: Dongjin Kim <tobetter@gmail.com> Change-Id: I2d640db0e6de2efbf78289c486c0d9380164e621
-rw-r--r--board/hardkernel/odroid-m1/odroid-m1.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/board/hardkernel/odroid-m1/odroid-m1.c b/board/hardkernel/odroid-m1/odroid-m1.c
index 638c9db840..4f0130d54e 100644
--- a/board/hardkernel/odroid-m1/odroid-m1.c
+++ b/board/hardkernel/odroid-m1/odroid-m1.c
@@ -13,6 +13,7 @@
#include <malloc.h>
#include <mapmem.h>
#include <lcd.h>
+#include <fs.h>
#include "../../../drivers/video/drm/rockchip_display.h"
extern int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
@@ -45,20 +46,16 @@ int board_usb_init(int index, enum usb_init_type init)
int rk_board_late_init(void)
{
- struct blk_desc *dev_desc;
char buf[1024] = "run distro_bootcmd";
/* Load SPI firmware when boot device is SPI flash memory
* and environment value 'skip_spiboot' is not 'true'
*/
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 == 3))
- snprintf(buf, sizeof(buf),
- "cramfsload $scriptaddr boot.scr;"
- "source $scriptaddr;"
- "%s", env_get("bootcmd"));
+ snprintf(buf, sizeof(buf),
+ "cramfsload $scriptaddr boot.scr;"
+ "source $scriptaddr;"
+ "%s", env_get("bootcmd"));
}
env_set("bootcmd", buf);
@@ -69,7 +66,24 @@ int rk_board_late_init(void)
int board_early_init_r(void)
{
struct blk_desc *dev_desc = rockchip_get_bootdev();
- if ((dev_desc->if_type == IF_TYPE_MTD) && (dev_desc->devnum == 2)) {
+ int ret = -EINVAL;
+ char buf[16];
+ int n;
+
+ for (n = 1; n <= 3; n++) {
+ snprintf(buf, sizeof(buf), "%d:%d", dev_desc->devnum, n);
+
+ if (file_exists("mmc", buf, "ODROIDBIOS.BIN", FS_TYPE_ANY)) {
+ char cmd[256];
+ snprintf(cmd, sizeof(cmd),
+ "load mmc %s $cramfsaddr ODROIDBIOS.BIN", buf);
+ ret = run_command(cmd, 0);
+ if (!ret)
+ break;
+ }
+ }
+
+ if (ret) {
run_command_list( "sf probe\n"
"sf read $cramfsaddr 0x400000 0xc00000",
-1, 0);