linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code
@ 2019-01-21 12:16 Magnus Damm
  2019-01-21 12:16 ` [PATCH/RFC 01/06] Prototype code for IMP-X5 Magnus Damm
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:16 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

R-Car Gen3 IMP-X5 prototype code

[PATCH/RFC 01/06] Prototype code for IMP-X5
[PATCH/RFC 02/06] arm64: dts: renesas: r8a7795: One IMP-X5 device for R-Car H3
[PATCH/RFC 03/06] arm64: dts: renesas: r8a7796: One IMP-X5 device for R-Car M3-W
[PATCH/RFC 04/06] arm64: dts: renesas: r8a77965: One IMP-X5 device for R-Car M3-N
[PATCH/RFC 05/06] arm64: dts: renesas: r8a77970: One IMP-X5 device for R-Car V3M
[PATCH/RFC 06/06] arm64: dts: renesas: r8a77980: One IMP-X5 device for R-Car V3H

These patches temporarily introduce a IMP-X5 driver that uses Runtime PM
to control clocks and power when trying to access the device.

The user should check console printouts and comment out Run-time PM
bits of the code with/without power domain DT information to verify that
register settings are changed as expected. Per-SoC modifications of the
Clock, Reset and Power domain code may be required.

Not intended for upstream merge. Written for H3 ES2 ULCB.

Created as an example of how to test power domains for a certain device.
I hope to use this approach to test IPMMU power domain support in the future.

Not-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 Developed on top of v5.0-rc3
 
 arch/arm64/boot/dts/renesas/r8a7795.dtsi  |    9 +++
 arch/arm64/boot/dts/renesas/r8a7796.dtsi  |    9 +++
 arch/arm64/boot/dts/renesas/r8a77965.dtsi |    9 +++
 arch/arm64/boot/dts/renesas/r8a77970.dtsi |    9 +++
 arch/arm64/boot/dts/renesas/r8a77980.dtsi |    9 +++
 drivers/soc/renesas/Makefile              |    2 
 drivers/soc/renesas/renesas-test-imp-x5.c |   77 +++++++++++++++++++++++++++++
 7 files changed, 123 insertions(+), 1 deletion(-)

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

* [PATCH/RFC 01/06] Prototype code for IMP-X5
  2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
@ 2019-01-21 12:16 ` Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 02/06] arm64: dts: renesas: r8a7795: One IMP-X5 device for R-Car H3 Magnus Damm
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:16 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Prototype code to read out the IMP-X5 register settings at probe() time.

Not for upstream merge.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/soc/renesas/Makefile              |    2 
 drivers/soc/renesas/renesas-test-imp-x5.c |   77 +++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 1 deletion(-)

--- 0001/drivers/soc/renesas/Makefile
+++ work/drivers/soc/renesas/Makefile	2019-01-21 19:52:18.929754637 +0900
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 # Generic, must be first because of soc_device_register()
-obj-$(CONFIG_SOC_RENESAS)	+= renesas-soc.o
+obj-$(CONFIG_SOC_RENESAS)	+= renesas-soc.o renesas-test-imp-x5.o
 
 # SoC
 obj-$(CONFIG_SYSC_R8A7743)	+= r8a7743-sysc.o
--- /dev/null
+++ work/drivers/soc/renesas/renesas-test-imp-x5.c	2019-01-21 20:21:30.895607391 +0900
@@ -0,0 +1,77 @@
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+static const struct of_device_id imp_x5_of_match[] = {
+	{ .compatible = "renesas,imp-x5" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imp_x5_of_match);
+
+static void imp_x5_dump_line(unsigned long addr, void __iomem *base, int offs)
+{
+	unsigned int buf[4];
+	char pfx[16];
+	int i;
+
+	for (i = 0; i < 4; i++)
+		buf[i] = ioread32(base + offs + i);
+
+	snprintf(pfx, sizeof(pfx), "0x%08lx: ", addr + offs);
+	
+	print_hex_dump(KERN_DEBUG, pfx, 0, 16, 1, &buf[0], 16, true);
+}
+
+static void imp_x5_dump(unsigned long addr, void __iomem *base, int length)
+{
+	int i;
+	
+	for (i = 0; i < length; i += 16)
+		imp_x5_dump_line(addr, base, i);
+}
+
+static int imp_x5_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct resource *res;
+	void __iomem *base;
+	int i;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(base)) {
+		dev_warn(dev, "unable to map imp-x5 registers\n");
+		return PTR_ERR(base);
+	}
+	
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
+	printk("IMP-X5 test: dumping registers\n");
+
+	for (i = 0; i < resource_size(res) && i < 0x300000; i += 0x100000)
+		imp_x5_dump(res->start + i, base + i, 64);
+	
+	pm_runtime_put(dev);
+	pm_runtime_disable(dev);
+
+	return -ENODEV;
+}
+
+static struct platform_driver imp_x5_driver = {
+	.driver		= {
+		.name	= "renesas-imp-x5",
+		.of_match_table = of_match_ptr(imp_x5_of_match),
+	},
+	.probe		= imp_x5_probe,
+};
+
+module_platform_driver(imp_x5_driver);
+
+MODULE_DESCRIPTION("Renesas IMP-X5 test driver");
+MODULE_LICENSE("GPL v2");

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

