From: Ciprian Marian Costea <ciprianmarian.costea@oss.nxp.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
Haibo Chen <haibo.chen@nxp.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
s32@nxp.com
Subject: Re: [PATCH 2/3] mmc: sdhci-esdhc-imx: obtain the 'per' clock rate after its enablement
Date: Wed, 10 Jul 2024 15:50:09 +0300 [thread overview]
Message-ID: <7d851eb6-ef8e-480a-9b5a-8cb67d6adf8b@oss.nxp.com> (raw)
In-Reply-To: <dbd73f2b-54ab-4832-9610-a4bc70e3b9f2@intel.com>
On 7/10/2024 3:33 PM, Adrian Hunter wrote:
> On 8/07/24 15:10, Ciprian Costea wrote:
>> The I.MX SDHCI driver assumes that the frequency of the 'per' clock
>> can be obtained even on disabled clocks, which is not always the case.
>>
>> According to 'clk_get_rate' documentation, it is only valid
>> once the clock source has been enabled.
>
> The kerneldoc comment for clk_get_rate() says
>
> Can be called regardless of the clock enabledness
>
> which sounds like the opposite. Please clarify.
>
Hello Adrian,
My observation was based on the following [1] 'clk_get_rate()'
documentation.
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/clk.h#n720
Best Regards,
Ciprian
>>
>> Signed-off-by: Ciprian Costea <ciprianmarian.costea@oss.nxp.com>
>> ---
>> drivers/mmc/host/sdhci-esdhc-imx.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 21d984a77be8..8f0bc6dca2b0 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -1709,7 +1709,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>> }
>>
>> pltfm_host->clk = imx_data->clk_per;
>> - pltfm_host->clock = clk_get_rate(pltfm_host->clk);
>> err = clk_prepare_enable(imx_data->clk_per);
>> if (err)
>> goto free_sdhci;
>> @@ -1720,6 +1719,13 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>> if (err)
>> goto disable_ipg_clk;
>>
>> + pltfm_host->clock = clk_get_rate(pltfm_host->clk);
>> + if (!pltfm_host->clock) {
>> + dev_err(mmc_dev(host->mmc), "could not get clk rate\n");
>> + err = -EINVAL;
>> + goto disable_ahb_clk;
>> + }
>> +
>> imx_data->pinctrl = devm_pinctrl_get(&pdev->dev);
>> if (IS_ERR(imx_data->pinctrl))
>> dev_warn(mmc_dev(host->mmc), "could not get pinctrl\n");
>
next prev parent reply other threads:[~2024-07-10 12:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 12:10 [PATCH 0/3] address S32G2/S32G3 SoC based boards particularities Ciprian Costea
2024-07-08 12:10 ` [PATCH 1/3] mmc: sdhci-esdhc-imx: disable card detect wake for S32G based platforms Ciprian Costea
2024-07-10 12:34 ` Adrian Hunter
2024-07-11 14:25 ` Ciprian Marian Costea
2024-07-11 15:55 ` Ulf Hansson
2024-07-08 12:10 ` [PATCH 2/3] mmc: sdhci-esdhc-imx: obtain the 'per' clock rate after its enablement Ciprian Costea
2024-07-10 12:33 ` Adrian Hunter
2024-07-10 12:50 ` Ciprian Marian Costea [this message]
2024-07-10 13:18 ` Adrian Hunter
2024-07-08 12:10 ` [PATCH 3/3] MAINTAINERS: add 's32@nxp.com' as relevant mailing list for 'sdhci-esdhc-imx' driver Ciprian Costea
2024-07-10 13:19 ` Adrian Hunter
2024-07-12 2:34 ` Bough Chen
2024-07-12 9:09 ` [PATCH 0/3] address S32G2/S32G3 SoC based boards particularities Ulf Hansson
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=7d851eb6-ef8e-480a-9b5a-8cb67d6adf8b@oss.nxp.com \
--to=ciprianmarian.costea@oss.nxp.com \
--cc=adrian.hunter@intel.com \
--cc=festevam@gmail.com \
--cc=haibo.chen@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=shawnguo@kernel.org \
--cc=ulf.hansson@linaro.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