All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions
@ 2017-08-02 12:48 Simon Horman
  2017-08-02 19:51 ` Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Simon Horman @ 2017-08-02 12:48 UTC (permalink / raw)
  To: Wolfram Sang, Ulf Hansson
  Cc: Magnus Damm, linux-mmc, linux-renesas-soc, Simon Horman

Provide a whitelist for Gen3 SoC ES versions for both the SYS DMAC and
internal DMAC variants of the SDHI driver.  This is to allow drivers to
only initialise for Gen3 SoC ES versions for which they are the appropriate
DMAC implementation.  Currently internal DMAC is the appropriate
implementation for all supported Gen3 SoC ES versions.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 15 +++++++++++++++
 drivers/mmc/host/renesas_sdhi_sys_dmac.c      | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index a26c6ed8e029..6717003888e2 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
+#include <linux/sys_soc.h>
 
 #include "renesas_sdhi.h"
 #include "tmio_mmc.h"
@@ -241,8 +242,22 @@ static struct tmio_mmc_dma_ops renesas_sdhi_internal_dmac_dma_ops = {
 	.dataend = renesas_sdhi_internal_dmac_dataend_dma,
 };
 
+/*
+ * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
+ * implementation as others may use a different implementation.
+ */
+static const struct soc_device_attribute gen3_soc_whitelist[] = {
+        { .soc_id = "r8a7795", .revision = "ES1.*" },
+        { .soc_id = "r8a7795", .revision = "ES2.0" },
+        { .soc_id = "r8a7796", .revision = "ES1.0" },
+        { /* sentinel */ }
+};
+
 static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
 {
+	if (!soc_device_match(gen3_soc_whitelist))
+		return -ENODEV;
+
 	return renesas_sdhi_probe(pdev, &renesas_sdhi_internal_dmac_dma_ops);
 }
 
diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index b6789f5197b3..718cb8a9d2ce 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -18,8 +18,10 @@
 #include <linux/mmc/host.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
+#include <linux/sys_soc.h>
 
 #include "renesas_sdhi.h"
 #include "tmio_mmc.h"
@@ -459,8 +461,21 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_sys_dmac_dma_ops = {
 	.dataend = renesas_sdhi_sys_dmac_dataend_dma,
 };
 
+/*
+ * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
+ * implementation. Currently empty as all supported ES versions use
+ * the internal DMAC.
+ */
+static const struct soc_device_attribute gen3_soc_whitelist[] = {
+        { /* sentinel */ }
+};
+
 static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
 {
+	if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible &&
+	    !soc_device_match(gen3_soc_whitelist))
+		return -ENODEV;
+
 	return renesas_sdhi_probe(pdev, &renesas_sdhi_sys_dmac_dma_ops);
 }
 
-- 
2.1.4

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

* Re: [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions
  2017-08-02 12:48 [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions Simon Horman
@ 2017-08-02 19:51 ` Wolfram Sang
  2017-08-03  7:41   ` Simon Horman
  2017-08-03 10:52 ` Ulf Hansson
  2017-08-14 13:24 ` Geert Uytterhoeven
  2 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2017-08-02 19:51 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

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

On Wed, Aug 02, 2017 at 02:48:42PM +0200, Simon Horman wrote:
> Provide a whitelist for Gen3 SoC ES versions for both the SYS DMAC and
> internal DMAC variants of the SDHI driver.  This is to allow drivers to
> only initialise for Gen3 SoC ES versions for which they are the appropriate
> DMAC implementation.  Currently internal DMAC is the appropriate
> implementation for all supported Gen3 SoC ES versions.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

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

> +/*
> + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
> + * implementation. Currently empty as all supported ES versions use
> + * the internal DMAC.
> + */
> +static const struct soc_device_attribute gen3_soc_whitelist[] = {
> +        { /* sentinel */ }
> +};

It may look strange to add an empty list, but I think it is worth it. We
have good reasons to believe the soc_device_match distinction is
necessary and I think it is good to be clear from the beginning how we
want to deal with the differences.


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

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

* Re: [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions
  2017-08-02 19:51 ` Wolfram Sang
@ 2017-08-03  7:41   ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2017-08-03  7:41 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, linux-mmc, linux-renesas-soc

On Wed, Aug 02, 2017 at 09:51:29PM +0200, Wolfram Sang wrote:
> On Wed, Aug 02, 2017 at 02:48:42PM +0200, Simon Horman wrote:
> > Provide a whitelist for Gen3 SoC ES versions for both the SYS DMAC and
> > internal DMAC variants of the SDHI driver.  This is to allow drivers to
> > only initialise for Gen3 SoC ES versions for which they are the appropriate
> > DMAC implementation.  Currently internal DMAC is the appropriate
> > implementation for all supported Gen3 SoC ES versions.
> > 
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> 
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> > +/*
> > + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
> > + * implementation. Currently empty as all supported ES versions use
> > + * the internal DMAC.
> > + */
> > +static const struct soc_device_attribute gen3_soc_whitelist[] = {
> > +        { /* sentinel */ }
> > +};
> 
> It may look strange to add an empty list, but I think it is worth it. We
> have good reasons to believe the soc_device_match distinction is
> necessary and I think it is good to be clear from the beginning how we
> want to deal with the differences.

Hi Wolfram,

thanks for adding some colour to the motivation for this change.
I agree with your statements above.

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

* Re: [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions
  2017-08-02 12:48 [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions Simon Horman
  2017-08-02 19:51 ` Wolfram Sang
@ 2017-08-03 10:52 ` Ulf Hansson
  2017-08-14 13:24 ` Geert Uytterhoeven
  2 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2017-08-03 10:52 UTC (permalink / raw)
  To: Simon Horman; +Cc: Wolfram Sang, Magnus Damm, linux-mmc, Linux-Renesas

On 2 August 2017 at 14:48, Simon Horman <horms+renesas@verge.net.au> wrote:
> Provide a whitelist for Gen3 SoC ES versions for both the SYS DMAC and
> internal DMAC variants of the SDHI driver.  This is to allow drivers to
> only initialise for Gen3 SoC ES versions for which they are the appropriate
> DMAC implementation.  Currently internal DMAC is the appropriate
> implementation for all supported Gen3 SoC ES versions.
>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 15 +++++++++++++++
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c      | 15 +++++++++++++++
>  2 files changed, 30 insertions(+)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index a26c6ed8e029..6717003888e2 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -18,6 +18,7 @@
>  #include <linux/module.h>
>  #include <linux/pagemap.h>
>  #include <linux/scatterlist.h>
> +#include <linux/sys_soc.h>
>
>  #include "renesas_sdhi.h"
>  #include "tmio_mmc.h"
> @@ -241,8 +242,22 @@ static struct tmio_mmc_dma_ops renesas_sdhi_internal_dmac_dma_ops = {
>         .dataend = renesas_sdhi_internal_dmac_dataend_dma,
>  };
>
> +/*
> + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
> + * implementation as others may use a different implementation.
> + */
> +static const struct soc_device_attribute gen3_soc_whitelist[] = {
> +        { .soc_id = "r8a7795", .revision = "ES1.*" },
> +        { .soc_id = "r8a7795", .revision = "ES2.0" },
> +        { .soc_id = "r8a7796", .revision = "ES1.0" },
> +        { /* sentinel */ }
> +};
> +
>  static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
>  {
> +       if (!soc_device_match(gen3_soc_whitelist))
> +               return -ENODEV;
> +
>         return renesas_sdhi_probe(pdev, &renesas_sdhi_internal_dmac_dma_ops);
>  }
>
> diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> index b6789f5197b3..718cb8a9d2ce 100644
> --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> @@ -18,8 +18,10 @@
>  #include <linux/mmc/host.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> +#include <linux/of_device.h>
>  #include <linux/pagemap.h>
>  #include <linux/scatterlist.h>
> +#include <linux/sys_soc.h>
>
>  #include "renesas_sdhi.h"
>  #include "tmio_mmc.h"
> @@ -459,8 +461,21 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_sys_dmac_dma_ops = {
>         .dataend = renesas_sdhi_sys_dmac_dataend_dma,
>  };
>
> +/*
> + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
> + * implementation. Currently empty as all supported ES versions use
> + * the internal DMAC.
> + */
> +static const struct soc_device_attribute gen3_soc_whitelist[] = {
> +        { /* sentinel */ }
> +};
> +
>  static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
>  {
> +       if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible &&
> +           !soc_device_match(gen3_soc_whitelist))
> +               return -ENODEV;
> +
>         return renesas_sdhi_probe(pdev, &renesas_sdhi_sys_dmac_dma_ops);
>  }
>
> --
> 2.1.4
>

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

* Re: [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions
  2017-08-02 12:48 [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions Simon Horman
  2017-08-02 19:51 ` Wolfram Sang
  2017-08-03 10:52 ` Ulf Hansson
@ 2017-08-14 13:24 ` Geert Uytterhoeven
  2 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2017-08-14 13:24 UTC (permalink / raw)
  To: Simon Horman
  Cc: Wolfram Sang, Ulf Hansson, Magnus Damm, Linux MMC List, Linux-Renesas

Hi Simon,

On Wed, Aug 2, 2017 at 2:48 PM, Simon Horman <horms+renesas@verge.net.au> wrote:
> Provide a whitelist for Gen3 SoC ES versions for both the SYS DMAC and
> internal DMAC variants of the SDHI driver.  This is to allow drivers to
> only initialise for Gen3 SoC ES versions for which they are the appropriate
> DMAC implementation.  Currently internal DMAC is the appropriate
> implementation for all supported Gen3 SoC ES versions.
>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 15 +++++++++++++++
>  drivers/mmc/host/renesas_sdhi_sys_dmac.c      | 15 +++++++++++++++
>  2 files changed, 30 insertions(+)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index a26c6ed8e029..6717003888e2 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c

> @@ -241,8 +242,22 @@ static struct tmio_mmc_dma_ops renesas_sdhi_internal_dmac_dma_ops = {
>         .dataend = renesas_sdhi_internal_dmac_dataend_dma,
>  };
>
> +/*
> + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
> + * implementation as others may use a different implementation.
> + */
> +static const struct soc_device_attribute gen3_soc_whitelist[] = {
> +        { .soc_id = "r8a7795", .revision = "ES1.*" },
> +        { .soc_id = "r8a7795", .revision = "ES2.0" },
> +        { .soc_id = "r8a7796", .revision = "ES1.0" },
> +        { /* sentinel */ }
> +};
> +
>  static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
>  {
> +       if (!soc_device_match(gen3_soc_whitelist))
> +               return -ENODEV;

The pattern followed here is different from the pattern followed so far in
other places where we use soc_device_match(): instead of implementing a
specific behavior for early SoC revisions, and another behavior for later (and
future!) SoC revisions, this check tests for all current SoC revisions, and
breaks[*] for future versions (R-Car H3 ES2.1 and later, R-Car M3-W ES1.1 and
later).

I guess this is done this way because we don't have any R-Car Gen3 SoCs yet
that do support SYS-DMAC for SDHI?

[*] I understand it doesn't really break, but falls back to PIO on future
    revisions? Hence it should be OK.

> +
>         return renesas_sdhi_probe(pdev, &renesas_sdhi_internal_dmac_dma_ops);
>  }
>
> diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> index b6789f5197b3..718cb8a9d2ce 100644
> --- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c

> @@ -459,8 +461,21 @@ static const struct tmio_mmc_dma_ops renesas_sdhi_sys_dmac_dma_ops = {
>         .dataend = renesas_sdhi_sys_dmac_dataend_dma,
>  };
>
> +/*
> + * Whitelist of specific R-Car Gen3 SoC ES versions to use this DMAC
> + * implementation. Currently empty as all supported ES versions use
> + * the internal DMAC.
> + */
> +static const struct soc_device_attribute gen3_soc_whitelist[] = {
> +        { /* sentinel */ }
> +};
> +
>  static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev)
>  {
> +       if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible &&
> +           !soc_device_match(gen3_soc_whitelist))
> +               return -ENODEV;
> +
>         return renesas_sdhi_probe(pdev, &renesas_sdhi_sys_dmac_dma_ops);
>  }

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] 5+ messages in thread

end of thread, other threads:[~2017-08-14 13:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 12:48 [PATCH mmc/next] mmc: renesas-sdhi: provide a whitelist for Gen3 SoC ES versions Simon Horman
2017-08-02 19:51 ` Wolfram Sang
2017-08-03  7:41   ` Simon Horman
2017-08-03 10:52 ` Ulf Hansson
2017-08-14 13:24 ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.