[U-Boot] [PATCH 1/6] sunxi: Add an option to disable MMC

Maxime Ripard maxime.ripard at free-electrons.com
Fri Sep 18 14:06:15 CEST 2015


Some devices don't have any MMC devices, so it doesn't really make sense to
enable the MMC related functions and options for them.

Add an option to disable the MMC support entirely.

Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
---
 arch/arm/cpu/armv7/sunxi/board.c | 6 ++++++
 include/configs/sunxi-common.h   | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index b40198b36ee5..e6721feb4a4c 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -135,7 +135,9 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 u32 spl_boot_device(void)
 {
+#ifdef CONFIG_MMC
 	struct mmc *mmc0, *mmc1;
+#endif
 	/*
 	 * When booting from the SD card or NAND memory, the "eGON.BT0"
 	 * signature is expected to be found in memory at the address 0x0004
@@ -156,15 +158,18 @@ u32 spl_boot_device(void)
 		return BOOT_DEVICE_BOARD;
 
 	/* The BROM will try to boot from mmc0 first, so try that first. */
+#ifdef CONFIG_MMC
 	mmc_initialize(gd->bd);
 	mmc0 = find_mmc_device(0);
 	if (sunxi_mmc_has_egon_boot_signature(mmc0))
 		return BOOT_DEVICE_MMC1;
+#endif
 
 	/* Fallback to booting NAND if enabled. */
 	if (IS_ENABLED(CONFIG_SPL_NAND_SUPPORT))
 		return BOOT_DEVICE_NAND;
 
+#ifdef CONFIG_MMC
 	if (CONFIG_MMC_SUNXI_SLOT_EXTRA == 2) {
 		mmc1 = find_mmc_device(1);
 		if (sunxi_mmc_has_egon_boot_signature(mmc1)) {
@@ -178,6 +183,7 @@ u32 spl_boot_device(void)
 			return BOOT_DEVICE_MMC2;
 		}
 	}
+#endif
 
 	panic("Could not determine boot source\n");
 	return -1;		/* Never reached */
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 48cc4ed6f629..4fde0d4371e4 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -142,7 +142,7 @@
 #endif
 
 /* mmc config */
-#if !defined(CONFIG_UART0_PORT_F)
+#if !defined(CONFIG_UART0_PORT_F) && !defined(CONFIG_NO_MMC)
 #define CONFIG_MMC
 #define CONFIG_GENERIC_MMC
 #define CONFIG_CMD_MMC
@@ -199,7 +199,7 @@
 
 #define CONFIG_SPL_LIBDISK_SUPPORT
 
-#if !defined(CONFIG_UART0_PORT_F)
+#if !defined(CONFIG_UART0_PORT_F) && !defined(CONFIG_NO_MMC)
 #define CONFIG_SPL_MMC_SUPPORT
 #endif
 
@@ -360,9 +360,12 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_FASTBOOT_BUF_SIZE	0x2000000
 
 #define CONFIG_FASTBOOT_FLASH
+
+#ifdef CONFIG_MMC
 #define CONFIG_FASTBOOT_FLASH_MMC_DEV	0
 #define CONFIG_EFI_PARTITION
 #endif
+#endif
 
 #ifdef CONFIG_USB_FUNCTION_MASS_STORAGE
 #define CONFIG_CMD_USB_MASS_STORAGE
-- 
2.5.1



More information about the U-Boot mailing list