public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: sunxi: Fix NULL pointer reference on clk_delays
@ 2017-08-08  7:02 Chen-Yu Tsai
       [not found] ` <20170808070244.27410-1-wens-jdAy2FN1RRM@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2017-08-08  7:02 UTC (permalink / raw)
  To: Ulf Hansson, Maxime Ripard
  Cc: Chen-Yu Tsai, Icenowy Zheng, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw

Some SoCs do not support clk delays for MMC in the clock control unit.
These include the old controllers in A10/A10s/A13/R8, and the new eMMC
controller in A64. The config structure for these controllers do not
specify clk_delays, but the check for this was replaced in commit
b0600daebf31 ("mmc: sunxi: Support controllers that can use both old
and new timings").

This patch adds back the check for clk_delays, and also adds comments
for both checks in sunxi_mmc_clk_set_phase().

Fixes: b0600daebf31 ("mmc: sunxi: Support controllers that can use
		      both old and new timings")
Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
---
This fixes an mmc regression on A10/A10s/A13/R8 and A64 introduced
by the A83T mmc patches.

v1 was inlined in a reply to "mmc: sunxi: fix new timings mode on A64
EMMC (MMC2) controller"

Changes since v1:

  - Polished comments 

I've tested this on my A10 Cubieboard and A20 Cubieboard2.
---
 drivers/mmc/host/sunxi-mmc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 3777517982dd..9dc6d726ec49 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -722,9 +722,14 @@ static int sunxi_mmc_clk_set_phase(struct sunxi_mmc_host *host,
 {
 	int index;
 
+	/* clk controller delays not used under new timings mode */
 	if (host->use_new_timings)
 		return 0;
 
+	/* some old controllers don't support delays */
+	if (!host->cfg->clk_delays)
+		return 0;
+
 	/* determine delays */
 	if (rate <= 400000) {
 		index = SDXC_CLK_400K;
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: sunxi: Fix NULL pointer reference on clk_delays
       [not found] ` <20170808070244.27410-1-wens-jdAy2FN1RRM@public.gmane.org>
@ 2017-08-08  7:07   ` icenowy-h8G6r0blFSE
       [not found]     ` <bbd4680dc97d9913ff6a49e68c360d21-h8G6r0blFSE@public.gmane.org>
  2017-08-08 10:37   ` Ulf Hansson
  1 sibling, 1 reply; 5+ messages in thread
From: icenowy-h8G6r0blFSE @ 2017-08-08  7:07 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Ulf Hansson, Maxime Ripard, linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, Icenowy Zheng,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

在 2017-08-08 15:02,Chen-Yu Tsai 写道:
> Some SoCs do not support clk delays for MMC in the clock control unit.
> These include the old controllers in A10/A10s/A13/R8, and the new eMMC
> controller in A64. The config structure for these controllers do not
> specify clk_delays, but the check for this was replaced in commit
> b0600daebf31 ("mmc: sunxi: Support controllers that can use both old
> and new timings").
> 
> This patch adds back the check for clk_delays, and also adds comments
> for both checks in sunxi_mmc_clk_set_phase().
> 
> Fixes: b0600daebf31 ("mmc: sunxi: Support controllers that can use
> 		      both old and new timings")
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Should I add a Tested-by here?

> ---
> This fixes an mmc regression on A10/A10s/A13/R8 and A64 introduced
> by the A83T mmc patches.
> 
> v1 was inlined in a reply to "mmc: sunxi: fix new timings mode on A64
> EMMC (MMC2) controller"
> 
> Changes since v1:
> 
>   - Polished comments
> 
> I've tested this on my A10 Cubieboard and A20 Cubieboard2.
> ---
>  drivers/mmc/host/sunxi-mmc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/mmc/host/sunxi-mmc.c 
> b/drivers/mmc/host/sunxi-mmc.c
> index 3777517982dd..9dc6d726ec49 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -722,9 +722,14 @@ static int sunxi_mmc_clk_set_phase(struct
> sunxi_mmc_host *host,
>  {
>  	int index;
> 
> +	/* clk controller delays not used under new timings mode */
>  	if (host->use_new_timings)
>  		return 0;
> 
> +	/* some old controllers don't support delays */
> +	if (!host->cfg->clk_delays)
> +		return 0;
> +
>  	/* determine delays */
>  	if (rate <= 400000) {
>  		index = SDXC_CLK_400K;

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH v2] mmc: sunxi: Fix NULL pointer reference on clk_delays
       [not found]     ` <bbd4680dc97d9913ff6a49e68c360d21-h8G6r0blFSE@public.gmane.org>
@ 2017-08-08  7:10       ` Chen-Yu Tsai
       [not found]         ` <CAGb2v65qN9OFCnjSRH-=a-XnKEfOJXh=Gvv02vtPydgVEnKuGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2017-08-08  7:10 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Chen-Yu Tsai, Ulf Hansson, Maxime Ripard, linux-sunxi,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Icenowy Zheng,
	linux-arm-kernel

