linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host
@ 2019-03-19 10:34 Wolfram Sang
  2019-03-19 10:57 ` Geert Uytterhoeven
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Wolfram Sang @ 2019-03-19 10:34 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Niklas Söderlund, Marek Vasut,
	Yoshihiro Shimoda, Wolfram Sang

The CBSY flag should be proper before calling tmio_mmc_host_probe()
because this function will already use write16 which checks this bit.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

This patch depends on "[RFT] mmc: renesas_sdhi: limit block count to 16 bit for
old revisions" [1]. This one, however, is not backed by a bug report but just
found by code review. I wouldn't suggest stable here because the non-working
case is probably more on the academic side (unless I overlooked something).
Yet, the code becomes easier to read because it is the flow one would expect.
So, I post this already for discussion. We need to wait for the dependency
first, of course.

Tested on the SDR50 only SDHI of a Renesas Lager board (R-Car H2). No
regressions encountered: still probes fine and works at the same speed.

[1] https://patchwork.kernel.org/patch/10859279/

 drivers/mmc/host/renesas_sdhi_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 8742e27e4e8b..5885f3fb0b2f 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -779,14 +779,14 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
 		mmc_data->max_blk_count = U16_MAX;
 
-	ret = tmio_mmc_host_probe(host);
-	if (ret < 0)
-		goto edisclk;
-
 	/* One Gen2 SDHI incarnation does NOT have a CBSY bit */
 	if (ver == SDHI_VER_GEN2_SDR50)
 		mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
 
+	ret = tmio_mmc_host_probe(host);
+	if (ret < 0)
+		goto edisclk;
+
 	/* Enable tuning iff we have an SCC and a supported mode */
 	if (of_data && of_data->scc_offset &&
 	    (host->mmc->caps & MMC_CAP_UHS_SDR104 ||
-- 
2.11.0


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

* Re: [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host
  2019-03-19 10:34 [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host Wolfram Sang
@ 2019-03-19 10:57 ` Geert Uytterhoeven
  2019-03-19 11:29   ` Wolfram Sang
  2019-03-19 11:45 ` Simon Horman
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-03-19 10:57 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Linux MMC List, Linux-Renesas, Niklas Söderlund,
	Marek Vasut, Yoshihiro Shimoda

On Tue, Mar 19, 2019 at 11:34 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> The CBSY flag should be proper before calling tmio_mmc_host_probe()

set?

> because this function will already use write16 which checks this bit.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host
  2019-03-19 10:57 ` Geert Uytterhoeven
@ 2019-03-19 11:29   ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2019-03-19 11:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfram Sang, Linux MMC List, Linux-Renesas,
	Niklas Söderlund, Marek Vasut, Yoshihiro Shimoda

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

On Tue, Mar 19, 2019 at 11:57:00AM +0100, Geert Uytterhoeven wrote:
> On Tue, Mar 19, 2019 at 11:34 AM Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> > The CBSY flag should be proper before calling tmio_mmc_host_probe()
> 
> set?

No. The state should be proper. As you see in the code, it gets cleared
for a certain type of SDHI.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host
  2019-03-19 10:34 [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host Wolfram Sang
  2019-03-19 10:57 ` Geert Uytterhoeven
