All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations
@ 2020-08-04  9:05 David Woodhouse
  2020-08-04  9:05 ` [PATCH 2/2] env/ext4.c: allow loading from an EXT4 partition on the MMC boot device David Woodhouse
  2020-10-14 17:42 ` [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: David Woodhouse @ 2020-08-04  9:05 UTC (permalink / raw)
  To: u-boot

Since it's so trivial I could just about tolerate this when there were only
two copies of it. But now there are about to be three.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
 drivers/mmc/mmc.c | 9 +++++++++
 env/fat.c         | 9 ---------
 env/mmc.c         | 9 ---------
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d79cdef62e..11ce110df3 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -3111,3 +3111,12 @@ int mmc_set_bkops_enable(struct mmc *mmc)
 	return 0;
 }
 #endif
+
+__weak int mmc_get_env_dev(void)
+{
+#ifdef CONFIG_SYS_MMC_ENV_DEV
+	return CONFIG_SYS_MMC_ENV_DEV;
+#else
+	return 0;
+#endif
+}
diff --git a/env/fat.c b/env/fat.c
index 71bf8bfa18..653a38fd93 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -29,15 +29,6 @@
 # define LOADENV
 #endif
 
-__weak int mmc_get_env_dev(void)
-{
-#ifdef CONFIG_SYS_MMC_ENV_DEV
-	return CONFIG_SYS_MMC_ENV_DEV;
-#else
-	return 0;
-#endif
-}
-
 static char *env_fat_device_and_part(void)
 {
 #ifdef CONFIG_MMC
diff --git a/env/mmc.c b/env/mmc.c
index af7e5fbac3..4e67180b23 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -24,15 +24,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if !defined(CONFIG_SYS_MMC_ENV_DEV)
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#endif
-
-__weak int mmc_get_env_dev(void)
-{
-	return CONFIG_SYS_MMC_ENV_DEV;
-}
-
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
 {
-- 
2.26.2

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

* [PATCH 2/2] env/ext4.c: allow loading from an EXT4 partition on the MMC boot device
  2020-08-04  9:05 [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations David Woodhouse
@ 2020-08-04  9:05 ` David Woodhouse
  2020-10-14 17:42   ` Tom Rini
  2020-10-14 17:42 ` [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2020-08-04  9:05 UTC (permalink / raw)
  To: u-boot

This parallels what I added for FAT in commit 6731bef6966, allowing the
environment to be found in a specific partition on the device that the
board's mmc_get_env_dev() returns. On the Banana Pi R2 that means the
device that U-Boot was loaded from; either the internal eMMC or an SD
card.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
 env/Kconfig |  4 ++++
 env/ext4.c  | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/env/Kconfig b/env/Kconfig
index 5d0a8ecea0..ae449ea92c 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -476,6 +476,10 @@ config ENV_EXT4_DEVICE_AND_PART
 	                   If none, first valid partition in device D. If no
 	                   partition table then means device D.
 
+	  If ENV_EXT4_INTERFACE is set to "mmc" then device 'D' can be omitted,
+	  leaving the string starting with a colon, and the boot device will
+	  be used.
+
 config ENV_EXT4_FILE
 	string "Name of the EXT4 file to use for the environment"
 	depends on ENV_IS_IN_EXT4
diff --git a/env/ext4.c b/env/ext4.c
index f823b69409..e666f7b945 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -41,7 +41,21 @@ __weak const char *env_ext4_get_intf(void)
 
 __weak const char *env_ext4_get_dev_part(void)
 {
+#ifdef CONFIG_MMC
+	static char *part_str;
+
+	if (!part_str) {
+		part_str = CONFIG_ENV_EXT4_DEVICE_AND_PART;
+		if (!strcmp(CONFIG_ENV_EXT4_INTERFACE, "mmc") && part_str[0] == ':') {
+			part_str = "0" CONFIG_ENV_EXT4_DEVICE_AND_PART;
+			part_str[0] += mmc_get_env_dev();
+		}
+	}
+
+	return part_str;
+#else
 	return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART;
+#endif
 }
 
 static int env_ext4_save_buffer(env_t *env_new)
-- 
2.26.2

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

* [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations
  2020-08-04  9:05 [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations David Woodhouse
  2020-08-04  9:05 ` [PATCH 2/2] env/ext4.c: allow loading from an EXT4 partition on the MMC boot device David Woodhouse
@ 2020-10-14 17:42 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2020-10-14 17:42 UTC (permalink / raw)
  To: u-boot

On Tue, Aug 04, 2020 at 10:05:46AM +0100, David Woodhouse wrote:

> Since it's so trivial I could just about tolerate this when there were only
> two copies of it. But now there are about to be three.
> 
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/4d474312/attachment.sig>

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

* [PATCH 2/2] env/ext4.c: allow loading from an EXT4 partition on the MMC boot device
  2020-08-04  9:05 ` [PATCH 2/2] env/ext4.c: allow loading from an EXT4 partition on the MMC boot device David Woodhouse
@ 2020-10-14 17:42   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2020-10-14 17:42 UTC (permalink / raw)
  To: u-boot

On Tue, Aug 04, 2020 at 10:05:47AM +0100, David Woodhouse wrote:

> This parallels what I added for FAT in commit 6731bef6966, allowing the
> environment to be found in a specific partition on the device that the
> board's mmc_get_env_dev() returns. On the Banana Pi R2 that means the
> device that U-Boot was loaded from; either the internal eMMC or an SD
> card.
> 
> Signed-off-by: David Woodhouse <dwmw2@infradead.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/f582b11e/attachment.sig>

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

end of thread, other threads:[~2020-10-14 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04  9:05 [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations David Woodhouse
2020-08-04  9:05 ` [PATCH 2/2] env/ext4.c: allow loading from an EXT4 partition on the MMC boot device David Woodhouse
2020-10-14 17:42   ` Tom Rini
2020-10-14 17:42 ` [PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations 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.