From: Stefan Roese <sr@denx.de>
Date: Mon, 20 Jul 2015 09:20:39 +0000 (+0200)
Subject: spl: spl_mmc: Add option to boot from a MMC partition with offset
X-Git-Tag: v2025.01-rc5-pxa1908~12487
X-Git-Url: http://git.dujemihanovic.xyz/img/static/html/index.html?a=commitdiff_plain;h=4bfcc54c0bb82a082f02e811712ba60d580fe5a4;p=u-boot.git

spl: spl_mmc: Add option to boot from a MMC partition with offset

This patch introduces the option to boot from a MMC card parition with
an offset. This can be done by using both defines together:

define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION 1
define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR    ((160 << 10) / 512)

The example above loads the main U-Boot at offset 160KiB from the MMC
partition 1.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Cc: Dirk Eibach <eibach@gdsys.de>
Cc: Tom Rini <trini@konsulko.com>
---

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 5f1cfbf98e..494f683b0a 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -73,7 +73,12 @@ static int mmc_load_image_raw_partition(struct mmc *mmc, int partition)
 		return -1;
 	}
 
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
+	return mmc_load_image_raw_sector(mmc, info.start +
+					 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+#else
 	return mmc_load_image_raw_sector(mmc, info.start);
+#endif
 }
 #endif