diff mbox

[RESEND,1/3] arm64: add THUNDER2 processor family

Message ID 1486233461-2679-2-git-send-email-jnair@caviumnetworks.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jayachandran C Feb. 4, 2017, 6:37 p.m. UTC
Add support for ThunderX2 CN99XX arm64 server processors.

Introduce a new arm64 platform config option ARCH_THUNDER2 for these
processors. Add device tree files boot/dts/cavium/thunder-99xx.dtsi for
on-chip devices and boot/dts/cavium/thunder-99xx.dts for the evaluation
board.

Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
---
 arch/arm64/Kconfig.platforms                 |   7 ++
 arch/arm64/boot/dts/cavium/Makefile          |   1 +
 arch/arm64/boot/dts/cavium/thunder-99xx.dts  |  34 +++++++
 arch/arm64/boot/dts/cavium/thunder-99xx.dtsi | 147 +++++++++++++++++++++++++++
 4 files changed, 189 insertions(+)
 create mode 100644 arch/arm64/boot/dts/cavium/thunder-99xx.dts
 create mode 100644 arch/arm64/boot/dts/cavium/thunder-99xx.dtsi

Comments

Will Deacon Feb. 6, 2017, 10:06 a.m. UTC | #1
On Sat, Feb 04, 2017 at 06:37:39PM +0000, Jayachandran C wrote:
> Add support for ThunderX2 CN99XX arm64 server processors.
> 
> Introduce a new arm64 platform config option ARCH_THUNDER2 for these
> processors. Add device tree files boot/dts/cavium/thunder-99xx.dtsi for
> on-chip devices and boot/dts/cavium/thunder-99xx.dts for the evaluation
> board.
> 
> Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
> ---
>  arch/arm64/Kconfig.platforms                 |   7 ++
>  arch/arm64/boot/dts/cavium/Makefile          |   1 +
>  arch/arm64/boot/dts/cavium/thunder-99xx.dts  |  34 +++++++
>  arch/arm64/boot/dts/cavium/thunder-99xx.dtsi | 147 +++++++++++++++++++++++++++

This is basically identical to vulcan.dtsi. Do we really need both in the
tree?

Will
Arnd Bergmann Feb. 6, 2017, 1:44 p.m. UTC | #2
On Mon, Feb 6, 2017 at 11:06 AM, Will Deacon <will.deacon@arm.com> wrote:
> On Sat, Feb 04, 2017 at 06:37:39PM +0000, Jayachandran C wrote:
>> Add support for ThunderX2 CN99XX arm64 server processors.
>>
>> Introduce a new arm64 platform config option ARCH_THUNDER2 for these
>> processors. Add device tree files boot/dts/cavium/thunder-99xx.dtsi for
>> on-chip devices and boot/dts/cavium/thunder-99xx.dts for the evaluation
>> board.
>>
>> Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
>> ---
>>  arch/arm64/Kconfig.platforms                 |   7 ++
>>  arch/arm64/boot/dts/cavium/Makefile          |   1 +
>>  arch/arm64/boot/dts/cavium/thunder-99xx.dts  |  34 +++++++
>>  arch/arm64/boot/dts/cavium/thunder-99xx.dtsi | 147 +++++++++++++++++++++++++++
>
> This is basically identical to vulcan.dtsi. Do we really need both in the
> tree?

Hmm, an alternative would be to add the new .dtsi file and start out with an
#include of the existing file, with overrides for anything that needs changing.
Similarly, the Kconfig symbol could just 'select ARCH_VULCAN' for now.

     Arnd
Jayachandran C Feb. 6, 2017, 3:21 p.m. UTC | #3
On Mon, Feb 06, 2017 at 02:44:13PM +0100, Arnd Bergmann wrote:
> On Mon, Feb 6, 2017 at 11:06 AM, Will Deacon <will.deacon@arm.com> wrote:
> > On Sat, Feb 04, 2017 at 06:37:39PM +0000, Jayachandran C wrote:
> >> Add support for ThunderX2 CN99XX arm64 server processors.
> >>
> >> Introduce a new arm64 platform config option ARCH_THUNDER2 for these
> >> processors. Add device tree files boot/dts/cavium/thunder-99xx.dtsi for
> >> on-chip devices and boot/dts/cavium/thunder-99xx.dts for the evaluation
> >> board.
> >>
> >> Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
> >> ---
> >>  arch/arm64/Kconfig.platforms                 |   7 ++
> >>  arch/arm64/boot/dts/cavium/Makefile          |   1 +
> >>  arch/arm64/boot/dts/cavium/thunder-99xx.dts  |  34 +++++++
> >>  arch/arm64/boot/dts/cavium/thunder-99xx.dtsi | 147 +++++++++++++++++++++++++++
> >
> > This is basically identical to vulcan.dtsi. Do we really need both in the
> > tree?

The Vulcan architecture has been discontinued by Broadcom, so the platform
and device tree files should go away soon. Renames are going to be messy, it
will be better to keep Vulcan around until the transition is complete, and
then delete it.

> Hmm, an alternative would be to add the new .dtsi file and start out with an
> #include of the existing file, with overrides for anything that needs changing.
> Similarly, the Kconfig symbol could just 'select ARCH_VULCAN' for now.

Even in this case, we will need to copy the files from boot/dts/broadcom to
boot/dts/cavium along the way. The current patchset is (in my opinion) the
least messy way to accomplish the transition. But it is the maintainer's call,
so if you think it has to be done differently, I can update the patchset and
post again.

Thanks,
JC.
Arnd Bergmann Feb. 6, 2017, 3:38 p.m. UTC | #4
On Mon, Feb 6, 2017 at 4:21 PM, Jayachandran C <jnair@caviumnetworks.com> wrote:
> On Mon, Feb 06, 2017 at 02:44:13PM +0100, Arnd Bergmann wrote:
>> On Mon, Feb 6, 2017 at 11:06 AM, Will Deacon <will.deacon@arm.com> wrote:
>
> The Vulcan architecture has been discontinued by Broadcom, so the platform
> and device tree files should go away soon. Renames are going to be messy, it
> will be better to keep Vulcan around until the transition is complete, and
> then delete it.

What are the disadvantages of a rename in your opinion? Are you mainly
worried about merge conflicts or something else?

>> Hmm, an alternative would be to add the new .dtsi file and start out with an
>> #include of the existing file, with overrides for anything that needs changing.
>> Similarly, the Kconfig symbol could just 'select ARCH_VULCAN' for now.
>
> Even in this case, we will need to copy the files from boot/dts/broadcom to
> boot/dts/cavium along the way. The current patchset is (in my opinion) the
> least messy way to accomplish the transition. But it is the maintainer's call,
> so if you think it has to be done differently, I can update the patchset and
> post again.

I don't see the need to copy if we can do an #include and later move the
file into the new place. I also see only three references to ARCH_VULCAN
at all aside from the dts file.

arch/arm64/configs/defconfig:CONFIG_ARCH_VULCAN=y
drivers/gpio/Kconfig:   depends on OF_GPIO && (CPU_XLP || ARCH_VULCAN
|| COMPILE_TEST)
drivers/i2c/busses/Kconfig:     depends on CPU_XLP || ARCH_VULCAN ||
COMPILE_TEST
drivers/spi/Kconfig:    depends on CPU_XLP || ARCH_VULCAN || COMPILE_TEST

We can probably manage to have a single patch to rename them all at
the same time, or we do the add+remove over two merge windows.

I also noticed now that you dropped the vulcan "compatible" strings in
the .dtsi files, I think we should keep those as a fallback, and to avoid
having interdependencies with the driver updates, e.g. the top-level
compatible string should be

compatible = "cavium,thunder-9900", "brcm,vulcan-soc";

for the SoC, plus of course the board specific identifier in front of that.
Same for the CPU, the i2c, gpio, and pmu.

    Arnd
Jayachandran C Feb. 7, 2017, 9:41 a.m. UTC | #5
On Mon, Feb 06, 2017 at 04:38:24PM +0100, Arnd Bergmann wrote:
> On Mon, Feb 6, 2017 at 4:21 PM, Jayachandran C <jnair@caviumnetworks.com> wrote:
> > On Mon, Feb 06, 2017 at 02:44:13PM +0100, Arnd Bergmann wrote:
> >> On Mon, Feb 6, 2017 at 11:06 AM, Will Deacon <will.deacon@arm.com> wrote:
> >
> > The Vulcan architecture has been discontinued by Broadcom, so the platform
> > and device tree files should go away soon. Renames are going to be messy, it
> > will be better to keep Vulcan around until the transition is complete, and
> > then delete it.
> 
> What are the disadvantages of a rename in your opinion? Are you mainly
> worried about merge conflicts or something else?

Ok, we are talking about 2 renames,
1. ARCH_VULCAN -> ARCH_THUNDER2,  please see below, but I think there is
board agreement on steps:
  - add ARCH_THUNDER2 in a patchset in a dev cycle
  - when it is mainline, replace ARCH_VULCAN with ARCH_THUNDER2 in the
    next cycle for drivers

