[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<DU0PR04MB9496099D1A11444C4475870F90DA2@DU0PR04MB9496.eurprd04.prod.outlook.com>
Date: Mon, 8 Jul 2024 02:27:13 +0000
From: Bough Chen <haibo.chen@....com>
To: "Ciprian Marian Costea (OSS)" <ciprianmarian.costea@....nxp.com>, Adrian
Hunter <adrian.hunter@...el.com>, Ulf Hansson <ulf.hansson@...aro.org>, Shawn
Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix
Kernel Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, dl-S32 <S32@....com>
Subject: RE: [PATCH 2/4] mmc: sdhci-esdhc-imx: obtain the 'per' clock rate
after its enablement
> -----Original Message-----
> From: Ciprian Marian Costea (OSS) <ciprianmarian.costea@....nxp.com>
> Sent: 2024年7月5日 21:47
> To: Bough Chen <haibo.chen@....com>; Adrian Hunter
> <adrian.hunter@...el.com>; Ulf Hansson <ulf.hansson@...aro.org>; Shawn Guo
> <shawnguo@...nel.org>; Sascha Hauer <s.hauer@...gutronix.de>;
> Pengutronix Kernel Team <kernel@...gutronix.de>; Fabio Estevam
> <festevam@...il.com>
> Cc: linux-kernel@...r.kernel.org; linux-mmc@...r.kernel.org;
> imx@...ts.linux.dev; linux-arm-kernel@...ts.infradead.org; dl-S32
> <S32@....com>; Ciprian Marian Costea (OSS)
> <ciprianmarian.costea@....nxp.com>
> Subject: [PATCH 2/4] mmc: sdhci-esdhc-imx: obtain the 'per' clock rate after its
> enablement
>
> 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.
Reviewed-by: Haibo Chen <haibo.chen@....com>
Thanks
Haibo Chen
>
> Signed-off-by: Ciprian Costea <ciprianmarian.costea@....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");
> --
> 2.45.2
Powered by blists - more mailing lists