* [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency
@ 2018-07-12 8:07 Stefan Agner
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Stefan Agner @ 2018-07-12 8:07 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson
Cc: fabio.estevam, haibo.chen, aisheng.dong, linux-mmc, linux-kernel,
Stefan Agner
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.
Signed-off-by: Stefan Agner <stefan@agner.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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent
2018-07-12 8:07 [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency Stefan Agner
@ 2018-07-12 8:07 ` Stefan Agner
2018-07-12 8:45 ` A.s. Dong
` (2 more replies)
2018-07-12 8:45 ` [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency A.s. Dong
2018-07-12 12:51 ` Adrian Hunter
2 siblings, 3 replies; 7+ messages in thread
From: Stefan Agner @ 2018-07-12 8:07 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson
Cc: fabio.estevam, haibo.chen, aisheng.dong, linux-mmc, linux-kernel,
Stefan Agner
Fix indent. This also makes disable/enable clock blocks look
alike.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index acacd8481473..aa48f4b2541a 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -761,7 +761,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
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);
+ host->ioaddr + ESDHC_VENDOR_SPEC);
}
mdelay(1);
--
2.18.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency
2018-07-12 8:07 [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency Stefan Agner
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
@ 2018-07-12 8:45 ` A.s. Dong
2018-07-12 12:51 ` Adrian Hunter
2 siblings, 0 replies; 7+ messages in thread
From: A.s. Dong @ 2018-07-12 8:45 UTC (permalink / raw)
To: Stefan Agner, adrian.hunter, ulf.hansson
Cc: Fabio Estevam, Bough Chen, linux-mmc, linux-kernel
> -----Original Message-----
> From: Stefan Agner [mailto:stefan@agner.ch]
> Sent: Thursday, July 12, 2018 4:07 PM
> To: adrian.hunter@intel.com; ulf.hansson@linaro.org
> Cc: Fabio Estevam <fabio.estevam@nxp.com>; Bough Chen
> <haibo.chen@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>; linux-
> mmc@vger.kernel.org; linux-kernel@vger.kernel.org; Stefan Agner
> <stefan@agner.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@nxp.com>
Regards
Dong Aisheng
>
> Signed-off-by: Stefan Agner <stefan@agner.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
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
@ 2018-07-12 8:45 ` A.s. Dong
2018-07-12 12:51 ` Adrian Hunter
2018-07-16 10:11 ` Ulf Hansson
2 siblings, 0 replies; 7+ messages in thread
From: A.s. Dong @ 2018-07-12 8:45 UTC (permalink / raw)
To: Stefan Agner, adrian.hunter, ulf.hansson
Cc: Fabio Estevam, Bough Chen, linux-mmc, linux-kernel
> -----Original Message-----
> From: Stefan Agner [mailto:stefan@agner.ch]
> Sent: Thursday, July 12, 2018 4:07 PM
> To: adrian.hunter@intel.com; ulf.hansson@linaro.org
> Cc: Fabio Estevam <fabio.estevam@nxp.com>; Bough Chen
> <haibo.chen@nxp.com>; A.s. Dong <aisheng.dong@nxp.com>; linux-
> mmc@vger.kernel.org; linux-kernel@vger.kernel.org; Stefan Agner
> <stefan@agner.ch>
> Subject: [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent
>
> Fix indent. This also makes disable/enable clock blocks look alike.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Dong Aisheng <aisheng.dong@nxp.com>
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency
2018-07-12 8:07 [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency Stefan Agner
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
2018-07-12 8:45 ` [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency A.s. Dong
@ 2018-07-12 12:51 ` Adrian Hunter
2 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2018-07-12 12:51 UTC (permalink / raw)
To: Stefan Agner, ulf.hansson
Cc: fabio.estevam, haibo.chen, aisheng.dong, linux-mmc, linux-kernel
On 12/07/18 11:07, Stefan Agner wrote:
> 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.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> 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;
> }
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
2018-07-12 8:45 ` A.s. Dong
@ 2018-07-12 12:51 ` Adrian Hunter
2018-07-16 10:11 ` Ulf Hansson
2 siblings, 0 replies; 7+ messages in thread
From: Adrian Hunter @ 2018-07-12 12:51 UTC (permalink / raw)
To: Stefan Agner, ulf.hansson
Cc: fabio.estevam, haibo.chen, aisheng.dong, linux-mmc, linux-kernel
On 12/07/18 11:07, Stefan Agner wrote:
> Fix indent. This also makes disable/enable clock blocks look
> alike.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index acacd8481473..aa48f4b2541a 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -761,7 +761,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
> 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);
> + host->ioaddr + ESDHC_VENDOR_SPEC);
> }
>
> mdelay(1);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
2018-07-12 8:45 ` A.s. Dong
2018-07-12 12:51 ` Adrian Hunter
@ 2018-07-16 10:11 ` Ulf Hansson
2 siblings, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2018-07-16 10:11 UTC (permalink / raw)
To: Stefan Agner
Cc: Adrian Hunter, Fabio Estevam, Haibo Chen, Aisheng Dong,
linux-mmc, Linux Kernel Mailing List
On 12 July 2018 at 10:07, Stefan Agner <stefan@agner.ch> wrote:
> Fix indent. This also makes disable/enable clock blocks look
> alike.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
Thanks, applied for next!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index acacd8481473..aa48f4b2541a 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -761,7 +761,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host,
> 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);
> + host->ioaddr + ESDHC_VENDOR_SPEC);
> }
>
> mdelay(1);
> --
> 2.18.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-16 10:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 8:07 [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency Stefan Agner
2018-07-12 8:07 ` [PATCH v2 2/2] mmc: sdhci-esdhc-imx: fix indent Stefan Agner
2018-07-12 8:45 ` A.s. Dong
2018-07-12 12:51 ` Adrian Hunter
2018-07-16 10:11 ` Ulf Hansson
2018-07-12 8:45 ` [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency A.s. Dong
2018-07-12 12:51 ` Adrian Hunter
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).