* [PATCH/RFC 02/06] arm64: dts: renesas: r8a7795: One IMP-X5 device for R-Car H3
  2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
  2019-01-21 12:16 ` [PATCH/RFC 01/06] Prototype code for IMP-X5 Magnus Damm
@ 2019-01-21 12:17 ` Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 03/06] arm64: dts: renesas: r8a7796: One IMP-X5 device for R-Car M3-W Magnus Damm
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:17 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Add an IMP-X5 device node to the r8a7795 device tree source.

Not for upstream merge.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a7795.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)

--- 0002/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a7795.dtsi	2019-01-21 19:36:29.978002626 +0900
@@ -3047,6 +3047,15 @@
 			};
 		};
 
+		imp-x5@ff900000 {
+			compatible = "renesas,imp-x5";
+			reg = <0 0xff900000 0 0x300000>;
+			interrupts = <GIC_SPI 439 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 824>;
+			power-domains = <&sysc R8A7795_PD_A3IR>;
+			resets = <&cpg 824>;
+		};
+
 		prr: chipid@fff00044 {
 			compatible = "renesas,prr";
 			reg = <0 0xfff00044 0 4>;

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

* [PATCH/RFC 03/06] arm64: dts: renesas: r8a7796: One IMP-X5 device for R-Car M3-W
  2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
  2019-01-21 12:16 ` [PATCH/RFC 01/06] Prototype code for IMP-X5 Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 02/06] arm64: dts: renesas: r8a7795: One IMP-X5 device for R-Car H3 Magnus Damm
@ 2019-01-21 12:17 ` Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 04/06] arm64: dts: renesas: r8a77965: One IMP-X5 device for R-Car M3-N Magnus Damm
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:17 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Add an IMP-X5 device node to the r8a7796 device tree source.

Not for upstream merge.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a7796.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)

--- 0003/arch/arm64/boot/dts/renesas/r8a7796.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a7796.dtsi	2019-01-21 19:38:59.092820475 +0900
@@ -2791,6 +2791,15 @@
 			};
 		};
 
