All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 2/2] spl: spl_mmc: MMC boot mode provisions checks
@ 2015-06-08 21:05 Paul Kocialkowski
  2015-06-08 21:06 ` Paul Kocialkowski
  2015-06-18 22:46 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Kocialkowski @ 2015-06-08 21:05 UTC (permalink / raw
  To: u-boot

This allows using only one of either raw or fs mode for SPL mmc boot, without
the need to have provisions for the other. In particular, a device may have
U-Boot installed on a file system on the mmc, without ever needing to read
U-Boot from raw memory. Thus, there is no reason to provide a sector or
partition for raw mode. This allows this behaviour and still provides a robust
fallback mechanism in case provisions for both modes are defined.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 common/spl/spl_mmc.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index f5ac844..552f80d 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -130,19 +130,21 @@ void spl_mmc_load_image(void)
 				return;
 		}
 #endif
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
 		err = mmc_load_image_raw_partition(mmc,
 			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
-#else
+		if (!err)
+			return;
+#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR)
 		err = mmc_load_image_raw_sector(mmc,
 			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
-#endif
 		if (!err)
 			return;
-#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+#endif
 	case MMCSD_MODE_FS:
 		debug("spl: mmc boot mode: fs\n");
 
+#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
 #ifdef CONFIG_SPL_FAT_SUPPORT
 #ifdef CONFIG_SPL_OS_BOOT
 		if (!spl_start_uboot()) {
@@ -152,12 +154,14 @@ void spl_mmc_load_image(void)
 				return;
 		}
 #endif
+#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
 		err = spl_load_image_fat(&mmc->block_dev,
 					 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
 					 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
 		if (!err)
 			return;
 #endif
+#endif
 #ifdef CONFIG_SPL_EXT_SUPPORT
 #ifdef CONFIG_SPL_OS_BOOT
 		if (!spl_start_uboot()) {
@@ -167,6 +171,7 @@ void spl_mmc_load_image(void)
 				return;
 		}
 #endif
+#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
 		err = spl_load_image_ext(&mmc->block_dev,
 					 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
 					 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
@@ -174,6 +179,7 @@ void spl_mmc_load_image(void)
 			return;
 #endif
 #endif
+#endif
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
 	case MMCSD_MODE_EMMCBOOT:
 		/*
@@ -200,16 +206,18 @@ void spl_mmc_load_image(void)
 				return;
 		}
 #endif
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
 		err = mmc_load_image_raw_partition(mmc,
 			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
-#else
+		if (!err)
+			return;
+#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR)
 		err = mmc_load_image_raw_sector(mmc,
 			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
-#endif
 		if (!err)
 			return;
 #endif
+#endif
 	case MMCSD_MODE_UNDEFINED:
 	default:
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 2/2] spl: spl_mmc: MMC boot mode provisions checks
  2015-06-08 21:05 [U-Boot] [PATCH 2/2] spl: spl_mmc: MMC boot mode provisions checks Paul Kocialkowski
@ 2015-06-08 21:06 ` Paul Kocialkowski
  2015-06-18 22:46 ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Kocialkowski @ 2015-06-08 21:06 UTC (permalink / raw
  To: u-boot

Le lundi 08 juin 2015 ? 23:05 +0200, Paul Kocialkowski a ?crit :
> This allows using only one of either raw or fs mode for SPL mmc boot, without
> the need to have provisions for the other. In particular, a device may have
> U-Boot installed on a file system on the mmc, without ever needing to read
> U-Boot from raw memory. Thus, there is no reason to provide a sector or
> partition for raw mode. This allows this behaviour and still provides a robust
> fallback mechanism in case provisions for both modes are defined.

For reference, PATCH 1/2 is  spl: spl_mmc: Minor cosmetics, that I sent
last week. This one goes on top of it.

> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>  common/spl/spl_mmc.c | 22 +++++++++++++++-------
>  1 file changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index f5ac844..552f80d 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -130,19 +130,21 @@ void spl_mmc_load_image(void)
>  				return;
>  		}
>  #endif
> -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
>  		err = mmc_load_image_raw_partition(mmc,
>  			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
> -#else
> +		if (!err)
> +			return;
> +#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR)
>  		err = mmc_load_image_raw_sector(mmc,
>  			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
> -#endif
>  		if (!err)
>  			return;
> -#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
> +#endif
>  	case MMCSD_MODE_FS:
>  		debug("spl: mmc boot mode: fs\n");
>  
> +#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION
>  #ifdef CONFIG_SPL_FAT_SUPPORT
>  #ifdef CONFIG_SPL_OS_BOOT
>  		if (!spl_start_uboot()) {
> @@ -152,12 +154,14 @@ void spl_mmc_load_image(void)
>  				return;
>  		}
>  #endif
> +#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
>  		err = spl_load_image_fat(&mmc->block_dev,
>  					 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
>  					 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
>  		if (!err)
>  			return;
>  #endif
> +#endif
>  #ifdef CONFIG_SPL_EXT_SUPPORT
>  #ifdef CONFIG_SPL_OS_BOOT
>  		if (!spl_start_uboot()) {
> @@ -167,6 +171,7 @@ void spl_mmc_load_image(void)
>  				return;
>  		}
>  #endif
> +#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME
>  		err = spl_load_image_ext(&mmc->block_dev,
>  					 CONFIG_SYS_MMCSD_FS_BOOT_PARTITION,
>  					 CONFIG_SPL_FS_LOAD_PAYLOAD_NAME);
> @@ -174,6 +179,7 @@ void spl_mmc_load_image(void)
>  			return;
>  #endif
>  #endif
> +#endif
>  #ifdef CONFIG_SUPPORT_EMMC_BOOT
>  	case MMCSD_MODE_EMMCBOOT:
>  		/*
> @@ -200,16 +206,18 @@ void spl_mmc_load_image(void)
>  				return;
>  		}
>  #endif
> -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
> +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
>  		err = mmc_load_image_raw_partition(mmc,
>  			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
> -#else
> +		if (!err)
> +			return;
> +#elif defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR)
>  		err = mmc_load_image_raw_sector(mmc,
>  			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
> -#endif
>  		if (!err)
>  			return;
>  #endif
> +#endif
>  	case MMCSD_MODE_UNDEFINED:
>  	default:
>  #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150608/e3755865/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [U-Boot, 2/2] spl: spl_mmc: MMC boot mode provisions checks
  2015-06-08 21:05 [U-Boot] [PATCH 2/2] spl: spl_mmc: MMC boot mode provisions checks Paul Kocialkowski
  2015-06-08 21:06 ` Paul Kocialkowski
@ 2015-06-18 22:46 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2015-06-18 22:46 UTC (permalink / raw
  To: u-boot

On Mon, Jun 08, 2015 at 11:05:09PM +0200, Paul Kocialkowski wrote:

> This allows using only one of either raw or fs mode for SPL mmc boot, without
> the need to have provisions for the other. In particular, a device may have
> U-Boot installed on a file system on the mmc, without ever needing to read
> U-Boot from raw memory. Thus, there is no reason to provide a sector or
> partition for raw mode. This allows this behaviour and still provides a robust
> fallback mechanism in case provisions for both modes are defined.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Applied to u-boot/master, thanks!

-- 
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/20150618/4a723484/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-18 22:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 21:05 [U-Boot] [PATCH 2/2] spl: spl_mmc: MMC boot mode provisions checks Paul Kocialkowski
2015-06-08 21:06 ` Paul Kocialkowski
2015-06-18 22:46 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.