[PATCH u-boot v2019.04-aspeed-openbmc v3 2/3] arch: ARM: Aspeed: Add SPL eMMC partition boot support

Eddie James eajames at linux.ibm.com
Fri Nov 6 07:09:19 AEDT 2020


Support loading U-Boot from a specific partition on the eMMC
device. Add a config option to specify the partition number in
the eMMC device (not the user data partition) where the U-Boot
image is located.

Signed-off-by: Eddie James <eajames at linux.ibm.com>
Reviewed-by: Joel Stanley <joel at jms.id.au>
---
 arch/arm/mach-aspeed/Kconfig            | 8 ++++++++
 arch/arm/mach-aspeed/ast2600/spl_boot.c | 9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig
index 06f14f4f55..44d392a706 100644
--- a/arch/arm/mach-aspeed/Kconfig
+++ b/arch/arm/mach-aspeed/Kconfig
@@ -90,6 +90,14 @@ config ASPEED_UBOOT_MMC_BASE
 	  The base block number of the U-Boot
 	  image in the eMMC device
 
+config ASPEED_UBOOT_MMC_PART
+	int "U-Boot eMMC partition"
+	default 0
+	help
+	  The partition number of the U-Boot
+	  image in the eMMC device. This is not
+          the user data partition number.
+
 config ASPEED_UBOOT_MMC_SIZE
 	hex "U-Boot eMMC size in blocks"
 	default 0x0
diff --git a/arch/arm/mach-aspeed/ast2600/spl_boot.c b/arch/arm/mach-aspeed/ast2600/spl_boot.c
index b08c49d204..58a22f646e 100644
--- a/arch/arm/mach-aspeed/ast2600/spl_boot.c
+++ b/arch/arm/mach-aspeed/ast2600/spl_boot.c
@@ -46,8 +46,8 @@ static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
 				      struct spl_boot_device *bootdev)
 {
 	int err;
+	int part = CONFIG_ASPEED_UBOOT_MMC_PART;
 	u32 count;
-
 	struct mmc *mmc = NULL;
 	struct udevice *dev;
 	struct blk_desc *bd;
@@ -78,6 +78,13 @@ static int aspeed_spl_mmc_load_image(struct spl_image_info *spl_image,
 
 	bd = mmc_get_blk_desc(mmc);
 
+	if (part) {
+		if (CONFIG_IS_ENABLED(MMC_TINY))
+			err = mmc_switch_part(mmc, part);
+		else
+			err = blk_dselect_hwpart(bd, part);
+	}
+
 	count = blk_dread(bd, CONFIG_ASPEED_UBOOT_MMC_BASE, CONFIG_ASPEED_UBOOT_MMC_SIZE,
 			(void *)CONFIG_ASPEED_UBOOT_DRAM_BASE);
 	if (count != CONFIG_ASPEED_UBOOT_MMC_SIZE) {
-- 
2.26.2



More information about the openbmc mailing list