Skip to contentSkip to conversation

spl: Move SPL_MMC_TINY option to appear under SPL menu

PATCH New Ezequiel Garcia 3 participants 5 messages May 25, 2019 – Jul 14, 2019 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 spl: Move SPL_MMC_TINY option to appear under SPL menu

The SPL_MMC_TINY implements feature-reduced MMC support on SPL, and as such, it's more consistent and convenient to find it as part of the SPL configuration.

---
 common/spl/Kconfig  | 17 +++++++++++++++++
 drivers/mmc/Kconfig | 15 ---------------
 2 files changed, 17 insertions(+), 15 deletions(-)
common/spl/Kconfig +17 -0
index c7cd34449a52..1408575dd511 100644
@@ -515,6 +515,23 @@ config SPL_MMC_SUPPORT
 	  this option to build the drivers in drivers/mmc as part of an SPL
 	  build.
 
+config SPL_MMC_TINY
+	bool "Tiny MMC framework in SPL"
+	depends on SPL_MMC_SUPPORT
+	default n
+	help
+	  Enable MMC framework tinification support. This option is useful if
+	  if your SPL is extremely size constrained. Heed the warning, enable
+	  this option if and only if you know exactly what you are doing, if
+	  you are reading this help text, you most likely have no idea :-)
+
+	  The MMC framework is reduced to bare minimum to be useful. No malloc
+	  support is needed for the MMC framework operation with this option
+	  enabled. The framework supports exactly one MMC device and exactly
+	  one MMC driver. The MMC driver can be adjusted to avoid any malloc
+	  operations too, which can remove the need for malloc support in SPL
+	  and thus further reduce footprint.
+
 config SPL_MMC_WRITE
 	bool "MMC/SD/SDIO card support for write operations in SPL"
 	depends on SPL_MMC_SUPPORT
drivers/mmc/Kconfig +0 -15
index c23299ea962b..76d8bff2eb83 100644
@@ -158,21 +158,6 @@ config MMC_TRACE
 
 	  If you need to see the MMC core message, say Y.
 
-config SPL_MMC_TINY
-	bool "Tiny MMC framework in SPL"
-	help
-	  Enable MMC framework tinification support. This option is useful if
-	  if your SPL is extremely size constrained. Heed the warning, enable
-	  this option if and only if you know exactly what you are doing, if
-	  you are reading this help text, you most likely have no idea :-)
-
-	  The MMC framework is reduced to bare minimum to be useful. No malloc
-	  support is needed for the MMC framework operation with this option
-	  enabled. The framework supports exactly one MMC device and exactly
-	  one MMC driver. The MMC driver can be adjusted to avoid any malloc
-	  operations too, which can remove the need for malloc support in SPL
-	  and thus further reduce footprint.
-
 config MMC_DAVINCI
 	bool "TI DAVINCI Multimedia Card Interface support"
 	depends on ARCH_DAVINCI
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 mmc: Register only the first MMC device on MMC_TINY

When MMC_TINY is enabled, support for only one MMC device is provided. Boards that register more than one device, will just write over mmc_static keeping only the last one registered.

This commit prevents this, keeping only the first MMC device created. A debug warning message is added, if nothing else, as a hint/documentation for developers.

---
 drivers/mmc/mmc_legacy.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/mmc_legacy.c +9 -0
index 66a7cda440cd..b0f5cf58a2b3 100644
@@ -150,6 +150,15 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
 {
 	struct mmc *mmc = &mmc_static;
 
+	/* First MMC device registered, fail to register a new one.
+	 * Given users are not expecting this to fail, instead
+	 * of failing let's just return the only MMC device
+	 */
+	if (mmc->cfg) {
+		debug("Warning: MMC_TINY doesn't support multiple MMC devices\n");
+		return mmc;
+	}
+
 	mmc->cfg = cfg;
 	mmc->priv = priv;
 
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 mmc: Register only the first MMC device on MMC_TINY

Quoted 11 lines · Ezequiel Garcia

When MMC_TINY is enabled, support for only one MMC device is provided. Boards that register more than one device, will just write over mmc_static keeping only the last one registered.

This commit prevents this, keeping only the first MMC device created. A debug warning message is added, if nothing else, as a hint/documentation for developers.

Not sure if it's too early for an gently ping here.

I just want to make sure these two will get some eyes.

Thanks,
Eze

Quoted 31 lines
---
 drivers/mmc/mmc_legacy.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/mmc_legacy.c +9 -1
index 66a7cda440cd..b0f5cf58a2b3 100644
@@ -150,6 +150,15 @@ struct mmc *mmc_create(const struct mmc_config *cfg, void *priv)
 {
        struct mmc *mmc = &mmc_static;
 
+       /* First MMC device registered, fail to register a new one.
+        * Given users are not expecting this to fail, instead
+        * of failing let's just return the only MMC device
+        */
+       if (mmc->cfg) {
+               debug("Warning: MMC_TINY doesn't support multiple MMC devices\n");
+               return mmc;
+       }
+
        mmc->cfg = cfg;
        mmc->priv = priv;
 
--

2.20.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH 2/2 mmc: Register only the first MMC device on MMC_TINY

In reply to Ezequiel Garcia
Quoted 10 lines · Ezequiel Garcia

When MMC_TINY is enabled, support for only one MMC device is provided. Boards that register more than one device, will just write over mmc_static keeping only the last one registered.

This commit prevents this, keeping only the first MMC device created. A debug warning message is added, if nothing else, as a hint/documentation for developers.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190714/6c7944b9/attachment.sig>
#4 lore raw

PATCH 1/2 spl: Move SPL_MMC_TINY option to appear under SPL menu

In reply to Ezequiel Garcia
Quoted 5 lines · Ezequiel Garcia

The SPL_MMC_TINY implements feature-reduced MMC support on SPL, and as such, it's more consistent and convenient to find it as part of the SPL configuration.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190714/7b22ebde/attachment.sig>