Re: [PATCH] mmc: dw_mmc: Read clk-phase DT settings earlier
From: Brandt, Oliver - Lenze
Date: Wed Nov 18 2026 - 12:09:58 EST
On Thu, 2026-11-12 at 17:16 +0100, Oliver Brandt wrote:
> With a kernel 7.3.3 we saw the following on a SoCFPGA (Cyclone 5) based
> board during initialization when using a high-speed SD-card:
>
> dw_mmc ff704000.mmc: DW MMC controller at irq 53,32 bit host data width,1024 deep fifo
> dw_mmc ff704000.mmc: Got CD GPIO
> dw_mmc ff704000.mmc: Got WP GPIO
> mmc_host mmc0: Bus speed = 50000000Hz (req 400000Hz, actual 396825HZ div = 63)
> mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
> mmc0: error -110 whilst initialising SD card
> mmc_host mmc0: Bus speed = 50000000Hz (req 300000Hz, actual 297619HZ div = 84)
> mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
> mmc0: error -110 whilst initialising SD card
> mmc_host mmc0: Bus speed = 50000000Hz (req 200000Hz, actual 200000HZ div = 125)
> mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
> mmc0: error -110 whilst initialising SD card
> mmc_host mmc0: Bus speed = 50000000Hz (req 100000Hz, actual 100000HZ div = 250)
> mmc_host mmc0: Bus speed = 50000000Hz (req 50000000Hz, actual 50000000HZ div = 0)
> mmc0: error -110 whilst initialising SD card
>
> The SD-card was not usable in the following.
>
> Reason: Since commit 3f1628baa51e ("mmc: dw_mmc-pltfm: Use phase_map for
> SoCFPGA clock phase configuration") host->phase_map is used in order to
> get the phase settings for MMC_TIMING_SD_HS. This is done in drv_data->init
> (dw_mci_socfpga_priv_init()) which is called before dw_mci_init_host(). As
> host->phase_map will be initialized only during dw_mci_init_host(), we'll
> call dw_mci_socfpga_priv_init() without the needed data.
>
> Calling mmc_of_parse_clk_phase() from dw_mci_parse_dt() instead of
> dw_mci_init_host() ensures that we have valid data when calling
> dw_mci_socfpga_priv_init()
>
> Fixes: 3f1628baa51e ("mmc: dw_mmc-pltfm: Use phase_map for SoCFPGA clock phase configuration")
> Fixes: 0d944576c99e ("mmc: dw_mmc: Add parsing mmc_clk_phase_map support")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Oliver Brandt <oliver.brandt@xxxxxxxxx>
> ---
> - Replacement for obsolete patch; Sashiko has found a much simpler and
> cleaner solution.
> - Link to obsolete patch: https://lore.kernel.org/linux-mmc/140317dff0feb9d62b580b1e3170ccb10b8af181.camel@xxxxxxxxx/
>
> drivers/mmc/host/dw_mmc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index cf5cecc5491d5..cd44898d44f3c 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -2850,8 +2850,6 @@ static int dw_mci_init_host(struct dw_mci *host)
> if (ret)
> return ret;
>
> - mmc_of_parse_clk_phase(host->dev, &host->phase_map);
> -
> ret = dw_mci_init_host_caps(host);
> if (ret)
> return ret;
> @@ -3143,6 +3141,8 @@ static int dw_mci_parse_dt(struct dw_mci *host)
> if (!host->bus_hz && !device_property_read_u32(dev, "clock-frequency", &clock_frequency))
> host->bus_hz = clock_frequency;
>
> + mmc_of_parse_clk_phase(host->dev, &host->phase_map);
> +
> if (drv_data && drv_data->parse_dt) {
> ret = drv_data->parse_dt(host);
> if (ret)
Hi together!
Please forgive me for asking, but is there anything I can do to help this patch to
get some attention?
This is my first try to "upstream" a patch of mine so I'm a bit nervous :-)
Kind regards,
Oliver