diff mbox

[v11,1/8] arm64: renesas: r8a7795: Add Renesas R8A7795 SoC support

Message ID 1444890243-6978-2-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State RFC
Delegated to: Simon Horman
Headers show

Commit Message

Simon Horman Oct. 15, 2015, 6:23 a.m. UTC
From: Gaku Inami <gaku.inami.xw@bp.renesas.com>

Initial version of Renesas R-Car H3 support (V10)

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
TODO:
- Split this patch based on ARM-SoC maintainer preference

Changes since v10:
- None

Changes since v9: (Magnus Damm <damm+renesas@opensource.se>)
- Added clock-output-names for the CPG

Changes since v8: (Magnus Damm <damm+renesas@opensource.se>)
- Renamed xtal node name to drop _clk - thanks Geert!
- Kconfig s/platform/platforms/g - thanks Laurent!
- Added select PINCTRL - thanks Geert
- Removed unused Makefile subdir line - thanks Laurent!

Changes since v7: (Magnus Damm <damm+renesas@opensource.se>)
- Folded together the following patches from v7:
   [PATCH 6/25] arm64: renesas: Add new Renesas R-Car Gen3 SoC Kconfig
   [PATCH 7/25] arm64: renesas: r8a7795: Add Renesas R8A7795 SoC support
   [PATCH 8/25] arm64: renesas: r8a7795: Add initial SoC support
- Updated Kconfig bits
   Changed to CONFIG_ARCH_R8A7795 and CONFIG_RENESAS
   CONFIG_ARCH_SHMOBILE is still set to be able to build various drivers
   CONFIG_ARCH_SHMOBILE_MULTI is gone
   select PM_GENERIC_DOMAINS if PM
- Moved "s3d4_clk" to clock patch from geert
- Replaced CPG clock-output-names with clock-indices
- set #power-domain-cells to 0
---
 Documentation/devicetree/bindings/arm/shmobile.txt |  2 +
 arch/arm64/Kconfig.platforms                       | 17 +++++
 arch/arm64/boot/dts/Makefile                       |  1 +
 arch/arm64/boot/dts/renesas/Makefile               |  2 +
 arch/arm64/boot/dts/renesas/r8a7795.dtsi           | 89 ++++++++++++++++++++++
 include/dt-bindings/clock/r8a7795-clock.h          | 38 +++++++++
 6 files changed, 149 insertions(+)
 create mode 100644 arch/arm64/boot/dts/renesas/Makefile
 create mode 100644 arch/arm64/boot/dts/renesas/r8a7795.dtsi
 create mode 100644 include/dt-bindings/clock/r8a7795-clock.h

Comments

Mark Rutland Oct. 15, 2015, 10:58 a.m. UTC | #1
Hi,

> > +		gic: interrupt-controller@0xf1010000 {
> +			compatible = "arm,gic-400";
> +			#interrupt-cells = <3>;
> +			#address-cells = <0>;
> +			interrupt-controller;
> +			reg = <0x0 0xf1010000 0 0x1000>,
> +			      <0x0 0xf1020000 0 0x2000>;
> +			interrupts = <GIC_PPI 9
> +					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
> +		};

No GICH and GICV?

Which exception level do CPUs boot at?

> +		clock {
> +			#address-cells = <2>;
> +			#size-cells = <2>;
> +			#clock-cells = <1>;
> +			ranges;
> +
> +			cpg_clocks: cpg_clocks@e6150000 {
> +				compatible = "renesas,r8a7795-cpg-clocks",
> +					     "renesas,rcar-gen3-cpg-clocks";
> +				reg = <0 0xe6150000 0 0x1000>;
> +				clocks = <&extal_clk>;
> +				clock-indices = <
> +					R8A7795_CLK_MAIN R8A7795_CLK_PLL0
> +					R8A7795_CLK_PLL1 R8A7795_CLK_PLL2
> +					R8A7795_CLK_PLL3 R8A7795_CLK_PLL4
> +				>;
> +				clock-output-names = "main", "pll0", "pll1",
> +						     "pll2", "pll3", "pll4";
> +				#power-domain-cells = <0>;
> +			};
> +		};

