Skip to contentSkip to conversation

spl_mmc: allow to load raw image

PATCH Superseded Masahiro Yamada 3 participants 4 messages Mar 16, 2016 – Apr 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spl_mmc: allow to load raw image

The function spl_parse_image_header() falls back to a raw image if the U-Boot header is missing and CONFIG_SPL_PANIC_ON_RAW_IMAGE is undefined. While, mmc_load_image_raw_sector() only accepts a U-Boot legacy image or an FIT image, preventing us from loading a raw image.

---

Changes in v2:
- rebase on commit 41bccb814285 and rephrase git-log according to it

 common/spl/spl_mmc.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
common/spl/spl_mmc.c +4 -14
index c0e76be..7d3bfc6 100644
@@ -41,7 +41,6 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector,
 	return 0;
 }
 
-#ifdef CONFIG_SPL_LOAD_FIT
 static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
 			     ulong count, void *buf)
 {
@@ -49,7 +48,6 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
 
 	return mmc->block_dev.block_read(&mmc->block_dev, sector, count, buf);
 }
-#endif
 
 static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
 {
@@ -68,12 +66,8 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
 		goto end;
 	}
 
-	switch (image_get_magic(header)) {
-	case IH_MAGIC:
-		ret = mmc_load_legacy(mmc, sector, header);
-		break;
-#ifdef CONFIG_SPL_LOAD_FIT
-	case FDT_MAGIC: {
+	if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+	    image_get_magic(header) == FDT_MAGIC) {
 		struct spl_load_info load;
 
 		debug("Found FIT\n");
@@ -82,12 +76,8 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
 		load.bl_len = mmc->read_bl_len;
 		load.read = h_spl_load_read;
 		ret = spl_load_simple_fit(&load, sector, header);
-		break;
-	}
-#endif
-	default:
-		puts("bad magic\n");
-		return -1;
+	} else {
+		ret = mmc_load_legacy(mmc, sector, header);
 	}
 
 end:
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 spl_mmc: allow to load raw image

Quoted 7 lines · Masahiro Yamada

The function spl_parse_image_header() falls back to a raw image if the U-Boot header is missing and CONFIG_SPL_PANIC_ON_RAW_IMAGE is undefined. While, mmc_load_image_raw_sector() only accepts a U-Boot legacy image or an FIT image, preventing us from loading a raw image.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160316/f853f0bb/attachment.sig>
#2 lore raw

PATCH v2 1/1 spl_mmc: allow to load raw image

In reply to Masahiro Yamada

2016-03-16 12:10 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 7 lines

The function spl_parse_image_header() falls back to a raw image if the U-Boot header is missing and CONFIG_SPL_PANIC_ON_RAW_IMAGE is undefined. While, mmc_load_image_raw_sector() only accepts a U-Boot legacy image or an FIT image, preventing us from loading a raw image.

Applied to u-boot-uniphier/master.

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

PATCH v2 1/1 spl_mmc: allow to load raw image

In reply to Masahiro Yamada
Quoted 8 lines · Masahiro Yamada

The function spl_parse_image_header() falls back to a raw image if the U-Boot header is missing and CONFIG_SPL_PANIC_ON_RAW_IMAGE is undefined. While, mmc_load_image_raw_sector() only accepts a U-Boot legacy image or an FIT image, preventing us from loading a raw image.

---

I know it's been pushed to the trunk already, but I think we have an issue with at least one OMAP3 board.

Quoted 43 lines

Changes in v2:
- rebase on commit 41bccb814285 and rephrase git-log according to it

 common/spl/spl_mmc.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
common/spl/spl_mmc.c +2 -8
index c0e76be..7d3bfc6 100644
@@ -41,7 +41,6 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector,
        return 0;
 }
 
-#ifdef CONFIG_SPL_LOAD_FIT
 static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
                             ulong count, void *buf)
 {
@@ -49,7 +48,6 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
 
        return mmc->block_dev.block_read(&mmc->block_dev, sector, count, buf);
 }
-#endif
 
 static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
 {
@@ -68,12 +66,8 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
                goto end;
        }
 
-       switch (image_get_magic(header)) {
-       case IH_MAGIC:
-               ret = mmc_load_legacy(mmc, sector, header);
-               break;
-#ifdef CONFIG_SPL_LOAD_FIT
-       case FDT_MAGIC: {
+       if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+           image_get_magic(header) == FDT_MAGIC) {
                struct spl_load_info load;
 
                debug("Found FIT\n");

common/spl/spl_mmc.c static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector) · line 79

Quoted 10 lines
common/spl/spl_mmc.c +1 -6
@@ -82,12 +76,8 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(&load, sector, header);
-               break;
-       }
-#endif
-       default:
-               puts("bad magic\n");
-               return -1;
+       } else {

The following line makes my omap3 board hang.

common/spl/spl_mmc.c static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector) · line 80

Quoted 1 line
common/spl/spl_mmc.c +1 -0
+               ret = mmc_load_legacy(mmc, sector, header);

However if we use "return -1" the board loads u-boot.img properly on the omap3logic board.

Quoted 10 lines
common/spl/spl_mmc.c +0 -1
        }
 
 end:
--

1.9.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot