mmc: sdhci-esdhc-imx: add 1-bit bus width support
Subsystems (4)
v3 cover mmc: sdhci-esdhc-imx: add 1-bit bus width support
From: Luke Wang <[email protected]>
This series adds 1-bit bus width support for sdhci-esdhc-imx driver.
Currently sdhci-esdhc-imx doesn't support 1-bit width because it doesn't call sdhci_get_property() to parse "bus-width = <1>" and set SDHCI_QUIRK_FORCE_1_BIT_DATA quirk.
After adding sdhci_get_property(), another issue is exposed:mmc_select_hs200() returns 0 without switching when 1-bit bus is used, causing mmc_select_timing() to skip mmc_select_hs(). This leaves eMMC in legacy mode (26MHz) instead of High Speed (52MHz).
Fix by dropping incompatible UHS/DDR/HS200/HS400 caps in sdhci_setup_host() for 1-bit width, and clean up duplicate code now handled by common framework.
Luke Wang (4):
mmc: sdhci: fix timing selection for 1-bit bus width
mmc: sdhci-esdhc-imx: add 1-bit bus width support
mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
mmc: sdhci-pltfm: remove duplicate DTS property parsing
---
Changes in v3:
- Keep SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 check for SDHCI_SUPPORT_HS400 Changes in v2:
- Moved fix from mmc_validate_host_caps() to sdhci_setup_host()
--- drivers/mmc/host/sdhci-esdhc-imx.c | 6 +----- drivers/mmc/host/sdhci-pltfm.c | 7 ------- drivers/mmc/host/sdhci.c | 9 ++++++++- 3 files changed, 9 insertions(+), 13 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/4 mmc: sdhci: fix timing selection for 1-bit bus width
From: Luke Wang <[email protected]>
When 1-bit bus width is used with HS200/HS400 capabilities set, mmc_select_hs200() returns 0 without actually switching. This causes mmc_select_timing() to skip mmc_select_hs(), leaving eMMC in legacy mode (26MHz) instead of High Speed SDR (52MHz).
Per JEDEC eMMC spec section 5.3.2, 1-bit mode supports High Speed SDR. Drop incompatible HS200/HS400/UHS/DDR caps early so timing selection falls through to mmc_select_hs() correctly.
--- drivers/mmc/host/sdhci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +8 -1
@@ -4539,8 +4539,15 @@ int sdhci_setup_host(struct sdhci_host *host)* their platform code before calling sdhci_add_host(), and we * won't assume 8-bit width for hosts without that CAP. */ -if (!(host->quirks &SDHCI_QUIRK_FORCE_1_BIT_DATA )) +if (host->quirks &SDHCI_QUIRK_FORCE_1_BIT_DATA ) { + host->caps1 &= ~(SDHCI_SUPPORT_SDR104 |SDHCI_SUPPORT_SDR50 |SDHCI_SUPPORT_DDR50 ); +if (host->quirks2 &SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 ) + host->caps1 &= ~SDHCI_SUPPORT_HS400 ; + mmc->caps2 &= ~(MMC_CAP2_HS200 |MMC_CAP2_HS400 |MMC_CAP2_HS400_ES ); + mmc->caps &= ~(MMC_CAP_DDR |MMC_CAP_UHS ); + }else { mmc->caps |=MMC_CAP_4_BIT_DATA ; + }if (host->quirks2 &SDHCI_QUIRK2_HOST_NO_CMD23 ) mmc->caps &= ~MMC_CAP_CMD23 ;
Signature · 1 line
2.34.1
Re: [PATCH v3 1/4] mmc: sdhci: fix timing selection for 1-bit bus width
Quoted 7 lines · On 11/03/2026 11:50, [email protected] wrote:
From: Luke Wang <[email protected]>
When 1-bit bus width is used with HS200/HS400 capabilities set,
mmc_select_hs200()returns 0 without actually switching. This causesmmc_select_timing()to skipmmc_select_hs(), leaving eMMC in legacy mode (26MHz) instead of High Speed SDR (52MHz).
Quoted 6 lines
Per JEDEC eMMC spec section 5.3.2, 1-bit mode supports High Speed SDR. Drop incompatible HS200/HS400/UHS/DDR caps early so timing selection falls through to
mmc_select_hs()correctly.Fixes f2119df6b7646 ("mmc: sd: add support for signal voltage switch procedure")Signed-off-by Luke Wang <[email protected]>
Quoted 25 lines
--- drivers/mmc/host/sdhci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +8
-1@@ -4539,8 +4539,15 @@ int sdhci_setup_host(struct sdhci_host *host)* their platform code before calling sdhci_add_host(), and we * won't assume 8-bit width for hosts without that CAP. */ -if (!(host->quirks &SDHCI_QUIRK_FORCE_1_BIT_DATA )) +if (host->quirks &SDHCI_QUIRK_FORCE_1_BIT_DATA ) { + host->caps1 &= ~(SDHCI_SUPPORT_SDR104 |SDHCI_SUPPORT_SDR50 |SDHCI_SUPPORT_DDR50 ); +if (host->quirks2 &SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 ) + host->caps1 &= ~SDHCI_SUPPORT_HS400 ; + mmc->caps2 &= ~(MMC_CAP2_HS200 |MMC_CAP2_HS400 |MMC_CAP2_HS400_ES ); + mmc->caps &= ~(MMC_CAP_DDR |MMC_CAP_UHS ); + }else { mmc->caps |=MMC_CAP_4_BIT_DATA ; + }if (host->quirks2 &SDHCI_QUIRK2_HOST_NO_CMD23 ) mmc->caps &= ~MMC_CAP_CMD23 ;
Re: [PATCH v3 1/4] mmc: sdhci: fix timing selection for 1-bit bus width
In reply to [email protected]Quoted 8 lines · On Wed, 11 Mar 2026 at 10:48, <[email protected]> wrote:
From: Luke Wang <[email protected]>
When 1-bit bus width is used with HS200/HS400 capabilities set,
mmc_select_hs200()returns 0 without actually switching. This causesmmc_select_timing()to skipmmc_select_hs(), leaving eMMC in legacy mode (26MHz) instead of High Speed SDR (52MHz).
Quoted 6 lines
Per JEDEC eMMC spec section 5.3.2, 1-bit mode supports High Speed SDR. Drop incompatible HS200/HS400/UHS/DDR caps early so timing selection falls through to
mmc_select_hs()correctly.Fixes f2119df6b7646 ("mmc: sd: add support for signal voltage switch procedure")Signed-off-by Luke Wang <[email protected]>
Applied for fixes and by adding a stable tag, thanks!
Kind regards
Uffe
Quoted 28 lines
--- drivers/mmc/host/sdhci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +8
-2@@ -4539,8 +4539,15 @@ int sdhci_setup_host(struct sdhci_host *host)* their platform code before calling sdhci_add_host(), and we * won't assume 8-bit width for hosts without that CAP. */ -if (!(host->quirks &SDHCI_QUIRK_FORCE_1_BIT_DATA )) +if (host->quirks &SDHCI_QUIRK_FORCE_1_BIT_DATA ) { + host->caps1 &= ~(SDHCI_SUPPORT_SDR104 |SDHCI_SUPPORT_SDR50 |SDHCI_SUPPORT_DDR50 ); +if (host->quirks2 &SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 ) + host->caps1 &= ~SDHCI_SUPPORT_HS400 ; + mmc->caps2 &= ~(MMC_CAP2_HS200 |MMC_CAP2_HS400 |MMC_CAP2_HS400_ES ); + mmc->caps &= ~(MMC_CAP_DDR |MMC_CAP_UHS ); + }else { mmc->caps |=MMC_CAP_4_BIT_DATA ; + }if (host->quirks2 &SDHCI_QUIRK2_HOST_NO_CMD23 ) mmc->caps &= ~MMC_CAP_CMD23 ; --2.34.1
PATCH v3 2/4 mmc: sdhci-esdhc-imx: add 1-bit bus width support
In reply to [email protected]From: Luke Wang <[email protected]>
Add sdhci_get_property() call to parse common SDHCI DT properties, including "bus-width = <1>" which sets SDHCI_QUIRK_FORCE_1_BIT_DATA quirk for 1-bit data bus width configuration.
Remove the duplicate "no-1-8-v" property parsing since sdhci_get_property() already handles it.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +2 -2
@@ -1813,8 +1813,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,of_property_read_u32 (np,"fsl,strobe-dll-delay-target" , &boarddata->strobe_dll_delay_target); -if (of_property_read_bool (np,"no-1-8-v" )) - host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ;if (of_property_read_u32 (np,"fsl,delay-line" , &boarddata->delay_line)) boarddata->delay_line =0 ;
@@ -1833,6 +1831,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,if (ret)return ret; +sdhci_get_property (pdev); +/* HS400/HS400ES require 8 bit bus */ if (!(host->mmc->caps &MMC_CAP_8_BIT_DATA )) host->mmc->caps2 &= ~(MMC_CAP2_HS400 |MMC_CAP2_HS400_ES );
Signature · 1 line
2.34.1
Quoted 11 lines
-----Original Message-----
From: Luke Wang <[email protected]>
Sent: 2026年3月11日 17:50
To: [email protected]; [email protected]; Bough Chen <[email protected]>
Cc: Frank Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-S32 <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3 2/4] mmc: sdhci-esdhc-imx: add 1-bit bus width support
Quoted 8 lines
From: Luke Wang <[email protected]>
Add
sdhci_get_property()call to parse common SDHCI DT properties, including "bus-width = <1>" which setsSDHCI_QUIRK_FORCE_1_BIT_DATAquirk for 1-bit data bus width configuration.Remove the duplicate "no-1-8-v" property parsing since
sdhci_get_property()already handles it.
Regards
Haibo Chen
Quoted 35 lines
Signed-off-by Luke Wang <[email protected]>Acked-by Adrian Hunter <[email protected]>--- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mmc/host/sdhci-esdhc-imx.c +0
-2@@ -1813,8 +1813,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,of_property_read_u32 (np,"fsl,strobe-dll-delay-target" , &boarddata->strobe_dll_delay_target); -if (of_property_read_bool (np,"no-1-8-v" )) - host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ;if (of_property_read_u32 (np,"fsl,delay-line" , &boarddata->delay_line))drivers/mmc/host/sdhci-esdhc-imx.c +2
-0boarddata->delay_line =0 ;@@ -1833,6 +1831,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev, if (ret)return ret; +sdhci_get_property (pdev); +/* HS400/HS400ES require 8 bit bus */ if (!(host->mmc->caps &MMC_CAP_8_BIT_DATA ))
host->mmc->caps2&= ~(MMC_CAP2_HS400 |MMC_CAP2_HS400_ES);
--
2.34.1
Quoted 7 lines · On Wed, 11 Mar 2026 at 10:48, <[email protected]> wrote:
From: Luke Wang <[email protected]>
Add
sdhci_get_property()call to parse common SDHCI DT properties, including "bus-width = <1>" which setsSDHCI_QUIRK_FORCE_1_BIT_DATAquirk for 1-bit data bus width configuration.
Quoted 5 lines
Remove the duplicate "no-1-8-v" property parsing since
sdhci_get_property()already handles it.Signed-off-by Luke Wang <[email protected]>Acked-by Adrian Hunter <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 29 lines
--- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mmc/host/sdhci-esdhc-imx.c +2
-3@@ -1813,8 +1813,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,of_property_read_u32 (np,"fsl,strobe-dll-delay-target" , &boarddata->strobe_dll_delay_target); -if (of_property_read_bool (np,"no-1-8-v" )) - host->quirks2 |=SDHCI_QUIRK2_NO_1_8_V ;if (of_property_read_u32 (np,"fsl,delay-line" , &boarddata->delay_line)) boarddata->delay_line =0 ;@@ -1833,6 +1831,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,if (ret)return ret; +sdhci_get_property (pdev); +/* HS400/HS400ES require 8 bit bus */ if (!(host->mmc->caps &MMC_CAP_8_BIT_DATA )) host->mmc->caps2 &= ~(MMC_CAP2_HS400 |MMC_CAP2_HS400_ES ); --2.34.1
PATCH v3 3/4 mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
In reply to [email protected]From: Luke Wang <[email protected]>
mmc_validate_host_caps() already validates that HS400/HS400ES requires 8-bit bus width. Remove the duplicate validation.
--- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +0 -4
@@ -1833,10 +1833,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,sdhci_get_property (pdev); -/* HS400/HS400ES require 8 bit bus */ -if (!(host->mmc->caps &MMC_CAP_8_BIT_DATA )) - host->mmc->caps2 &= ~(MMC_CAP2_HS400 |MMC_CAP2_HS400_ES ); -if (mmc_gpio_get_cd (host->mmc) >=0 ) host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ;
Signature · 1 line
2.34.1
RE: [PATCH v3 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
Quoted 12 lines
-----Original Message-----
From: Luke Wang <[email protected]>
Sent: 2026年3月11日 17:50
To: [email protected]; [email protected]; Bough Chen <[email protected]>
Cc: Frank Li <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-S32 <[email protected]>; [email protected]; [email protected]
Subject: [PATCH v3 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
Quoted 4 lines
From: Luke Wang <[email protected]>
mmc_validate_host_caps()already validates that HS400/HS400ES requires 8-bit bus width. Remove the duplicate validation.
Regards
Haibo Chen
Quoted 27 lines
Signed-off-by Luke Wang <[email protected]>Acked-by Adrian Hunter <[email protected]>--- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ---- 1 file changed, 4 deletions(-)drivers/mmc/host/sdhci-esdhc-imx.c +0
-4@@ -1833,10 +1833,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,sdhci_get_property (pdev); -/* HS400/HS400ES require 8 bit bus */ -if (!(host->mmc->caps &MMC_CAP_8_BIT_DATA )) - host->mmc->caps2 &= ~(MMC_CAP2_HS400 | MMC_CAP2_HS400_ES); -if (mmc_gpio_get_cd (host->mmc) >=0 )
host->quirks&= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;--
2.34.1
Re: [PATCH v3 3/4] mmc: sdhci-esdhc-imx: remove duplicate HS400 bus width validation
In reply to [email protected]Quoted 8 lines · On Wed, 11 Mar 2026 at 10:48, <[email protected]> wrote:
From: Luke Wang <[email protected]>
mmc_validate_host_caps()already validates that HS400/HS400ES requires 8-bit bus width. Remove the duplicate validation.Signed-off-by Luke Wang <[email protected]>Acked-by Adrian Hunter <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 22 lines
--- drivers/mmc/host/sdhci-esdhc-imx.c | 4 ---- 1 file changed, 4 deletions(-)drivers/mmc/host/sdhci-esdhc-imx.c +0
-5@@ -1833,10 +1833,6 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,sdhci_get_property (pdev); -/* HS400/HS400ES require 8 bit bus */ -if (!(host->mmc->caps &MMC_CAP_8_BIT_DATA )) - host->mmc->caps2 &= ~(MMC_CAP2_HS400 |MMC_CAP2_HS400_ES ); -if (mmc_gpio_get_cd (host->mmc) >=0 ) host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION ; --2.34.1
PATCH v3 4/4 mmc: sdhci-pltfm: remove duplicate DTS property parsing
In reply to [email protected]From: Luke Wang <[email protected]>
The "keep-power-in-suspend", "wakeup-source" and "enable-sdio-wakeup" properties are already parsed in mmc_of_parse(). All sdhci drivers that call sdhci_get_property() also call mmc_of_parse(). The only exception is sdhci-of-hlwd, which does not call mmc_of_parse(), but its devicetree does not use these properties anyway.
--- drivers/mmc/host/sdhci-pltfm.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/mmc/host/sdhci-pltfm.c +0 -7
@@ -95,13 +95,6 @@ void sdhci_get_property(struct platform_device *pdev)sdhci_get_compatibility (pdev);device_property_read_u32 (dev,"clock-frequency" , &pltfm_host->clock); - -if (device_property_present (dev,"keep-power-in-suspend" )) - host->mmc->pm_caps |=MMC_PM_KEEP_POWER ; - -if (device_property_read_bool (dev,"wakeup-source" ) || -device_property_read_bool (dev,"enable-sdio-wakeup" ))/* legacy */ - host->mmc->pm_caps |=MMC_PM_WAKE_SDIO_IRQ ; }EXPORT_SYMBOL_GPL (sdhci_get_property);
Signature · 1 line
2.34.1
Re: [PATCH v3 4/4] mmc: sdhci-pltfm: remove duplicate DTS property parsing
Quoted 11 lines · On Wed, 11 Mar 2026 at 10:48, <[email protected]> wrote:
From: Luke Wang <[email protected]>
The "keep-power-in-suspend", "wakeup-source" and "enable-sdio-wakeup" properties are already parsed in
mmc_of_parse(). All sdhci drivers that callsdhci_get_property()also callmmc_of_parse(). The only exception is sdhci-of-hlwd, which does not callmmc_of_parse(), but its devicetree does not use these properties anyway.Signed-off-by Luke Wang <[email protected]>Acked-by Adrian Hunter <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 25 lines
--- drivers/mmc/host/sdhci-pltfm.c | 7 ------- 1 file changed, 7 deletions(-)drivers/mmc/host/sdhci-pltfm.c +0
-8@@ -95,13 +95,6 @@ void sdhci_get_property(struct platform_device *pdev)sdhci_get_compatibility (pdev);device_property_read_u32 (dev,"clock-frequency" , &pltfm_host->clock); - -if (device_property_present (dev,"keep-power-in-suspend" )) - host->mmc->pm_caps |=MMC_PM_KEEP_POWER ; - -if (device_property_read_bool (dev,"wakeup-source" ) || -device_property_read_bool (dev,"enable-sdio-wakeup" ))/* legacy */ - host->mmc->pm_caps |=MMC_PM_WAKE_SDIO_IRQ ; }EXPORT_SYMBOL_GPL (sdhci_get_property); --2.34.1