All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2
@ 2018-07-27 16:53 Chris Brandt
  2018-07-27 16:53 ` [PATCH v3 1/2] soc: renesas: identify RZ/A2 Chris Brandt
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Brandt @ 2018-07-27 16:53 UTC (permalink / raw)
  To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland
  Cc: Geert Uytterhoeven, linux-renesas-soc, devicetree, Chris Brandt

Introduce RZ/A2 (R7S9210) as an SoC that can be selected.

There is no DT mainlined yet, so this is what the entry would look
like for the BSID register:

	bsid: chipid@fcfe8004 {
		compatible = "renesas,bsid";
		reg = <0xfcfe8004 4>;
	};


Chris Brandt (2):
  soc: renesas: identify RZ/A2
  dt-bindings: arm: Document RZ/A2 SoC DT bindings

 Documentation/devicetree/bindings/arm/shmobile.txt | 10 ++--
 drivers/soc/renesas/renesas-soc.c                  | 55 ++++++++++++++++++----
 2 files changed, 53 insertions(+), 12 deletions(-)

-- 
2.16.1

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

* [PATCH v3 1/2] soc: renesas: identify RZ/A2
  2018-07-27 16:53 [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Chris Brandt
@ 2018-07-27 16:53 ` Chris Brandt
  2018-07-30  8:08   ` Geert Uytterhoeven
  2018-07-27 16:53 ` [PATCH v3 2/2] dt-bindings: arm: Document RZ/A2 SoC DT bindings Chris Brandt
  2018-07-31 10:33 ` [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Simon Horman
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Brandt @ 2018-07-27 16:53 UTC (permalink / raw)
  To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland
  Cc: Geert Uytterhoeven, linux-renesas-soc, devicetree, Chris Brandt

Add support for identifying the RZ/A2M (R7S9210) SoC.
Also add support for reading the BSID register which is a different format
than the PRR.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
v2:
* Remove 'hard coded' section because there will not be andy non-DT
  legacy support needed
* Make displaying the chip revision more flexible for the future case
  when the revision number from the BSID will be displayed
---
 drivers/soc/renesas/renesas-soc.c | 55 +++++++++++++++++++++++++++++++++------
 1 file changed, 47 insertions(+), 8 deletions(-)

diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index d44d0e687ab8..cf06cd84092a 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -46,8 +46,12 @@ static const struct renesas_family fam_rmobile __initconst __maybe_unused = {
 	.reg	= 0xe600101c,		/* CCCR (Common Chip Code Register) */
 };
 
-static const struct renesas_family fam_rza __initconst __maybe_unused = {
-	.name	= "RZ/A",
+static const struct renesas_family fam_rza1 __initconst __maybe_unused = {
+	.name	= "RZ/A1",
+};
+
+static const struct renesas_family fam_rza2 __initconst __maybe_unused = {
+	.name	= "RZ/A2",
 };
 
 static const struct renesas_family fam_rzg __initconst __maybe_unused = {
@@ -67,7 +71,12 @@ struct renesas_soc {
 };
 
 static const struct renesas_soc soc_rz_a1h __initconst __maybe_unused = {
-	.family	= &fam_rza,
+	.family	= &fam_rza1,
+};
+
+static const struct renesas_soc soc_rz_a2m __initconst __maybe_unused = {
+	.family	= &fam_rza2,
+	.id	= 0x3b,
 };
 
 static const struct renesas_soc soc_rmobile_ape6 __initconst __maybe_unused = {
@@ -184,6 +193,9 @@ static const struct of_device_id renesas_socs[] __initconst = {
 #ifdef CONFIG_ARCH_R7S72100
 	{ .compatible = "renesas,r7s72100",	.data = &soc_rz_a1h },
 #endif
+#ifdef CONFIG_ARCH_R7S9210
+	{ .compatible = "renesas,r7s9210",	.data = &soc_rz_a2m },
+#endif
 #ifdef CONFIG_ARCH_R8A73A4
 	{ .compatible = "renesas,r8a73a4",	.data = &soc_rmobile_ape6 },
 #endif
@@ -262,7 +274,7 @@ static int __init renesas_soc_init(void)
 	void __iomem *chipid = NULL;
 	struct soc_device *soc_dev;
 	struct device_node *np;
-	unsigned int product;
+	unsigned int product, eshi = 0, eslo;
 
 	match = of_match_node(renesas_socs, of_root);
 	if (!match)
@@ -271,6 +283,31 @@ static int __init renesas_soc_init(void)
 	soc = match->data;
 	family = soc->family;
 
+	np = of_find_compatible_node(NULL, NULL, "renesas,bsid");
+	if (np) {
+		chipid = of_iomap(np, 0);
+		of_node_put(np);
+
+		if (chipid) {
+			product = readl(chipid);
+			iounmap(chipid);
+
+			if (soc->id && ((product >> 16) & 0xff) != soc->id) {
+				pr_warn("SoC mismatch (product = 0x%x)\n",
+					product);
+				return -ENODEV;
+			}
+		}
+
+		/*
+		 * TODO: Upper 4 bits of BSID are for chip version, but the
+		 * format is not known at this time so we don't know how to
+		 * specify eshi and eslo
+		 */
+
+		goto done;
+	}
+
 	/* Try PRR first, then hardcoded fallback */
 	np = of_find_compatible_node(NULL, NULL, "renesas,prr");
 	if (np) {
@@ -289,8 +326,11 @@ static int __init renesas_soc_init(void)
 			pr_warn("SoC mismatch (product = 0x%x)\n", product);
 			return -ENODEV;
 		}
+		eshi = ((product >> 4) & 0x0f) + 1;
+		eslo = product & 0xf;
 	}
 
+done:
 	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
 	if (!soc_dev_attr)
 		return -ENOMEM;
@@ -302,10 +342,9 @@ static int __init renesas_soc_init(void)
 	soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
 	soc_dev_attr->soc_id = kstrdup_const(strchr(match->compatible, ',') + 1,
 					     GFP_KERNEL);
-	if (chipid)
-		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u",
-						   ((product >> 4) & 0x0f) + 1,
-						   product & 0xf);
+	if (eshi)
+		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", eshi,
+						   eslo);
 
 	pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
 		soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
-- 
2.16.1

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

* [PATCH v3 2/2] dt-bindings: arm: Document RZ/A2 SoC DT bindings
  2018-07-27 16:53 [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Chris Brandt
  2018-07-27 16:53 ` [PATCH v3 1/2] soc: renesas: identify RZ/A2 Chris Brandt
