OMAP2PLUS and BCM283X mmc controllers do not work correctly with new emmc
code which reads partition access bits prior mmc controller reset.

So introduce a new config option MMC_ENABLE_PART_ACCESS, which is by
default disabled for ARCH_OMAP2PLUS and ARCH_BCM283X; and selected for
32-bit mvebu mmc booting (which requires it).

Signed-off-by: Pali Rohár <[email protected]>
---
 arch/arm/mach-mvebu/Kconfig |  1 +
 drivers/mmc/Kconfig         | 12 ++++++++++++
 drivers/mmc/mmc.c           |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index ac484c73f62d..fe691cd435e7 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -353,6 +353,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC
        imply SPL_GPIO
        imply SPL_LIBDISK_SUPPORT
        imply SPL_MMC
+       select MMC_ENABLE_PART_ACCESS if SPL_MMC
        select SUPPORT_EMMC_BOOT if SPL_MMC
        select SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR if SPL_MMC
        select SPL_BOOTROM_SUPPORT
diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index de01b9687bad..ea50dfdb62c5 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -107,6 +107,18 @@ config MMC_HW_PARTITIONING
          This adds a command and an API to do hardware partitioning on eMMC
          devices.
 
+config MMC_ENABLE_PART_ACCESS
+       bool "Support for MMC partition access bits"
+       default n if ARCH_OMAP2PLUS || ARCH_BCM283X
+       default y
+       help
+         Read partition access bits from partition config register before card 
reset command
+         because these bits are reset to default value (User Data Area) during 
card reset.
+         This allows us to preserve original value of partition access bits 
used by the code
+         which loaded us (for example BootROM) and use it for board specific 
boot purposes.
+         .
+         This is required when U-Boot is using 
EXT_CSD_EXTRACT_PARTITION_ACCESS macro.
+
 config SUPPORT_EMMC_RPMB
        bool "Support eMMC replay protected memory block (RPMB)"
        imply CMD_MMC_RPMB
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 9915610d82b1..fa3c4d1937c1 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -2864,6 +2864,7 @@ int mmc_get_op_cond(struct mmc *mmc, bool quiet)
 retry:
        mmc_set_initial_state(mmc);
 
+#ifdef CONFIG_MMC_ENABLE_PART_ACCESS
        /*
         * Read partition access bits from partition config register before 
card reset command
         * because these bits are reset to default value (User Data Area) 
during card reset.
@@ -2878,6 +2879,7 @@ retry:
                     ext_csd[EXT_CSD_BOOT_MULT]))
                        mmc->part_config = ext_csd[EXT_CSD_PART_CONF] & 
PART_ACCESS_MASK;
        }
+#endif
 
        /* Reset the Card */
        err = mmc_go_idle(mmc);
-- 
2.20.1

Reply via email to