diff mbox series

[U-Boot,v2,2/3] spl: mmc: Add option to set eMMC HW boot partition

Message ID 20190819074210.22427-2-lukma@denx.de
State Superseded
Delegated to: Stefano Babic
Headers show
Series [U-Boot,v2,1/3] spl: mmc: Fix indentation in spl_mmc.c file | expand

Commit Message

Lukasz Majewski Aug. 19, 2019, 7:42 a.m. UTC
From: Mans Rullgard <mans@mansr.com>

This change allows setting pre-defined eMMC boot partition for SPL eMMC
booting. It is necessary in the case when one wants to boot (through falcon
boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Signed-off-by: Mans Rullgard <mans@mansr.com>
[lukma: Edit the commit message]
Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

Changes in v2: None

 common/spl/Kconfig   | 6 ++++++
 common/spl/spl_mmc.c | 4 ++++
 2 files changed, 10 insertions(+)

Comments

Andreas Dannenberg Aug. 19, 2019, 3:50 p.m. UTC | #1
On Mon, Aug 19, 2019 at 09:42:09AM +0200, Lukasz Majewski wrote:
> From: Mans Rullgard <mans@mansr.com>
> 
> This change allows setting pre-defined eMMC boot partition for SPL eMMC
> booting. It is necessary in the case when one wants to boot (through falcon
> boot) from eMMC after loading SPL from other memory (like SPI-NOR).
> 
> Signed-off-by: Mans Rullgard <mans@mansr.com>
> [lukma: Edit the commit message]
> Signed-off-by: Lukasz Majewski <lukma@denx.de>


Acked-by: Andreas Dannenberg <dannenberg@ti.com>

Regards, Andreas

 
> ---
> 
> Changes in v2: None
> 
>  common/spl/Kconfig   | 6 ++++++
>  common/spl/spl_mmc.c | 4 ++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 0a3877ec28..4fe4a1359c 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -293,6 +293,12 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
>  	  Address on the MMC to load U-Boot from, when the MMC is being used
>  	  in raw mode. Units: MMC sectors (1 sector = 512 bytes).
>  
> +config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
> +	int "Number of the eMMC boot partition to use"
> +	default 1
> +	help
> +	  eMMC boot partition number to use when the eMMC in raw mode.
> +
>  config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
>  	bool "MMC Raw mode: by partition"
>  	help
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index 2caceb5186..a4d2e63b82 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -334,6 +334,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
>  	err = -EINVAL;
>  	switch (boot_mode) {
>  	case MMCSD_MODE_EMMCBOOT:
> +#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
> +		part = CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION;
> +#else
>  		/*
>  		 * We need to check what the partition is configured to.
>  		 * 1 and 2 match up to boot0 / boot1 and 7 is user data
> @@ -343,6 +346,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
>  
>  		if (part == 7)
>  			part = 0;
> +#endif
>  
>  		if (CONFIG_IS_ENABLED(MMC_TINY))
>  			err = mmc_switch_part(mmc, part);
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 0a3877ec28..4fe4a1359c 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -293,6 +293,12 @@  config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	  Address on the MMC to load U-Boot from, when the MMC is being used
 	  in raw mode. Units: MMC sectors (1 sector = 512 bytes).
 
+config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+	int "Number of the eMMC boot partition to use"
+	default 1
+	help
+	  eMMC boot partition number to use when the eMMC in raw mode.
+
 config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 	bool "MMC Raw mode: by partition"
 	help
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 2caceb5186..a4d2e63b82 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -334,6 +334,9 @@  int spl_mmc_load(struct spl_image_info *spl_image,
 	err = -EINVAL;
 	switch (boot_mode) {
 	case MMCSD_MODE_EMMCBOOT:
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+		part = CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION;
+#else
 		/*
 		 * We need to check what the partition is configured to.
 		 * 1 and 2 match up to boot0 / boot1 and 7 is user data
@@ -343,6 +346,7 @@  int spl_mmc_load(struct spl_image_info *spl_image,
 
 		if (part == 7)
 			part = 0;
+#endif
 
 		if (CONFIG_IS_ENABLED(MMC_TINY))
 			err = mmc_switch_part(mmc, part);