Skip to contentSkip to conversation

mmc: fsl_esdhc: Migrate ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE to Kconfig

PATCH In review Tom Rini 3 participants 3 messages Feb 27, 2025 – Mar 13, 2025

Subsystems (3)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 mmc: fsl_esdhc: Migrate ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE to Kconfig

The flag for enabling the ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE quirk can be handled easily enough in Kconfig. This lets us remove a function but not obviously correct usage of the IS_ENABLED() macro.

---
Cc: Peng Fan <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Fabio Estevam <[email protected]>

---
 arch/powerpc/include/asm/config_mpc85xx.h | 3 ---
 drivers/mmc/Kconfig                       | 6 ++++++
 drivers/mmc/fsl_esdhc_imx.c               | 8 +-------
 include/configs/imxrt1020-evk.h           | 2 --
 include/configs/imxrt1050-evk.h           | 2 --
 include/configs/imxrt1170-evk.h           | 2 --
 6 files changed, 7 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/config_mpc85xx.h +0 -3
index 819250f00902..abdaffbe00bc 100644
@@ -133,7 +133,6 @@
 #define CFG_FM_PLAT_CLK_DIV	1
 #define CFG_SYS_FM1_CLK		CFG_FM_PLAT_CLK_DIV
 #define CFG_SYS_FM_MURAM_SIZE	0x30000
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
 #define QE_MURAM_SIZE			0x6000UL
 #define MAX_QE_RISC			1
 #define QE_NUM_OF_SNUM			28
@@ -146,7 +145,6 @@
 #define CFG_SYS_FM1_CLK		0
 #define CFG_QBMAN_CLK_DIV		1
 #define CFG_SYS_FM_MURAM_SIZE	0x30000
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
 #define QE_MURAM_SIZE			0x6000UL
 #define MAX_QE_RISC			1
 #define QE_NUM_OF_SNUM			28
@@ -165,7 +163,6 @@
 #define CFG_SYS_PME_CLK		CFG_PME_PLAT_CLK_DIV
 #define CFG_SYS_FM1_CLK		0
 #define CFG_SYS_FM_MURAM_SIZE	0x28000
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
 
 #elif defined(CONFIG_ARCH_C29X)
 #define CFG_SYS_FSL_SEC_IDX_OFFSET	0x20000
drivers/mmc/Kconfig +6 -0
index 4827834b4aab..06053a318c93 100644
@@ -919,6 +919,12 @@ config ESDHC_DETECT_QUIRK
 	bool "QIXIS-based eSDHC quirk detection"
 	depends on FSL_ESDHC && FSL_QIXIS
 
+config ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
+	bool
+	depends on FSL_ESDHC || FSL_ESDHC_IMX
+	def_bool y if ARCH_T1024 || ARCH_T1040 || ARCH_T1042 || ARCH_T2080 \
+		|| FSL_ESDHC_IMX
+
 config FSL_ESDHC_IMX
 	bool "Freescale/NXP i.MX eSDHC controller support"
 	help
drivers/mmc/fsl_esdhc_imx.c +1 -7
index d7a45ef0ad0d..926113f79d36 100644
@@ -40,12 +40,6 @@
 #include <linux/iopoll.h>
 #include <linux/dma-mapping.h>
 
-#ifndef ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
-#ifdef CONFIG_FSL_USDHC
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE	1
-#endif
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #define SDHCI_IRQ_EN_BITS		(IRQSTATEN_CC | IRQSTATEN_TC | \
@@ -376,7 +370,7 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc,
 	    (timeout == 4 || timeout == 8 || timeout == 12))
 		timeout++;
 
-	if (IS_ENABLED(ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE))
+	if (IS_ENABLED(CONFIG_ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE))
 		timeout = 0xE;
 
 	esdhc_clrsetbits32(&regs->sysctl, SYSCTL_TIMEOUT_MASK, timeout << 16);
include/configs/imxrt1020-evk.h +0 -2
index cd6af93454b6..aec12082b95d 100644
@@ -9,8 +9,6 @@
 
 #include <asm/arch/imx-regs.h>
 
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE	1
-
 #define PHYS_SDRAM			0x80000000
 #define PHYS_SDRAM_SIZE			(32 * 1024 * 1024)
 
include/configs/imxrt1050-evk.h +0 -2
index c520c2fc203a..5b8d6a7ac05a 100644
@@ -9,8 +9,6 @@
 
 #include <asm/arch/imx-regs.h>
 
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE	1
-
 #define PHYS_SDRAM			0x80000000
 #define PHYS_SDRAM_SIZE			(32 * 1024 * 1024)
 
include/configs/imxrt1170-evk.h +0 -2
index 1ccaa15bc112..f821212765c9 100644
@@ -10,8 +10,6 @@
 
 #include <asm/arch/imx-regs.h>
 
-#define ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE	1
-
 /*
  * Configuration of the external SDRAM memory
  */
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

Subject: [PATCH] mmc: fsl_esdhc: Migrate
ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE to Kconfig

The flag for enabling the ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE quirk can be handled easily enough in Kconfig. This lets us remove a function but not obviously correct usage of the IS_ENABLED() macro.

reviewer
#2 lore raw
In reply to Tom Rini
Quoted 6 lines · Tom Rini

The flag for enabling the ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE quirk can be handled easily enough in Kconfig. This lets us remove a function but not obviously correct usage of the IS_ENABLED() macro.

Applied to u-boot-imx/next, thanks.