From: Ulf Hansson <ulf.hansson@linaro.org>
To: Yann Gautier <yann.gautier@foss.st.com>
Cc: linux-mmc@vger.kernel.org, Philipp Zabel <p.zabel@pengutronix.de>,
Christophe Kerello <christophe.kerello@foss.st.com>,
linux-kernel@vger.kernel.org, Marek Vasut <marex@denx.de>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mmc: mmci: stm32: set feedback clock when using delay block
Date: Wed, 14 Jun 2023 12:31:27 +0200 [thread overview]
Message-ID: <CAPDyKFpOOm-PR5NiggT6NqiXgbz6qGQ46-y26XZNi1S2-B=VYw@mail.gmail.com> (raw)
In-Reply-To: <20230613150148.429828-1-yann.gautier@foss.st.com>
On Tue, 13 Jun 2023 at 17:02, Yann Gautier <yann.gautier@foss.st.com> wrote:
>
> The feedback clock is used only for SDR104 & HS200 modes, and when
> delay block is used (frequency is higher than 50 MHz). The tuning
> procedure is then only required for those modes. Skip the procedure
> for other modes.
> The setting of this feedback clock is done just after enabling delay
> block, and before configuring it.
>
> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
> Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/mmci_stm32_sdmmc.c | 29 ++++++++++++++++++-----------
> 1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
> index 60bca78a72b19..953d1be4e379c 100644
> --- a/drivers/mmc/host/mmci_stm32_sdmmc.c
> +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
> @@ -293,18 +293,8 @@ static void mmci_sdmmc_set_clkreg(struct mmci_host *host, unsigned int desired)
> clk |= host->clk_reg_add;
> clk |= ddr;
>
> - /*
> - * SDMMC_FBCK is selected when an external Delay Block is needed
> - * with SDR104 or HS200.
> - */
> - if (host->mmc->ios.timing >= MMC_TIMING_UHS_SDR50) {
> + if (host->mmc->ios.timing >= MMC_TIMING_UHS_SDR50)
> clk |= MCI_STM32_CLK_BUSSPEED;
> - if (host->mmc->ios.timing == MMC_TIMING_UHS_SDR104 ||
> - host->mmc->ios.timing == MMC_TIMING_MMC_HS200) {
> - clk &= ~MCI_STM32_CLK_SEL_MSK;
> - clk |= MCI_STM32_CLK_SELFBCK;
> - }
> - }
>
> mmci_write_clkreg(host, clk);
> }
> @@ -511,10 +501,27 @@ static int sdmmc_execute_tuning(struct mmc_host *mmc, u32 opcode)
> {
> struct mmci_host *host = mmc_priv(mmc);
> struct sdmmc_dlyb *dlyb = host->variant_priv;
> + u32 clk;
> +
> + if ((host->mmc->ios.timing != MMC_TIMING_UHS_SDR104 &&
> + host->mmc->ios.timing != MMC_TIMING_MMC_HS200) ||
> + host->mmc->actual_clock <= 50000000)
> + return 0;
>
> if (!dlyb || !dlyb->base)
> return -EINVAL;
>
> + writel_relaxed(DLYB_CR_DEN, dlyb->base + DLYB_CR);
> +
> + /*
> + * SDMMC_FBCK is selected when an external Delay Block is needed
> + * with SDR104 or HS200.
> + */
> + clk = host->clk_reg;
> + clk &= ~MCI_STM32_CLK_SEL_MSK;
> + clk |= MCI_STM32_CLK_SELFBCK;
> + mmci_write_clkreg(host, clk);
> +
> if (sdmmc_dlyb_lng_tuning(host))
> return -EINVAL;
>
> --
> 2.25.1
>
prev parent reply other threads:[~2023-06-14 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 15:01 [PATCH] mmc: mmci: stm32: set feedback clock when using delay block Yann Gautier
2023-06-14 10:31 ` Ulf Hansson [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='CAPDyKFpOOm-PR5NiggT6NqiXgbz6qGQ46-y26XZNi1S2-B=VYw@mail.gmail.com' \
--to=ulf.hansson@linaro.org \
--cc=alexandre.torgue@foss.st.com \
--cc=christophe.kerello@foss.st.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=marex@denx.de \
--cc=mcoquelin.stm32@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=yann.gautier@foss.st.com \
/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;
as well as URLs for NNTP newsgroup(s).