summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongjin Kim <tobetter@gmail.com>2022-03-04 09:21:08 +0900
committerDongjin Kim <tobetter@gmail.com>2022-03-05 21:17:19 +0900
commit34751fb83d30f2f750eb5b1f0df00499d27dcc67 (patch)
tree794621f225a0f207fd8f0e62b73bbd5ad0206766
parent7ee2a5ed2236055183f77c6138046440241d1ae8 (diff)
downloadu-boot-odroid-c1-34751fb83d30f2f750eb5b1f0df00499d27dcc67.tar.gz
ODROID-M1: add to load boot splash image from MMC
A default boot splash image can be stored in a partition of SPI flash memory, but maybe good to load from MMC for testing or larger splash image than the partition size in SPI flash memory. Signed-off-by: Dongjin Kim <tobetter@gmail.com> Change-Id: If17010d550be48a72b449cd11e9c5c71a27ae217
-rw-r--r--board/hardkernel/odroid-m1/odroid-m1.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/board/hardkernel/odroid-m1/odroid-m1.c b/board/hardkernel/odroid-m1/odroid-m1.c
index b0fc1088a0..497d4bfd77 100644
--- a/board/hardkernel/odroid-m1/odroid-m1.c
+++ b/board/hardkernel/odroid-m1/odroid-m1.c
@@ -180,6 +180,25 @@ static int set_bmp_logo(const char *bmp_name, void *addr, int flip)
return 0;
}
+static int load_bootsplash_from_mmc(int devnum, unsigned int loadaddr)
+{
+ char buf[16];
+ int n;
+
+ for (n = 1; n <= 2; n++) {
+ snprintf(buf, sizeof(buf), "%d:%d", devnum, n);
+ if (file_exists("mmc", buf, "boot-logo.bmp.gz", FS_TYPE_ANY)) {
+ char cmd[128];
+ snprintf(cmd, sizeof(cmd),
+ "load mmc %s 0x%08x boot-logo.bmp.gz", buf, loadaddr);
+ if (run_command(cmd, 0) == 0)
+ return 0;
+ }
+ }
+
+ return -ENODEV;
+}
+
int misc_init_r(void)
{
void *decomp;
@@ -187,19 +206,24 @@ int misc_init_r(void)
unsigned int loadaddr = (unsigned int)env_get_ulong("loadaddr", 16, 0);
unsigned long len;
char str[80];
- int ret;
- /* Try to load splash image from SPI flash memory */
- snprintf(str, sizeof(str),
- "sf read 0x%08x 0x300000 0x100000", loadaddr);
- ret = run_command(str, 0);
- if (ret) {
- /* Try to load splash image from CRAMFS */
+ int ret = load_bootsplash_from_mmc(0, loadaddr); // eMMC
+ if (ret)
+ ret = load_bootsplash_from_mmc(1, loadaddr); // SD
+
+ if (ret) { // SPI
+ /* Try to load splash image from SPI flash memory */
snprintf(str, sizeof(str),
- "cramfsload 0x%08x boot-logo.bmp.gz", loadaddr);
+ "sf read 0x%08x 0x300000 0x100000", loadaddr);
ret = run_command(str, 0);
- if (ret)
- return 0;
+ if (ret) {
+ /* Try to load splash image from CRAMFS */
+ snprintf(str, sizeof(str),
+ "cramfsload 0x%08x boot-logo.bmp.gz", loadaddr);
+ ret = run_command(str, 0);
+ if (ret)
+ return 0;
+ }
}
bmp = (struct bmp_image *)map_sysmem(loadaddr, 0);