mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X
Subsystems (4)
PATCH 1/1 mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X
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).
--- arch/arm/mach-mvebu/Kconfig | 1 + drivers/mmc/Kconfig | 12 ++++++++++++ drivers/mmc/mmc.c | 2 ++ 3 files changed, 15 insertions(+)
arch/arm/mach-mvebu/Kconfig +1 -0
@@ -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
drivers/mmc/Kconfig +12 -0
@@ -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
drivers/mmc/mmc.c +2 -0
@@ -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);
Signature · 1 line
2.20.1
Ping, what to do with this patch?
It is without any response too and is a is fix for this reported issue:
https://lore.kernel.org/u-boot/20230503171456.GF1134230@bill-the-cat/
Quoted 72 lines · On Tuesday 16 May 2023 20:49:43 Pali Rohár wrote:
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 forARCH_OMAP2PLUSandARCH_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(+)arch/arm/mach-mvebu/Kconfig +1
-0@@ -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_SUPPORTdrivers/mmc/Kconfig +12
-0@@ -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_RPMBdrivers/mmc/mmc.c +2
-0@@ -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);Signature · 1 line
2.20.1
Quoted 8 lines · Pali Rohár
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 forARCH_OMAP2PLUSandARCH_BCM283X; and selected for 32-bit mvebu mmc booting (which requires it).Signed-off-by Pali Rohár <[email protected]>
Looks good to me.
I expect Jaehoon will handle this patch.
Regards,
Peng.
Quoted 61 lines
--- arch/arm/mach-mvebu/Kconfig | 1 + drivers/mmc/Kconfig | 12 ++++++++++++ drivers/mmc/mmc.c | 2 ++ 3 files changed, 15 insertions(+)arch/arm/mach-mvebu/Kconfig +1
-0@@ -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_SUPPORTdrivers/mmc/Kconfig +12
-0@@ -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_RPMBdrivers/mmc/mmc.c +2
-0@@ -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);