public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X
@ 2023-05-16 18:49 Pali Rohár
  2023-06-11 22:43 ` Pali Rohár
  2023-06-14  9:42 ` Peng Fan
  0 siblings, 2 replies; 3+ messages in thread
From: Pali Rohár @ 2023-05-16 18:49 UTC (permalink / raw)
  To: Peng Fan, Jaehoon Chung; +Cc: u-boot

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 <pali@kernel.org>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X
  2023-05-16 18:49 [PATCH] mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X Pali Rohár
@ 2023-06-11 22:43 ` Pali Rohár
  2023-06-14  9:42 ` Peng Fan
  1 sibling, 0 replies; 3+ messages in thread
From: Pali Rohár @ 2023-06-11 22:43 UTC (permalink / raw)
  To: Stefan Roese, Peng Fan, Jaehoon Chung; +Cc: u-boot

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/

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 for ARCH_OMAP2PLUS and ARCH_BCM283X; and selected for
> 32-bit mvebu mmc booting (which requires it).
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X
  2023-05-16 18:49 [PATCH] mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X Pali Rohár
  2023-06-11 22:43 ` Pali Rohár
@ 2023-06-14  9:42 ` Peng Fan
  1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan @ 2023-06-14  9:42 UTC (permalink / raw)
  To: Pali Rohár, Peng Fan, Jaehoon Chung; +Cc: u-boot@lists.denx.de



On 5/17/2023 2:49 AM, 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 for ARCH_OMAP2PLUS and ARCH_BCM283X; and selected for
> 32-bit mvebu mmc booting (which requires it).
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Looks good to me.

Reviewed-by: Peng Fan <peng.fan@nxp.com>

I expect Jaehoon will handle this patch.

Regards,
Peng.

> ---
>   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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-14  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 18:49 [PATCH] mmc: Do not read eMMC partition access bits by default on OMAP2PLUS and BCM283X Pali Rohár
2023-06-11 22:43 ` Pali Rohár
2023-06-14  9:42 ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox