[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR04MB4211E2E422D988E6F4775FA280590@AM0PR04MB4211.eurprd04.prod.outlook.com>
Date: Thu, 12 Jul 2018 08:45:25 +0000
From: "A.s. Dong" <aisheng.dong@....com>
To: Stefan Agner <stefan@...er.ch>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"ulf.hansson@...aro.org" <ulf.hansson@...aro.org>
CC: Fabio Estevam <fabio.estevam@....com>,
Bough Chen <haibo.chen@....com>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before
changing frequency
> -----Original Message-----
> From: Stefan Agner [mailto:stefan@...er.ch]
> Sent: Thursday, July 12, 2018 4:07 PM
> To: adrian.hunter@...el.com; ulf.hansson@...aro.org
> Cc: Fabio Estevam <fabio.estevam@....com>; Bough Chen
> <haibo.chen@....com>; A.s. Dong <aisheng.dong@....com>; linux-
> mmc@...r.kernel.org; linux-kernel@...r.kernel.org; Stefan Agner
> <stefan@...er.ch>
> Subject: [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before
> changing frequency
>
> In the uSDHC case (e.g. i.MX 6) clocks only get disabled if frequency is set to 0.
> However, it could be that the stack asks for a frequency change while clocks
> are on. In that case the function clears the divider registers (by clearing
> ESDHC_CLOCK_MASK) while the clock is enabled! This causes a short period
> of time where the clock is undivided (on a i.MX 6DL a clock of 196MHz has
> been measured).
>
> For older IP variants the driver disables clock by clearing some bits in
> ESDHC_SYSTEM_CONTROL.
>
> Make sure to disable card clock before changing frequency for uSDHC IP
> variants too.
Looks ok to me.
Acked-by: Dong Aisheng <aisheng.dong@....com>
Regards
Dong Aisheng
>
> Signed-off-by: Stefan Agner <stefan@...er.ch>
> ---
> drivers/mmc/host/sdhci-esdhc-imx.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-
> esdhc-imx.c
> index 85fd5a8b0b6d..acacd8481473 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -708,14 +708,14 @@ static inline void esdhc_pltfm_set_clock(struct
> sdhci_host *host,
> int div = 1;
> u32 temp, val;
>
> + if (esdhc_is_usdhc(imx_data)) {
> + val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
> + writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
> + host->ioaddr + ESDHC_VENDOR_SPEC);
> + }
> +
> if (clock == 0) {
> host->mmc->actual_clock = 0;
> -
> - if (esdhc_is_usdhc(imx_data)) {
> - val = readl(host->ioaddr + ESDHC_VENDOR_SPEC);
> - writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON,
> - host->ioaddr +
> ESDHC_VENDOR_SPEC);
> - }
> return;
> }
>
> --
> 2.18.0
Powered by blists - more mailing lists