mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@linux.dev>
To: "Brandt, Oliver - Lenze" <Oliver.Brandt@lenze.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: shawn.lin@linux.dev, "ulfh@kernel.org" <ulfh@kernel.org>,
	"jh80.chung@samsung.com" <jh80.chung@samsung.com>,
	"shawn.lin@rock-chips.com" <shawn.lin@rock-chips.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mmc: dw_mmc: Read clk-phase DT settings earlier
Date: Tue, 24 Nov 2026 09:23:10 +0800	[thread overview]
Message-ID: <973179f7-498a-4786-9c57-f42aa5a7c50b@linux.dev> (raw)
In-Reply-To: <2c5f6a551f5375a5f92728b1aee036d05eebad7f.camel@lenze.com>

Hi Brandt

在 2026/11/13 星期五 0:16, Brandt, Oliver - Lenze 写道:
> 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()
> 

Thanks for the fix.

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> 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@vger.kernel.org
> Signed-off-by: Oliver Brandt <oliver.brandt@lenze.com>
> ---
> - 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@lenze.com/
> 
>   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)


      parent reply	other threads:[~2026-11-24  1:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 16:16 Brandt, Oliver - Lenze
2026-11-18 17:09 ` Brandt, Oliver - Lenze
2026-11-24  1:23 ` Shawn Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=973179f7-498a-4786-9c57-f42aa5a7c50b@linux.dev \
    --to=shawn.lin@linux.dev \
    --cc=Oliver.Brandt@lenze.com \
    --cc=jh80.chung@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®