[U-Boot] [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.
Signed-off-by: Ezequiel Garcia ezequiel@collabora.com --- common/spl/Kconfig | 17 +++++++++++++++++ drivers/mmc/Kconfig | 15 --------------- 2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c7cd34449a52..1408575dd511 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -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 diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index c23299ea962b..76d8bff2eb83 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -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

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.
Signed-off-by: Ezequiel Garcia ezequiel@collabora.com --- drivers/mmc/mmc_legacy.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c index 66a7cda440cd..b0f5cf58a2b3 100644 --- a/drivers/mmc/mmc_legacy.c +++ b/drivers/mmc/mmc_legacy.c @@ -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;

On Sat, 25 May 2019 at 19:26, Ezequiel Garcia ezequiel@collabora.com wrote:
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.
Signed-off-by: Ezequiel Garcia ezequiel@collabora.com
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
drivers/mmc/mmc_legacy.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c index 66a7cda440cd..b0f5cf58a2b3 100644 --- a/drivers/mmc/mmc_legacy.c +++ b/drivers/mmc/mmc_legacy.c @@ -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@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Sat, May 25, 2019 at 07:25:22PM -0300, Ezequiel Garcia wrote:
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.
Signed-off-by: Ezequiel Garcia ezequiel@collabora.com
Applied to u-boot/master, thanks!

On Sat, May 25, 2019 at 07:25:21PM -0300, Ezequiel Garcia wrote:
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.
Signed-off-by: Ezequiel Garcia ezequiel@collabora.com
Applied to u-boot/master, thanks!
participants (3)
-
Ezequiel Garcia
-
Ezequiel Garcia
-
Tom Rini