+		imp-x5@ff900000 {
+			compatible = "renesas,imp-x5";
+			reg = <0 0xff900000 0 0x300000>;
+			interrupts = <GIC_SPI 439 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 824>;
+			power-domains = <&sysc R8A7796_PD_A3IR>;
+			resets = <&cpg 824>;
+		};
+
 		prr: chipid@fff00044 {
 			compatible = "renesas,prr";
 			reg = <0 0xfff00044 0 4>;

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

* [PATCH/RFC 04/06] arm64: dts: renesas: r8a77965: One IMP-X5 device for R-Car M3-N
  2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
                   ` (2 preceding siblings ...)
  2019-01-21 12:17 ` [PATCH/RFC 03/06] arm64: dts: renesas: r8a7796: One IMP-X5 device for R-Car M3-W Magnus Damm
@ 2019-01-21 12:17 ` Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 05/06] arm64: dts: renesas: r8a77970: One IMP-X5 device for R-Car V3M Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 06/06] arm64: dts: renesas: r8a77980: One IMP-X5 device for R-Car V3H Magnus Damm
  5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:17 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Add an IMP-X5 device node to the r8a77965 device tree source.

Not for upstream merge.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77965.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)

--- 0001/arch/arm64/boot/dts/renesas/r8a77965.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a77965.dtsi	2019-01-21 19:42:00.129311931 +0900
@@ -2225,6 +2225,15 @@
 			};
 		};
 
+		imp-x5@ff900000 {
+			compatible = "renesas,imp-x5";
+			reg = <0 0xff900000 0 0x300000>;
+			interrupts = <GIC_SPI 439 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 824>;
+			power-domains = <&sysc R8A77965_PD_A3IR>;
+			resets = <&cpg 824>;
+		};
+
 		prr: chipid@fff00044 {
 			compatible = "renesas,prr";
 			reg = <0 0xfff00044 0 4>;

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

* [PATCH/RFC 05/06] arm64: dts: renesas: r8a77970: One IMP-X5 device for R-Car V3M
  2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
                   ` (3 preceding siblings ...)
  2019-01-21 12:17 ` [PATCH/RFC 04/06] arm64: dts: renesas: r8a77965: One IMP-X5 device for R-Car M3-N Magnus Damm
@ 2019-01-21 12:17 ` Magnus Damm
  2019-01-21 12:17 ` [PATCH/RFC 06/06] arm64: dts: renesas: r8a77980: One IMP-X5 device for R-Car V3H Magnus Damm
  5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:17 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Add an IMP-X5 device node to the r8a77970 device tree source.

Not for upstream merge.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77970.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)

--- 0001/arch/arm64/boot/dts/renesas/r8a77970.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a77970.dtsi	2019-01-21 19:45:39.037788940 +0900
@@ -1169,6 +1169,15 @@
 			};
 		};
 
+		imp-x5@ff900000 {
+			compatible = "renesas,imp-x5";
+			reg = <0 0xff900000 0 0x300000>;
+			interrupts = <GIC_SPI 281 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 827>;
+			power-domains = <&sysc R8A77970_PD_A3IR>;
+			resets = <&cpg 827>;
+		};
+
 		prr: chipid@fff00044 {
 			compatible = "renesas,prr";
 			reg = <0 0xfff00044 0 4>;

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

* [PATCH/RFC 06/06] arm64: dts: renesas: r8a77980: One IMP-X5 device for R-Car V3H
  2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
                   ` (4 preceding siblings ...)
  2019-01-21 12:17 ` [PATCH/RFC 05/06] arm64: dts: renesas: r8a77970: One IMP-X5 device for R-Car V3M Magnus Damm
@ 2019-01-21 12:17 ` Magnus Damm
  5 siblings, 0 replies; 7+ messages in thread
From: Magnus Damm @ 2019-01-21 12:17 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm

From: Magnus Damm <damm+renesas@opensource.se>

Add an IMP-X5 device node to the r8a77980 device tree source.

Not for upstream merge.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77980.dtsi |    9 +++++++++
 1 file changed, 9 insertions(+)

--- 0001/arch/arm64/boot/dts/renesas/r8a77980.dtsi
+++ work/arch/arm64/boot/dts/renesas/r8a77980.dtsi	2019-01-21 19:48:14.223925104 +0900
@@ -1529,6 +1529,15 @@
 			};
 		};
 
+		imp-x5@ff900000 {
+			compatible = "renesas,imp-x5";
+			reg = <0 0xff900000 0 0x300000>;
+			interrupts = <GIC_SPI 281 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 827>;
+			power-domains = <&sysc R8A77980_PD_A3IR>;
+			resets = <&cpg 827>;
+		};
+		
 		prr: chipid@fff00044 {
 			compatible = "renesas,prr";
 			reg = <0 0xfff00044 0 4>;

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

end of thread, other threads:[~2019-01-21 12:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 12:16 [PATCH/RFC 00/06] R-Car Gen3 IMP-X5 prototype code Magnus Damm
2019-01-21 12:16 ` [PATCH/RFC 01/06] Prototype code for IMP-X5 Magnus Damm
2019-01-21 12:17 ` [PATCH/RFC 02/06] arm64: dts: renesas: r8a7795: One IMP-X5 device for R-Car H3 Magnus Damm
2019-01-21 12:17 ` [PATCH/RFC 03/06] arm64: dts: renesas: r8a7796: One IMP-X5 device for R-Car M3-W Magnus Damm
2019-01-21 12:17 ` [PATCH/RFC 04/06] arm64: dts: renesas: r8a77965: One IMP-X5 device for R-Car M3-N Magnus Damm
2019-01-21 12:17 ` [PATCH/RFC 05/06] arm64: dts: renesas: r8a77970: One IMP-X5 device for R-Car V3M Magnus Damm
2019-01-21 12:17 ` [PATCH/RFC 06/06] arm64: dts: renesas: r8a77980: One IMP-X5 device for R-Car V3H Magnus Damm

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