@ 2018-07-27 16:53 ` Chris Brandt
  2018-07-30 23:16   ` Rob Herring
  2018-07-31 10:33 ` [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Simon Horman
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Brandt @ 2018-07-27 16:53 UTC (permalink / raw)
  To: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland
  Cc: Geert Uytterhoeven, linux-renesas-soc, devicetree, Chris Brandt

Add device tree bindings documentation for Renesas RZ/A2 (r7s9210) SoC.
Also document new option for "renesas,bsid"

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
* added "or Boundary Scan ID Register" to description
v2:
 * added Reviewed-by
 * added renesas,bsid comment
---
 Documentation/devicetree/bindings/arm/shmobile.txt | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt b/Documentation/devicetree/bindings/arm/shmobile.txt
index 89b4a389fbc7..882fe5a71db8 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -7,6 +7,8 @@ SoCs:
     compatible = "renesas,emev2"
   - RZ/A1H (R7S72100)
     compatible = "renesas,r7s72100"
+  - RZ/A2 (R7S9210)
+    compatible = "renesas,r7s9210"
   - SH-Mobile AG5 (R8A73A00/SH73A0)
     compatible = "renesas,sh73a0"
   - R-Mobile APE6 (R8A73A40)
@@ -143,12 +145,12 @@ Boards:
     compatible = "renesas,wheat", "renesas,r8a7792"
 
 
-Most Renesas ARM SoCs have a Product Register that allows to retrieve SoC
-product and revision information.  If present, a device node for this register
-should be added.
+Most Renesas ARM SoCs have a Product Register or Boundary Scan ID Register that
+allows to retrieve SoC product and revision information.  If present, a device
+node for this register should be added.
 
 Required properties:
-  - compatible: Must be "renesas,prr".
+  - compatible: Must be "renesas,prr" or "renesas,bsid"
   - reg: Base address and length of the register block.
 
 
-- 
2.16.1

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

* Re: [PATCH v3 1/2] soc: renesas: identify RZ/A2
  2018-07-27 16:53 ` [PATCH v3 1/2] soc: renesas: identify RZ/A2 Chris Brandt