This clock node makes no sense. It's not compatible with anything and
doesn't provide clocks itself, so #clock-cells is meaningless, and
nothing underneath it is guaranteed to be probed.

Please get rid of the clock node. It is a cargo-culted piece of magic
that shouldn't exist.

Also, cpg_clocks node is missing #clock-cells, given it has
clock-output-names I assume it is itself a clock provider, and
presumably should have #clock-cells = <1>.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Oct. 21, 2015, 1:34 p.m. UTC | #2
Hi Mark,

On Thu, Oct 15, 2015 at 12:58 PM, Mark Rutland <mark.rutland@arm.com> wrote:
>> > +           gic: interrupt-controller@0xf1010000 {
>> +                     compatible = "arm,gic-400";
>> +                     #interrupt-cells = <3>;
>> +                     #address-cells = <0>;
>> +                     interrupt-controller;
>> +                     reg = <0x0 0xf1010000 0 0x1000>,
>> +                           <0x0 0xf1020000 0 0x2000>;
>> +                     interrupts = <GIC_PPI 9
>> +                                     (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
>> +             };
>
> No GICH and GICV?

These seem to be defined in the "arm,gic-v3" DT bindings only, while this is
an "arm,gic-400" (GICD_IIDR 0x0200043b)?

I did notice hi6220.dtsi does have GICH and GICV, while it also claims
to be an "arm,gic-400"...

> Which exception level do CPUs boot at?

No idea.

>> +             clock {
>> +                     #address-cells = <2>;
>> +                     #size-cells = <2>;
>> +                     #clock-cells = <1>;
>> +                     ranges;
>> +
>> +                     cpg_clocks: cpg_clocks@e6150000 {
>> +                             compatible = "renesas,r8a7795-cpg-clocks",
>> +                                          "renesas,rcar-gen3-cpg-clocks";
>> +                             reg = <0 0xe6150000 0 0x1000>;
>> +                             clocks = <&extal_clk>;
>> +                             clock-indices = <
>> +                                     R8A7795_CLK_MAIN R8A7795_CLK_PLL0
>> +                                     R8A7795_CLK_PLL1 R8A7795_CLK_PLL2
>> +                                     R8A7795_CLK_PLL3 R8A7795_CLK_PLL4
>> +                             >;
>> +                             clock-output-names = "main", "pll0", "pll1",
>> +                                                  "pll2", "pll3", "pll4";
>> +                             #power-domain-cells = <0>;
>> +                     };
>> +             };
>
> This clock node makes no sense. It's not compatible with anything and
> doesn't provide clocks itself, so #clock-cells is meaningless, and
> nothing underneath it is guaranteed to be probed.
>
> Please get rid of the clock node. It is a cargo-culted piece of magic
> that shouldn't exist.

The "clock" node is planned to be removed.

> Also, cpg_clocks node is missing #clock-cells, given it has
> clock-output-names I assume it is itself a clock provider, and
> presumably should have #clock-cells = <1>.

Indeed.

Note that the final CPG node will be the one from "[PATCH/RFC v4 0/5] clk:
shmobile: Add new Renesas CPG/MSSR DT bindings", cfr. the example in
https://patchwork.ozlabs.org/patch/531300/.

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
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Rutland Nov. 3, 2015, 2:28 p.m. UTC | #3
On Wed, Oct 21, 2015 at 03:34:39PM +0200, Geert Uytterhoeven wrote:
> Hi Mark,
> 
> On Thu, Oct 15, 2015 at 12:58 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> >> > +           gic: interrupt-controller@0xf1010000 {
> >> +                     compatible = "arm,gic-400";
> >> +                     #interrupt-cells = <3>;
> >> +                     #address-cells = <0>;
> >> +                     interrupt-controller;
> >> +                     reg = <0x0 0xf1010000 0 0x1000>,
> >> +                           <0x0 0xf1020000 0 0x2000>;
> >> +                     interrupts = <GIC_PPI 9
> >> +                                     (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
> >> +             };
> >
> > No GICH and GICV?
> 
> These seem to be defined in the "arm,gic-v3" DT bindings only, while this is
> an "arm,gic-400" (GICD_IIDR 0x0200043b)?

See the "GIC virtualization extensions (VGIC)" section in
Documentation/devicetree/bindings/arm/gic.txt

> I did notice hi6220.dtsi does have GICH and GICV, while it also claims
> to be an "arm,gic-400"...

That's fine, that's valid for any GICv2 with virtualization extensions.

> > Which exception level do CPUs boot at?
> 
> No idea.

For reference, the kernel should print it out just after booting all CPUs. e.g.
on Juno:

SMP: Total of 6 processors activated.
CPU: All CPU(s) started at EL2

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Nov. 3, 2015, 2:43 p.m. UTC | #4
Hi Mark,

On Tue, Nov 3, 2015 at 3:28 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Wed, Oct 21, 2015 at 03:34:39PM +0200, Geert Uytterhoeven wrote:
>> On Thu, Oct 15, 2015 at 12:58 PM, Mark Rutland <mark.rutland@arm.com> wrote:
>> >> > +           gic: interrupt-controller@0xf1010000 {
>> >> +                     compatible = "arm,gic-400";
>> >> +                     #interrupt-cells = <3>;
>> >> +                     #address-cells = <0>;
>> >> +                     interrupt-controller;
>> >> +                     reg = <0x0 0xf1010000 0 0x1000>,
>> >> +                           <0x0 0xf1020000 0 0x2000>;
>> >> +                     interrupts = <GIC_PPI 9
>> >> +                                     (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
>> >> +             };
>> >
>> > No GICH and GICV?
>>
>> These seem to be defined in the "arm,gic-v3" DT bindings only, while this is
>> an "arm,gic-400" (GICD_IIDR 0x0200043b)?
>
> See the "GIC virtualization extensions (VGIC)" section in
> Documentation/devicetree/bindings/arm/gic.txt
>
>> I did notice hi6220.dtsi does have GICH and GICV, while it also claims
>> to be an "arm,gic-400"...
>
> That's fine, that's valid for any GICv2 with virtualization extensions.

All I can find in the docs are the two register blocks we have in the dtsi.

>> > Which exception level do CPUs boot at?
>>
>> No idea.
>
> For reference, the kernel should print it out just after booting all CPUs. e.g.
> on Juno:
>
> SMP: Total of 6 processors activated.
> CPU: All CPU(s) started at EL2

Thanks!

CPU: All CPU(s) started at EL1

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
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Dec. 9, 2015, 8:23 a.m. UTC | #5
Hi Mark,

On Tue, Nov 3, 2015 at 3:28 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Wed, Oct 21, 2015 at 03:34:39PM +0200, Geert Uytterhoeven wrote:
>> On Thu, Oct 15, 2015 at 12:58 PM, Mark Rutland <mark.rutland@arm.com> wrote:
>> >> > +           gic: interrupt-controller@0xf1010000 {
>> >> +                     compatible = "arm,gic-400";
>> >> +                     #interrupt-cells = <3>;
>> >> +                     #address-cells = <0>;
>> >> +                     interrupt-controller;
>> >> +                     reg = <0x0 0xf1010000 0 0x1000>,
>> >> +                           <0x0 0xf1020000 0 0x2000>;
>> >> +                     interrupts = <GIC_PPI 9
>> >> +                                     (GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
>> >> +             };
>> >
>> > No GICH and GICV?
>>
>> These seem to be defined in the "arm,gic-v3" DT bindings only, while this is
>> an "arm,gic-400" (GICD_IIDR 0x0200043b)?
>
> See the "GIC virtualization extensions (VGIC)" section in
> Documentation/devicetree/bindings/arm/gic.txt

DDI0471B_gic400_r0p1_trm.pdf says:

    Address range GIC-400 functional block
    A. 0x0000 - 0x0FFF Reserved
    B. 0x1000 - 0x1FFF Distributor
    C. 0x2000 - 0x3FFF CPU interfaces
    D. 0x4000 - 0x4FFF Virtual interface control block, for the processor that
                       is performing the access
    E. 0x5000 - 0x5FFF Virtual interface control block, for the processor
                       selected by address bits [11:9]
    F. 0x6000 - 0x7FFF Virtual CPU interfaces

The DT binding document says:
  1. The  first region is the GIC distributor register base and size.
  2. The 2nd region is the GIC cpu interface register base and size.
  3. The first additional region is the GIC virtual interface control register
     base and size.
  4. The 2nd additional region is the GIC virtual cpu interface register base
     and size.

Matching with the example:

        interrupt-controller@2c001000 {
                compatible = "arm,cortex-a15-gic";
                #interrupt-cells = <3>;
                interrupt-controller;
                reg = <0x2c001000 0x1000>,
                      <0x2c002000 0x1000>,
                      <0x2c004000 0x2000>,
                      <0x2c006000 0x2000>;
                interrupts = <1 9 0xf04>;
        };

This means:
  - reg entry 1. covers address range B,
  - reg entry 2. covers address range C,
  - reg entry 3. covers address ranges D _and_ E,
  - reg entry 4. covers address range F.

On R-Car Gen3, the base addresses are:

    Distributor             : 0xF101_0000
    CPU interfaces          : 0xF102_0000
    Virtual interfaces      : 0xF104_0000
    Virtual interfaces      : 0xF105_0000
    Virtual CPU interfaces  : 0xF106_0000

Note the additional multiplication factor of 16 in the offsets relative to
the base address 0xf1000000 (e.g. 0x50000 instead of 0x5000).

As address ranges D and E are merged in a single reg entry, how is the GIC
driver supposed to know about this multiplication factor?

Thanks!

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
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt b/Documentation/devicetree/bindings/arm/shmobile.txt
index c4f19b2e7dd9..8d696a0d62b3 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -27,6 +27,8 @@  SoCs:
     compatible = "renesas,r8a7793"
   - R-Car E2 (R8A77940)
     compatible = "renesas,r8a7794"
+  - R-Car H3 (R8A77950)
+    compatible = "renesas,r8a7795"
 
 
 Boards:
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 23800a19a7bc..04bf6de3b01a 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -66,6 +66,23 @@  config ARCH_SEATTLE
 	help
 	  This enables support for AMD Seattle SOC Family
 
+config ARCH_SHMOBILE
+	bool
+
+config ARCH_RENESAS
+	bool "Renesas SoC Platforms"
+	select ARCH_SHMOBILE
+	select PINCTRL
+	select PM_GENERIC_DOMAINS if PM
+	help
+	  This enables support for the ARMv8 based Renesas SoCs.
+
+config ARCH_R8A7795
+	bool "Renesas R-Car H3 SoC Platform"
+	depends on ARCH_RENESAS
+	help
+	  This enables support for the Renesas R-Car H3 SoC.
+
 config ARCH_TEGRA
 	bool "NVIDIA Tegra SoC Family"
 	select ARCH_HAS_RESET_CONTROLLER
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index d9f88330e7b0..54e401119639 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -9,6 +9,7 @@  dts-dirs += hisilicon
 dts-dirs += marvell
 dts-dirs += mediatek
 dts-dirs += qcom
+dts-dirs += renesas
 dts-dirs += rockchip
 dts-dirs += sprd
 dts-dirs += xilinx
diff --git a/arch/arm64/boot/dts/renesas/Makefile b/arch/arm64/boot/dts/renesas/Makefile
new file mode 100644
index 000000000000..fec69f46d65b
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/Makefile
@@ -0,0 +1,2 @@ 
+always		:= $(dtb-y)
+clean-files	:= *.dtb
diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
new file mode 100644
index 000000000000..ff6e0e98664a
--- /dev/null
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -0,0 +1,89 @@ 
+/*
+ * Device Tree Source for the r8a7795 SoC
+ *
+ * Copyright (C) 2015 Renesas Electronics Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <dt-bindings/clock/r8a7795-clock.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "renesas,r8a7795";
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		/* 1core only at this point */
+		a57_0: cpu@0 {
+			compatible = "arm,cortex-a57", "arm,armv8";
+			reg = <0x0>;
+			device_type = "cpu";
+		};
+	};
+
+	extal_clk: extal {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <0>;
+	};
+
+	soc {
+		compatible = "simple-bus";
+		interrupt-parent = <&gic>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		gic: interrupt-controller@0xf1010000 {
+			compatible = "arm,gic-400";
+			#interrupt-cells = <3>;
+			#address-cells = <0>;
+			interrupt-controller;
+			reg = <0x0 0xf1010000 0 0x1000>,
+			      <0x0 0xf1020000 0 0x2000>;
+			interrupts = <GIC_PPI 9
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_HIGH)>;
+		};
+
+		timer {
+			compatible = "arm,armv8-timer";
+			interrupts = <GIC_PPI 13
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				     <GIC_PPI 14
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				     <GIC_PPI 11
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>,
+				     <GIC_PPI 10
+					(GIC_CPU_MASK_SIMPLE(1) | IRQ_TYPE_LEVEL_LOW)>;
+		};
+
+		clock {
+			#address-cells = <2>;
+			#size-cells = <2>;
+			#clock-cells = <1>;
+			ranges;
+
+			cpg_clocks: cpg_clocks@e6150000 {
+				compatible = "renesas,r8a7795-cpg-clocks",
+					     "renesas,rcar-gen3-cpg-clocks";
+				reg = <0 0xe6150000 0 0x1000>;
+				clocks = <&extal_clk>;
+				clock-indices = <
+					R8A7795_CLK_MAIN R8A7795_CLK_PLL0
+					R8A7795_CLK_PLL1 R8A7795_CLK_PLL2
+					R8A7795_CLK_PLL3 R8A7795_CLK_PLL4
+				>;
+				clock-output-names = "main", "pll0", "pll1",
+						     "pll2", "pll3", "pll4";
+				#power-domain-cells = <0>;
+			};
+		};
+	};
+};
diff --git a/include/dt-bindings/clock/r8a7795-clock.h b/include/dt-bindings/clock/r8a7795-clock.h
new file mode 100644
index 000000000000..334fa13d1bb4
--- /dev/null
+++ b/include/dt-bindings/clock/r8a7795-clock.h
@@ -0,0 +1,38 @@ 
+/*
+ * Copyright (C) 2015 Renesas Electronics Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef __DT_BINDINGS_CLOCK_R8A7795_H__
+#define __DT_BINDINGS_CLOCK_R8A7795_H__
+
+/* CPG */
+#define R8A7795_CLK_MAIN		0
+#define R8A7795_CLK_PLL0		1
+#define R8A7795_CLK_PLL1		2
+#define R8A7795_CLK_PLL2		3
+#define R8A7795_CLK_PLL3		4
+#define R8A7795_CLK_PLL4		5
+
+/* MSTP0 */
+
+/* MSTP1 */
+
+/* MSTP2 */
+
+/* MSTP3 */
+
+/* MSTP5 */
+
+/* MSTP7 */
+
+/* MSTP8 */
+
+/* MSTP9 */
+
+/* MSTP10 */
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7795_H__ */