2.  boot/dts/broadcom/vulcan* -> boot/dts/cavium/thunder-99* 
If I understand correctly, the main sticking point here is the
duplication of the dtsi file for SoC, instead of just including
vulcan.dtsi in thunder-99xx board file.

It is not so bad in my view to have the duplication in a kernel version
until vulcan is removed. I think you would prefer something like this:
  - have a patchset in this dev cycle to include vulcan.dtsi in
    thunder-99xx.dts (the 99xx name to match 88xx already there)
  - patchset in an upcoming dev cycle to:
     * remove ARCH_VULCAN
     * move vulcan.dtsi -> thunder-99xx.dtsi, drop vulcan ids which are
       removed.

This seems reasonable to me, I will send out a patch to do this (if you
do not have any further comments)

> >> Hmm, an alternative would be to add the new .dtsi file and start out with an
> >> #include of the existing file, with overrides for anything that needs changing.
> >> Similarly, the Kconfig symbol could just 'select ARCH_VULCAN' for now.
> >
> > Even in this case, we will need to copy the files from boot/dts/broadcom to
> > boot/dts/cavium along the way. The current patchset is (in my opinion) the
> > least messy way to accomplish the transition. But it is the maintainer's call,
> > so if you think it has to be done differently, I can update the patchset and
> > post again.
> 
> I don't see the need to copy if we can do an #include and later move the
> file into the new place. I also see only three references to ARCH_VULCAN
> at all aside from the dts file.
> 
> arch/arm64/configs/defconfig:CONFIG_ARCH_VULCAN=y
> drivers/gpio/Kconfig:   depends on OF_GPIO && (CPU_XLP || ARCH_VULCAN
> || COMPILE_TEST)
> drivers/i2c/busses/Kconfig:     depends on CPU_XLP || ARCH_VULCAN ||
> COMPILE_TEST
> drivers/spi/Kconfig:    depends on CPU_XLP || ARCH_VULCAN || COMPILE_TEST
> 
> We can probably manage to have a single patch to rename them all at
> the same time, or we do the add+remove over two merge windows.

Doing it in a single patch has to be acked by 3 maintainers, and
merged thru the arm-soc tree.

The simpler solution is to change these in 3 different patches, and
then remove ARCH_VULCAN Kconfig entry and defconfig entry when all
the references in the tree is gone.

> I also noticed now that you dropped the vulcan "compatible" strings in
> the .dtsi files, I think we should keep those as a fallback, and to avoid
> having interdependencies with the driver updates, e.g. the top-level
> compatible string should be
> 
> compatible = "cavium,thunder-9900", "brcm,vulcan-soc";
> 
> for the SoC, plus of course the board specific identifier in front of that.
> Same for the CPU, the i2c, gpio, and pmu.

The board, SoC, and cpu compat strings will go away with the platform,
so I did not add them here. With the updated plan above, I think we can
take care of this while deleting vulcan.

There is no plan to change compat properties in drivers, we can add
cavium compat properties when necessary. PMU is a slightly special
case, but we can be compatible with vulcan there too, until things
change.

Thanks,
JC.
diff mbox

Patch

diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index 715ef12..129cc5a 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -190,6 +190,13 @@  config ARCH_THUNDER
 	help
 	  This enables support for Cavium's Thunder Family of SoCs.
 
+config ARCH_THUNDER2
+	bool "Cavium ThunderX2 Server Processors"
+	select GPIOLIB
+	help
+	  This enables support for Cavium's ThunderX2 CN99XX family of
+	  server processors.
+
 config ARCH_UNIPHIER
 	bool "Socionext UniPhier SoC Family"
 	select ARCH_HAS_RESET_CONTROLLER
diff --git a/arch/arm64/boot/dts/cavium/Makefile b/arch/arm64/boot/dts/cavium/Makefile
index e34f89d..557c8be 100644
--- a/arch/arm64/boot/dts/cavium/Makefile
+++ b/arch/arm64/boot/dts/cavium/Makefile
@@ -1,4 +1,5 @@ 
 dtb-$(CONFIG_ARCH_THUNDER) += thunder-88xx.dtb
+dtb-$(CONFIG_ARCH_THUNDER2) += thunder-99xx.dtb
 
 always		:= $(dtb-y)
 subdir-y	:= $(dts-dirs)