@ 2018-07-30  8:08   ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2018-07-30  8:08 UTC (permalink / raw)
  To: Chris Brandt
  Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland,
	Geert Uytterhoeven, Linux-Renesas,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Fri, Jul 27, 2018 at 6:53 PM Chris Brandt <chris.brandt@renesas.com> wrote:
> Add support for identifying the RZ/A2M (R7S9210) SoC.

+ correct the original RZ/A SoC family name to RZ/A1?

> Also add support for reading the BSID register which is a different format
> than the PRR.
>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
> ---
> v2:
> * Remove 'hard coded' section because there will not be andy non-DT
>   legacy support needed
> * Make displaying the chip revision more flexible for the future case
>   when the revision number from the BSID will be displayed

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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 v3 2/2] dt-bindings: arm: Document RZ/A2 SoC DT bindings
  2018-07-27 16:53 ` [PATCH v3 2/2] dt-bindings: arm: Document RZ/A2 SoC DT bindings Chris Brandt
@ 2018-07-30 23:16   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2018-07-30 23:16 UTC (permalink / raw)
  To: Chris Brandt
  Cc: Simon Horman, Magnus Damm, Mark Rutland, Geert Uytterhoeven,
	linux-renesas-soc, devicetree

On Fri, Jul 27, 2018 at 11:53:33AM -0500, Chris Brandt wrote:
> Add device tree bindings documentation for Renesas RZ/A2 (r7s9210) SoC.
> Also document new option for "renesas,bsid"
> 
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v3:
> * added "or Boundary Scan ID Register" to description
> v2:
>  * added Reviewed-by
>  * added renesas,bsid comment
> ---
>  Documentation/devicetree/bindings/arm/shmobile.txt | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2
  2018-07-27 16:53 [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Chris Brandt
  2018-07-27 16:53 ` [PATCH v3 1/2] soc: renesas: identify RZ/A2 Chris Brandt
  2018-07-27 16:53 ` [PATCH v3 2/2] dt-bindings: arm: Document RZ/A2 SoC DT bindings Chris Brandt
@ 2018-07-31 10:33 ` Simon Horman
  2 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2018-07-31 10:33 UTC (permalink / raw)
  To: Chris Brandt
  Cc: Magnus Damm, Rob Herring, Mark Rutland, Geert Uytterhoeven,
	linux-renesas-soc, devicetree

On Fri, Jul 27, 2018 at 11:53:31AM -0500, Chris Brandt wrote:
> Introduce RZ/A2 (R7S9210) as an SoC that can be selected.
> 
> There is no DT mainlined yet, so this is what the entry would look
> like for the BSID register:
> 
> 	bsid: chipid@fcfe8004 {
> 		compatible = "renesas,bsid";
> 		reg = <0xfcfe8004 4>;
> 	};
> 
> 
> Chris Brandt (2):
>   soc: renesas: identify RZ/A2
>   dt-bindings: arm: Document RZ/A2 SoC DT bindings

Thanks Chris,

applied for v4.20.

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

end of thread, other threads:[~2018-07-31 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-27 16:53 [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Chris Brandt
2018-07-27 16:53 ` [PATCH v3 1/2] soc: renesas: identify RZ/A2 Chris Brandt
2018-07-30  8:08   ` Geert Uytterhoeven
2018-07-27 16:53 ` [PATCH v3 2/2] dt-bindings: arm: Document RZ/A2 SoC DT bindings Chris Brandt
2018-07-30 23:16   ` Rob Herring
2018-07-31 10:33 ` [PATCH v3 0/2] ARM: shmobile: Add support for RZ/A2 Simon Horman

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.