@ 2019-03-19 11:45 ` Simon Horman
  2019-03-20 20:14 ` Niklas Söderlund
  2019-03-25 13:26 ` Ulf Hansson
  3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2019-03-19 11:45 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-mmc, linux-renesas-soc, Niklas Söderlund, Marek Vasut,
	Yoshihiro Shimoda

On Tue, Mar 19, 2019 at 11:34:17AM +0100, Wolfram Sang wrote:
> The CBSY flag should be proper before calling tmio_mmc_host_probe()
> because this function will already use write16 which checks this bit.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> This patch depends on "[RFT] mmc: renesas_sdhi: limit block count to 16 bit for
> old revisions" [1]. This one, however, is not backed by a bug report but just
> found by code review. I wouldn't suggest stable here because the non-working
> case is probably more on the academic side (unless I overlooked something).
> Yet, the code becomes easier to read because it is the flow one would expect.
> So, I post this already for discussion. We need to wait for the dependency
> first, of course.
> 
> Tested on the SDR50 only SDHI of a Renesas Lager board (R-Car H2). No
> regressions encountered: still probes fine and works at the same speed.

Do you have plans for further testing?

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

> [1] https://patchwork.kernel.org/patch/10859279/
> 
>  drivers/mmc/host/renesas_sdhi_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index 8742e27e4e8b..5885f3fb0b2f 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -779,14 +779,14 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>  	if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
>  		mmc_data->max_blk_count = U16_MAX;
>  
> -	ret = tmio_mmc_host_probe(host);
> -	if (ret < 0)
> -		goto edisclk;
> -
>  	/* One Gen2 SDHI incarnation does NOT have a CBSY bit */
>  	if (ver == SDHI_VER_GEN2_SDR50)
>  		mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
>  
> +	ret = tmio_mmc_host_probe(host);
> +	if (ret < 0)
> +		goto edisclk;
> +
>  	/* Enable tuning iff we have an SCC and a supported mode */
>  	if (of_data && of_data->scc_offset &&
>  	    (host->mmc->caps & MMC_CAP_UHS_SDR104 ||
> -- 
> 2.11.0
> 

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

* Re: [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host
  2019-03-19 10:34 [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host Wolfram Sang
  2019-03-19 10:57 ` Geert Uytterhoeven
  2019-03-19 11:45 ` Simon Horman
@ 2019-03-20 20:14 ` Niklas Söderlund
  2019-03-25 13:26 ` Ulf Hansson
  3 siblings, 0 replies; 6+ messages in thread
From: Niklas Söderlund @ 2019-03-20 20:14 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, Marek Vasut, Yoshihiro Shimoda

Hi Wolfram,

Thanks for your work.

On 2019-03-19 11:34:17 +0100, Wolfram Sang wrote:
> The CBSY flag should be proper before calling tmio_mmc_host_probe()
> because this function will already use write16 which checks this bit.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

This matches whit how I read the code, nice catch.

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> 
> This patch depends on "[RFT] mmc: renesas_sdhi: limit block count to 16 bit for
> old revisions" [1]. This one, however, is not backed by a bug report but just
> found by code review. I wouldn't suggest stable here because the non-working
> case is probably more on the academic side (unless I overlooked something).
> Yet, the code becomes easier to read because it is the flow one would expect.
> So, I post this already for discussion. We need to wait for the dependency
> first, of course.
> 
> Tested on the SDR50 only SDHI of a Renesas Lager board (R-Car H2). No
> regressions encountered: still probes fine and works at the same speed.
> 
> [1] https://patchwork.kernel.org/patch/10859279/
> 
>  drivers/mmc/host/renesas_sdhi_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index 8742e27e4e8b..5885f3fb0b2f 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -779,14 +779,14 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>  	if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
>  		mmc_data->max_blk_count = U16_MAX;
>  
> -	ret = tmio_mmc_host_probe(host);
> -	if (ret < 0)
> -		goto edisclk;
> -
>  	/* One Gen2 SDHI incarnation does NOT have a CBSY bit */
>  	if (ver == SDHI_VER_GEN2_SDR50)
>  		mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
>  
> +	ret = tmio_mmc_host_probe(host);
> +	if (ret < 0)
> +		goto edisclk;
> +
>  	/* Enable tuning iff we have an SCC and a supported mode */
>  	if (of_data && of_data->scc_offset &&
>  	    (host->mmc->caps & MMC_CAP_UHS_SDR104 ||
> -- 
> 2.11.0
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host
  2019-03-19 10:34 [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host Wolfram Sang
                   ` (2 preceding siblings ...)
  2019-03-20 20:14 ` Niklas Söderlund
@ 2019-03-25 13:26 ` Ulf Hansson
  3 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2019-03-25 13:26 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-mmc, Linux-Renesas, Niklas Söderlund, Marek Vasut,
	Yoshihiro Shimoda

On Tue, 19 Mar 2019 at 11:34, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> The CBSY flag should be proper before calling tmio_mmc_host_probe()
> because this function will already use write16 which checks this bit.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>
> This patch depends on "[RFT] mmc: renesas_sdhi: limit block count to 16 bit for
> old revisions" [1]. This one, however, is not backed by a bug report but just
> found by code review. I wouldn't suggest stable here because the non-working
> case is probably more on the academic side (unless I overlooked something).
> Yet, the code becomes easier to read because it is the flow one would expect.
> So, I post this already for discussion. We need to wait for the dependency
> first, of course.
>
> Tested on the SDR50 only SDHI of a Renesas Lager board (R-Car H2). No
> regressions encountered: still probes fine and works at the same speed.
>
> [1] https://patchwork.kernel.org/patch/10859279/
>
>  drivers/mmc/host/renesas_sdhi_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index 8742e27e4e8b..5885f3fb0b2f 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -779,14 +779,14 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>         if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
>                 mmc_data->max_blk_count = U16_MAX;
>
> -       ret = tmio_mmc_host_probe(host);
> -       if (ret < 0)
> -               goto edisclk;
> -
>         /* One Gen2 SDHI incarnation does NOT have a CBSY bit */
>         if (ver == SDHI_VER_GEN2_SDR50)
>                 mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
>
> +       ret = tmio_mmc_host_probe(host);
> +       if (ret < 0)
> +               goto edisclk;
> +
>         /* Enable tuning iff we have an SCC and a supported mode */
>         if (of_data && of_data->scc_offset &&
>             (host->mmc->caps & MMC_CAP_UHS_SDR104 ||
> --
> 2.11.0
>

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

end of thread, other threads:[~2019-03-25 13:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 10:34 [PATCH] mmc: renesas_sdhi: set CBSY flag before probing TMIO host Wolfram Sang
2019-03-19 10:57 ` Geert Uytterhoeven
2019-03-19 11:29   ` Wolfram Sang
2019-03-19 11:45 ` Simon Horman
2019-03-20 20:14 ` Niklas Söderlund
2019-03-25 13:26 ` Ulf Hansson

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).