diff --git a/arch/arm64/boot/dts/cavium/thunder-99xx.dts b/arch/arm64/boot/dts/cavium/thunder-99xx.dts
new file mode 100644
index 0000000..ed6715a
--- /dev/null
+++ b/arch/arm64/boot/dts/cavium/thunder-99xx.dts
@@ -0,0 +1,34 @@ 
+/*
+ * dts file for Cavium ThunderX2 CN99XX based Evaluation Boards
+ *
+ * Copyright (c) 2017 Cavium Inc.
+ * Copyright (c) 2013-2016 Broadcom
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+#include "thunder-99xx.dtsi"
+
+/ {
+	model = "Cavium ThunderX2 CN99XX";
+	compatible = "cavium,thunder-99xx";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x80000000 0x0 0x80000000>,  /* 2G @ 2G  */
+		      <0x00000008 0x80000000 0x0 0x80000000>;  /* 2G @ 34G */
+	};
+
+	aliases {
+		serial0 = &uart0;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+};
diff --git a/arch/arm64/boot/dts/cavium/thunder-99xx.dtsi b/arch/arm64/boot/dts/cavium/thunder-99xx.dtsi
new file mode 100644
index 0000000..1c07732
--- /dev/null
+++ b/arch/arm64/boot/dts/cavium/thunder-99xx.dtsi
@@ -0,0 +1,147 @@ 
+/*
+ * dtsi file for Cavium ThunderX2 CN99XX processor
+ *
+ * Copyright (c) 2017 Cavium Inc.
+ * Copyright (c) 2013-2016 Broadcom
+ * Author: Zi Shen Lim <zlim@broadcom.com>
+ *
+ * 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.
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	model = "Cavium ThunderX2 CN99xx";
+	compatible = "cavium,thunder-99xx";
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	/* just 4 cpus now, 128 needed in full config */
+	cpus {
+		#address-cells = <0x2>;
+		#size-cells = <0x0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			compatible = "cavium,thunder2", "arm,armv8";
+			reg = <0x0 0x0>;
+			enable-method = "psci";
+		};
+
+		cpu@1 {
+			device_type = "cpu";
+			compatible = "cavium,thunder2", "arm,armv8";
+			reg = <0x0 0x1>;
+			enable-method = "psci";
+		};
+
+		cpu@2 {
+			device_type = "cpu";
+			compatible = "cavium,thunder2", "arm,armv8";
+			reg = <0x0 0x2>;
+			enable-method = "psci";
+		};
+
+		cpu@3 {
+			device_type = "cpu";
+			compatible = "cavium,thunder2", "arm,armv8";
+			reg = <0x0 0x3>;
+			enable-method = "psci";
+		};
+	};
+
+	psci {
+		compatible = "arm,psci-0.2";
+		method = "smc";
+	};
+
+	gic: interrupt-controller@400080000 {
+		compatible = "arm,gic-v3";
+		#interrupt-cells = <3>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+		interrupt-controller;
+		#redistributor-regions = <1>;
+		reg = <0x04 0x00080000 0x0 0x20000>,	/* GICD */
+		      <0x04 0x01000000 0x0 0x1000000>;	/* GICR */
+		interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+
+		gicits: gic-its@40010000 {
+			compatible = "arm,gic-v3-its";
+			msi-controller;
+			reg = <0x04 0x00100000 0x0 0x20000>;	/* GIC ITS */
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_PPI 10 IRQ_TYPE_LEVEL_HIGH>;
+	};
+
+	pmu {
+		compatible = "arm,armv8-pmuv3";
+		interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>; /* PMU overflow */
+	};
+
+	clk125mhz: uart_clk125mhz {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <125000000>;
+		clock-output-names = "clk125mhz";
+	};
+
+	pci {
+		compatible = "pci-host-ecam-generic";
+		device_type = "pci";
+		#interrupt-cells = <1>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+
+		/* ECAM at 0x3000_0000 - 0x4000_0000 */
+		reg = <0x0 0x30000000  0x0 0x10000000>;
+		reg-names = "PCI ECAM";
+
+		/*
+		 * PCI ranges:
+		 *   IO		no supported
+		 *   MEM        0x4000_0000 - 0x6000_0000
+		 *   MEM64 pref 0x40_0000_0000 - 0x60_0000_0000
+		 */
+		ranges =
+		  <0x02000000    0 0x40000000    0 0x40000000    0 0x20000000
+		   0x43000000 0x40 0x00000000 0x40 0x00000000 0x20 0x00000000>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map =
+		      /* addr  pin  ic   icaddr  icintr */
+			<0 0 0  1  &gic   0 0    GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH
+			 0 0 0  2  &gic   0 0    GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH
+			 0 0 0  3  &gic   0 0    GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH
+			 0 0 0  4  &gic   0 0    GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+		msi-parent = <&gicits>;
+		dma-coherent;
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		uart0: serial@402020000 {
+			compatible = "arm,pl011", "arm,primecell";
+			reg = <0x04 0x02020000 0x0 0x1000>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk125mhz>;
+			clock-names = "apb_pclk";
+		};
+	};
+};