On Tue, Aug 8, 2017 at 3:07 PM,  <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
> 在 2017-08-08 15:02,Chen-Yu Tsai 写道:
>>
>> Some SoCs do not support clk delays for MMC in the clock control unit.
>> These include the old controllers in A10/A10s/A13/R8, and the new eMMC
>> controller in A64. The config structure for these controllers do not
>> specify clk_delays, but the check for this was replaced in commit
>> b0600daebf31 ("mmc: sunxi: Support controllers that can use both old
>> and new timings").
>>
>> This patch adds back the check for clk_delays, and also adds comments
>> for both checks in sunxi_mmc_clk_set_phase().
>>
>> Fixes: b0600daebf31 ("mmc: sunxi: Support controllers that can use
>>                       both old and new timings")
>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>
>
> Should I add a Tested-by here?

If you tested it, then yes. :)

ChenYu

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH v2] mmc: sunxi: Fix NULL pointer reference on clk_delays
       [not found]         ` <CAGb2v65qN9OFCnjSRH-=a-XnKEfOJXh=Gvv02vtPydgVEnKuGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-08-08  7:11           ` icenowy-h8G6r0blFSE
  0 siblings, 0 replies; 5+ messages in thread
From: icenowy-h8G6r0blFSE @ 2017-08-08  7:11 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Ulf Hansson, Maxime Ripard, linux-sunxi,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA, Icenowy Zheng, linux-arm-kernel

在 2017-08-08 15:10,Chen-Yu Tsai 写道:
> On Tue, Aug 8, 2017 at 3:07 PM,  <icenowy-h8G6r0blFSE@public.gmane.org> wrote:
>> 在 2017-08-08 15:02,Chen-Yu Tsai 写道:
>>> 
>>> Some SoCs do not support clk delays for MMC in the clock control 
>>> unit.
>>> These include the old controllers in A10/A10s/A13/R8, and the new 
>>> eMMC
>>> controller in A64. The config structure for these controllers do not
>>> specify clk_delays, but the check for this was replaced in commit
>>> b0600daebf31 ("mmc: sunxi: Support controllers that can use both old
>>> and new timings").
>>> 
>>> This patch adds back the check for clk_delays, and also adds comments
>>> for both checks in sunxi_mmc_clk_set_phase().
>>> 
>>> Fixes: b0600daebf31 ("mmc: sunxi: Support controllers that can use
>>>                       both old and new timings")
>>> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>> 
>> 
>> Should I add a Tested-by here?
> 
> If you tested it, then yes. :)

I tested it on A64 MMC2.

So:

Tested-by: Icenowy Zheng <icenowy-h8G6r0blFSE@public.gmane.org>

> 
> ChenYu

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] mmc: sunxi: Fix NULL pointer reference on clk_delays
       [not found] ` <20170808070244.27410-1-wens-jdAy2FN1RRM@public.gmane.org>
  2017-08-08  7:07   ` icenowy-h8G6r0blFSE
@ 2017-08-08 10:37   ` Ulf Hansson
  1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2017-08-08 10:37 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Icenowy Zheng,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-sunxi

On 8 August 2017 at 09:02, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> Some SoCs do not support clk delays for MMC in the clock control unit.
> These include the old controllers in A10/A10s/A13/R8, and the new eMMC
> controller in A64. The config structure for these controllers do not
> specify clk_delays, but the check for this was replaced in commit
> b0600daebf31 ("mmc: sunxi: Support controllers that can use both old
> and new timings").
>
> This patch adds back the check for clk_delays, and also adds comments
> for both checks in sunxi_mmc_clk_set_phase().
>
> Fixes: b0600daebf31 ("mmc: sunxi: Support controllers that can use
>                       both old and new timings")
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>

Thanks, applied for next!

Kind regards
Uffe

> ---
> This fixes an mmc regression on A10/A10s/A13/R8 and A64 introduced
> by the A83T mmc patches.
>
> v1 was inlined in a reply to "mmc: sunxi: fix new timings mode on A64
> EMMC (MMC2) controller"
>
> Changes since v1:
>
>   - Polished comments
>
> I've tested this on my A10 Cubieboard and A20 Cubieboard2.
> ---
>  drivers/mmc/host/sunxi-mmc.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index 3777517982dd..9dc6d726ec49 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -722,9 +722,14 @@ static int sunxi_mmc_clk_set_phase(struct sunxi_mmc_host *host,
>  {
>         int index;
>
> +       /* clk controller delays not used under new timings mode */
>         if (host->use_new_timings)
>                 return 0;
>
> +       /* some old controllers don't support delays */
> +       if (!host->cfg->clk_delays)
> +               return 0;
> +
>         /* determine delays */
>         if (rate <= 400000) {
>                 index = SDXC_CLK_400K;
> --
> 2.13.3
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-08 10:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08  7:02 [PATCH v2] mmc: sunxi: Fix NULL pointer reference on clk_delays Chen-Yu Tsai
     [not found] ` <20170808070244.27410-1-wens-jdAy2FN1RRM@public.gmane.org>
2017-08-08  7:07   ` icenowy-h8G6r0blFSE
     [not found]     ` <bbd4680dc97d9913ff6a49e68c360d21-h8G6r0blFSE@public.gmane.org>
2017-08-08  7:10       ` Chen-Yu Tsai
     [not found]         ` <CAGb2v65qN9OFCnjSRH-=a-XnKEfOJXh=Gvv02vtPydgVEnKuGw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-08  7:11           ` icenowy-h8G6r0blFSE
2017-08-08 10:37   ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox