Skip to contentSkip to conversation

ARM: mv78x00: First step to convert mv78x00 to Device Tree

RFC PATCH New Gregory CLEMENT 4 participants 15 messages May 19, 2013 – May 20, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover ARM: mv78x00: First step to convert mv78x00 to Device Tree

Hello,

This patch set is a first step in order to convert mach-mv78x00 to device tree before it joins mach-mvebu.

I managed to test it on the RD-78X00-mASA board. All the peripherals I have tested work as they work before the migration to the device tree:
- UART
- Ethernet
- USB
- SATA

My main concern is that the mv78x00 are MP but not SMP capable. Currently the same kernel run on the 2 cores and it is in the board file that the peripherals are assigned for each CPU. (Actually I didn't test this behavior, but the code is written in this way.)

I don't know how to assign a peripheral to a given CPU with the device tree. The only way I have in mind is to have a dts per CPU, but I am not sure it is very convenient.

So for now the code assigns all the peripherals to the CPU.

I am also concerned by the 2 other boards: the Marvell DB-78x00-BP Development Board and the Buffalo WLX (Terastation Duo) NAS. I don't have them and so I can't test them if I want to convert them to device tree too.

Comments and ideas are welcome

Thanks,

Gregory CLEMENT (5):
ARM: mv78x00: Add generic support for the Device Tree boards
ARM: mv78x00: Convert RD-78X00-mASA board to device tree
ARM: mv78x00: Add infrastructure to support boards converted to DT
ARM: mv78x00: Add the Device Tree support for MV78X00 family
ARM: mv78x00: Add Device Tree support for the RD-78X00-mASA board

 arch/arm/boot/dts/Makefile                 |   1 +
 arch/arm/boot/dts/mv78x00-masa-db.dts      |  61 ++++++++++++++
 arch/arm/boot/dts/mv78x00.dtsi             | 126 +++++++++++++++++++++++++++++
 arch/arm/mach-mv78xx0/Kconfig              |   7 ++
 arch/arm/mach-mv78xx0/Makefile             |   1 +
 arch/arm/mach-mv78xx0/board-dt.c           |  49 +++++++++++
 arch/arm/mach-mv78xx0/common.h             |   7 ++
 arch/arm/mach-mv78xx0/rd78x00-masa-setup.c |  10 +++
 8 files changed, 262 insertions(+)
 create mode 100644 arch/arm/boot/dts/mv78x00-masa-db.dts
 create mode 100644 arch/arm/boot/dts/mv78x00.dtsi
 create mode 100644 arch/arm/mach-mv78xx0/board-dt.c
Signature · 1 line
1.8.1.2
#1 lore raw

RFC PATCH 1/5 ARM: mv78x00: Add generic support for the Device Tree boards

This commit add the generic support for the MV78X00 based boards converted to the device tree.

---
 arch/arm/mach-mv78xx0/board-dt.c | 46 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 arch/arm/mach-mv78xx0/board-dt.c
arch/arm/mach-mv78xx0/board-dt.c new file +46 -0
new file mode 100644
index 0000000..4995fee
@@ -0,0 +1,46 @@
+/*
+ * arch/arm/mach-mv78xx0/board-dt.c
+ *
+ * Flattened Device Tree board initialization
+ *
+ * Copyright (C) 2013  Gregory CLEMENT <[email protected]>
+ *
+ * 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 <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <mach/mv78xx0.h>
+#include <plat/irq.h>
+#include <asm/mach/arch.h>
+#include "common.h"
+
+static void __init mv78x00_dt_init(void)
+{
+	/*
+	 * Basic MV78xx0 setup. Needs to be called early.
+	 */
+	mv78xx0_init();
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+}
+
+static const char *mv78x00_dt_compat[] = {
+	"marvell,mv78x00",
+	NULL,
+};
+
+DT_MACHINE_START(MV78X00_DT, "Marvell MV78x00 (Flattened Device Tree)")
+	/* Maintainer: Gregory CLEMENT <[email protected]> */
+	.init_machine	= mv78x00_dt_init,
+	.map_io		= mv78xx0_map_io,
+	.init_early	= mv78xx0_init_early,
+	.init_irq	= orion_dt_init_irq,
+	.init_time	= mv78xx0_timer_init,
+	.restart	= mv78xx0_restart,
+	.dt_compat	= mv78x00_dt_compat,
+MACHINE_END
Signature · 1 line
1.8.1.2
#2 lore raw

RFC PATCH 2/5 ARM: mv78x00: Convert RD-78X00-mASA board to device tree

In reply to Gregory CLEMENT

This commit converts the 'RD-78X00-mASA' board to the Device Tree. Most of the devices are converted to the Device Tree, the only devices which have not their Device Tree bindings are the Gigabit Ethernet ones and remain instantiated in the old way.

---
 arch/arm/mach-mv78xx0/board-dt.c           |  3 +++
 arch/arm/mach-mv78xx0/common.h             |  7 +++++++
 arch/arm/mach-mv78xx0/rd78x00-masa-setup.c | 10 ++++++++++
 3 files changed, 20 insertions(+)
arch/arm/mach-mv78xx0/board-dt.c +3 -0
index 4995fee..5111cbd 100644
@@ -26,6 +26,9 @@ static void __init mv78x00_dt_init(void)
 	 */
 	mv78xx0_init();
 
+	if (of_machine_is_compatible("marvell,rd-78x00-masa"))
+		rd78x00_masa_init_dt();
+
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
arch/arm/mach-mv78xx0/common.h +7 -0
index 5e9485b..6e9140d 100644
@@ -17,6 +17,13 @@ struct mv_sata_platform_data;
 /*
  * Basic MV78xx0 init functions used early by machine-setup.
  */
+#ifdef CONFIG_MACH_RD78X00_MASA
+void rd78x00_masa_init_dt(void);
+#else
+static inline void rd78x00_masa_init_dt(void) {};
+#endif
+
+
 int mv78xx0_core_index(void);
 void mv78xx0_map_io(void);
 void mv78xx0_init(void);
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +10 -0
index d2d06f3..8d88657 100644
@@ -64,6 +64,16 @@ static void __init rd78x00_masa_init(void)
 	}
 }
 
+void __init rd78x00_masa_init_dt(void)
+{
+	/* Internal devices not ported to DT yet */
+	mv78xx0_ge00_init(&rd78x00_masa_ge00_data);
+	mv78xx0_ge10_init(&rd78x00_masa_ge10_data);
+		mv78xx0_ge01_init(&rd78x00_masa_ge01_data);
+		mv78xx0_ge11_init(&rd78x00_masa_ge11_data);
+
+}
+
 static int __init rd78x00_pci_init(void)
 {
 	/*
Signature · 1 line
1.8.1.2
maintainer
#3 lore raw

RFC PATCH 2/5 ARM: mv78x00: Convert RD-78X00-mASA board to device tree

Quoted 51 lines · Gregory CLEMENT

This commit converts the 'RD-78X00-mASA' board to the Device Tree. Most of the devices are converted to the Device Tree, the only devices which have not their Device Tree bindings are the Gigabit Ethernet ones and remain instantiated in the old way.

---
 arch/arm/mach-mv78xx0/board-dt.c           |  3 +++
 arch/arm/mach-mv78xx0/common.h             |  7 +++++++
 arch/arm/mach-mv78xx0/rd78x00-masa-setup.c | 10 ++++++++++
 3 files changed, 20 insertions(+)
arch/arm/mach-mv78xx0/board-dt.c +3 -0
index 4995fee..5111cbd 100644
@@ -26,6 +26,9 @@ static void __init mv78x00_dt_init(void)
 	 */
 	mv78xx0_init();
 
+	if (of_machine_is_compatible("marvell,rd-78x00-masa"))
+		rd78x00_masa_init_dt();
+
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
arch/arm/mach-mv78xx0/common.h +7 -0
index 5e9485b..6e9140d 100644
@@ -17,6 +17,13 @@ struct mv_sata_platform_data;
 /*
  * Basic MV78xx0 init functions used early by machine-setup.
  */
+#ifdef CONFIG_MACH_RD78X00_MASA
+void rd78x00_masa_init_dt(void);
+#else
+static inline void rd78x00_masa_init_dt(void) {};
+#endif
+
+
 int mv78xx0_core_index(void);
 void mv78xx0_map_io(void);
 void mv78xx0_init(void);
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +0 -0
index d2d06f3..8d88657 100644
@@ -64,6 +64,16 @@ static void __init rd78x00_masa_init(void)
 	}
 }

arch/arm/mach-mv78xx0/rd78x00-masa-setup.c static void __init rd78x00_masa_init(void) · line 75

Quoted 10 lines
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +9 -0
 
+void __init rd78x00_masa_init_dt(void)
+{
+	/* Internal devices not ported to DT yet */
+	mv78xx0_ge00_init(&rd78x00_masa_ge00_data);
+	mv78xx0_ge10_init(&rd78x00_masa_ge10_data);
+		mv78xx0_ge01_init(&rd78x00_masa_ge01_data);
+		mv78xx0_ge11_init(&rd78x00_masa_ge11_data);
+
+}

Hi Gregory

First off, the indentation looks wrong. Might be a space/tab issue.

I would also be tempted to place this code into board-dt.c and not touch or even compile rd78x00-masa-setup.c when using DT. If i remember correctly, Jason had a patch for Kirkwood which centralized all the ethernet setup code. You can maybe copy/paste that.

Quoted 7 lines
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +1 -0
+
 static int __init rd78x00_pci_init(void)
 {
 	/*
Signature · 1 line
1.8.1.2
#4 lore raw

RFC PATCH 2/5 ARM: mv78x00: Convert RD-78X00-mASA board to device tree

Quoted 65 lines · Andrew Lunn
Quoted 51 lines · Gregory CLEMENT

This commit converts the 'RD-78X00-mASA' board to the Device Tree. Most of the devices are converted to the Device Tree, the only devices which have not their Device Tree bindings are the Gigabit Ethernet ones and remain instantiated in the old way.

---
 arch/arm/mach-mv78xx0/board-dt.c           |  3 +++
 arch/arm/mach-mv78xx0/common.h             |  7 +++++++
 arch/arm/mach-mv78xx0/rd78x00-masa-setup.c | 10 ++++++++++
 3 files changed, 20 insertions(+)
arch/arm/mach-mv78xx0/board-dt.c +3 -0
index 4995fee..5111cbd 100644
@@ -26,6 +26,9 @@ static void __init mv78x00_dt_init(void)
 	 */
 	mv78xx0_init();
 
+	if (of_machine_is_compatible("marvell,rd-78x00-masa"))
+		rd78x00_masa_init_dt();
+
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
arch/arm/mach-mv78xx0/common.h +7 -0
index 5e9485b..6e9140d 100644
@@ -17,6 +17,13 @@ struct mv_sata_platform_data;
 /*
  * Basic MV78xx0 init functions used early by machine-setup.
  */
+#ifdef CONFIG_MACH_RD78X00_MASA
+void rd78x00_masa_init_dt(void);
+#else
+static inline void rd78x00_masa_init_dt(void) {};
+#endif
+
+
 int mv78xx0_core_index(void);
 void mv78xx0_map_io(void);
 void mv78xx0_init(void);
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +0 -0
index d2d06f3..8d88657 100644
@@ -64,6 +64,16 @@ static void __init rd78x00_masa_init(void)
 	}
 }

arch/arm/mach-mv78xx0/rd78x00-masa-setup.c static void __init rd78x00_masa_init(void) · line 75

Quoted 10 lines
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +9 -0
 
+void __init rd78x00_masa_init_dt(void)
+{
+	/* Internal devices not ported to DT yet */
+	mv78xx0_ge00_init(&rd78x00_masa_ge00_data);
+	mv78xx0_ge10_init(&rd78x00_masa_ge10_data);
+		mv78xx0_ge01_init(&rd78x00_masa_ge01_data);
+		mv78xx0_ge11_init(&rd78x00_masa_ge11_data);
+
+}

Hi Gregory

Quoted 1 line

First off, the indentation looks wrong. Might be a space/tab issue.

Thanks I will fix it

Quoted 5 lines

I would also be tempted to place this code into board-dt.c and not touch or even compile rd78x00-masa-setup.c when using DT. If i remember correctly, Jason had a patch for Kirkwood which centralized all the ethernet setup code. You can maybe copy/paste that.

OK I will have a look on it.

Quoted 8 lines
Quoted 8 lines
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +1 -0
+
 static int __init rd78x00_pci_init(void)
 {
 	/*
Signature · 1 line
1.8.1.2
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#5 lore raw

RFC PATCH 2/5 ARM: mv78x00: Convert RD-78X00-mASA board to device tree

Quoted 71 lines · Gregory CLEMENT
Quoted 65 lines · Andrew Lunn
Quoted 51 lines · Gregory CLEMENT

This commit converts the 'RD-78X00-mASA' board to the Device Tree. Most of the devices are converted to the Device Tree, the only devices which have not their Device Tree bindings are the Gigabit Ethernet ones and remain instantiated in the old way.

---
 arch/arm/mach-mv78xx0/board-dt.c           |  3 +++
 arch/arm/mach-mv78xx0/common.h             |  7 +++++++
 arch/arm/mach-mv78xx0/rd78x00-masa-setup.c | 10 ++++++++++
 3 files changed, 20 insertions(+)
arch/arm/mach-mv78xx0/board-dt.c +3 -0
index 4995fee..5111cbd 100644
@@ -26,6 +26,9 @@ static void __init mv78x00_dt_init(void)
 	 */
 	mv78xx0_init();
 
+	if (of_machine_is_compatible("marvell,rd-78x00-masa"))
+		rd78x00_masa_init_dt();
+
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
arch/arm/mach-mv78xx0/common.h +7 -0
index 5e9485b..6e9140d 100644
@@ -17,6 +17,13 @@ struct mv_sata_platform_data;
 /*
  * Basic MV78xx0 init functions used early by machine-setup.
  */
+#ifdef CONFIG_MACH_RD78X00_MASA
+void rd78x00_masa_init_dt(void);
+#else
+static inline void rd78x00_masa_init_dt(void) {};
+#endif
+
+
 int mv78xx0_core_index(void);
 void mv78xx0_map_io(void);
 void mv78xx0_init(void);
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +0 -0
index d2d06f3..8d88657 100644
@@ -64,6 +64,16 @@ static void __init rd78x00_masa_init(void)
 	}
 }

arch/arm/mach-mv78xx0/rd78x00-masa-setup.c static void __init rd78x00_masa_init(void) · line 75

Quoted 10 lines
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +9 -0
 
+void __init rd78x00_masa_init_dt(void)
+{
+	/* Internal devices not ported to DT yet */
+	mv78xx0_ge00_init(&rd78x00_masa_ge00_data);
+	mv78xx0_ge10_init(&rd78x00_masa_ge10_data);
+		mv78xx0_ge01_init(&rd78x00_masa_ge01_data);
+		mv78xx0_ge11_init(&rd78x00_masa_ge11_data);
+
+}

Hi Gregory

Quoted 1 line

First off, the indentation looks wrong. Might be a space/tab issue.

Thanks I will fix it

Quoted 1 line
Quoted 6 lines
Quoted 4 lines

I would also be tempted to place this code into board-dt.c and not touch or even compile rd78x00-masa-setup.c when using DT. If i remember correctly, Jason had a patch for Kirkwood which centralized all the ethernet setup code. You can maybe copy/paste that.

OK I will have a look on it.

Initially I wanted to avoid duplicating the platform data, which are the PHY address for the ethernet. But for coherency I will do the same that it have been done in mach-kirkwood.

Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-mv78xx0/rd78x00-masa-setup.c +1 -0
+
 static int __init rd78x00_pci_init(void)
 {
 	/*
Signature · 1 line
1.8.1.2
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

RFC PATCH 3/5 ARM: mv78x00: Add infrastructure to support boards converted to DT

In reply to Gregory CLEMENT

This commit updates the Kconfig and the Makefile to allow to build the boards converted to the Device Tree.

---
 arch/arm/mach-mv78xx0/Kconfig  | 7 +++++++
 arch/arm/mach-mv78xx0/Makefile | 1 +
 2 files changed, 8 insertions(+)
arch/arm/mach-mv78xx0/Kconfig +7 -0
index f2d309d..2390a6e 100644
@@ -20,6 +20,13 @@ config MACH_TERASTATION_WXL
 	  Say 'Y' here if you want your kernel to support the
 	  Buffalo WXL Nas.
 
+config ARCH_MV78X00_DT
+	bool "Marvell MV78X00 Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell MV78X00 using flattened device tree.
+
 endmenu
 
 endif
arch/arm/mach-mv78xx0/Makefile +1 -0
index 7cd0463..8935e48 100644
@@ -2,3 +2,4 @@ obj-y				+= common.o mpp.o irq.o pcie.o
 obj-$(CONFIG_MACH_DB78X00_BP)	+= db78x00-bp-setup.o
 obj-$(CONFIG_MACH_RD78X00_MASA)	+= rd78x00-masa-setup.o
 obj-$(CONFIG_MACH_TERASTATION_WXL) += buffalo-wxl-setup.o
+obj-$(CONFIG_ARCH_MV78X00_DT)	+= board-dt.o
Signature · 1 line
1.8.1.2
#7 lore raw

RFC PATCH 4/5 ARM: mv78x00: Add the Device Tree support for MV78X00 family

In reply to Gregory CLEMENT

This commit adds the Device Tree support for the mv78x00 SoC family. It adds an mv78x00.dtsi description of the mv78x00 SoC

So far, the Device Tree contains the interrupt controller, the GPIO bank, the UART controllers, the USB host controllers, the SATA controllers and the I2C controllers.

---
 arch/arm/boot/dts/mv78x00.dtsi | 126 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 arch/arm/boot/dts/mv78x00.dtsi
arch/arm/boot/dts/mv78x00.dtsi new file +126 -0
new file mode 100644
index 0000000..df496f5
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2013 Gregory CLEMENT <[email protected]>
+ *
+ * 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/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell MV78X00 SoC";
+	compatible = "marvell,mv78x00";
+	interrupt-parent = <&intc>;
+
+	intc: interrupt-controller {
+		compatible = "marvell,orion-intc", "marvell,intc";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0xf1020210 0x04>,
+		      <0xf1020214 0x04>,
+		      <0xf102020c 0x04>;
+	};
+
+	ocp at f1000000 {
+		compatible = "simple-bus";
+		ranges = <0x00000000 0xf1000000 0x4000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		gpio0: gpio at 10100 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0x10100 0x40>;
+			ngpios = <32>;
+			interrupts = <56>, <57>, <58>, <59>;
+		};
+
+		serial at 12000 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <12>;
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+		serial at 12100 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <13>;
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+		serial at 12200 {
+			compatible = "ns16550a";
+			reg = <0x12200 0x100>;
+			reg-shift = <2>;
+			interrupts = <14>;
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+		serial at 12300 {
+			compatible = "ns16550a";
+			reg = <0x12300 0x100>;
+			reg-shift = <2>;
+			interrupts = <15>;
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+
+		sata at a0000 {
+			compatible = "marvell,orion-sata";
+			reg = <0xa0000 0x5000>;
+			interrupts = <26>;
+			status = "disabled";
+		};
+
+		i2c at 10000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x10000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <2>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
+
+		i2c at 11000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x11000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <3>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
+
+		ehci at 50000 {
+			compatible = "marvell,orion-ehci";
+			reg = <0x50000 0x1000>;
+			interrupts = <16>;
+			status = "disabled";
+		};
+
+		ehci at 51000 {
+			compatible = "marvell,orion-ehci";
+			reg = <0x51000 0x1000>;
+			interrupts = <17>;
+			status = "disabled";
+		};
+
+		ehci at 52000 {
+			compatible = "marvell,orion-ehci";
+			reg = <0x52000 0x1000>;
+			interrupts = <18>;
+			status = "disabled";
+		};
+
+	};
+};
Signature · 1 line
1.8.1.2
#8 lore raw

RFC PATCH 4/5 ARM: mv78x00: Add the Device Tree support for MV78X00 family

Quoted 81 lines · Gregory CLEMENT

This commit adds the Device Tree support for the mv78x00 SoC family. It adds an mv78x00.dtsi description of the mv78x00 SoC

So far, the Device Tree contains the interrupt controller, the GPIO bank, the UART controllers, the USB host controllers, the SATA controllers and the I2C controllers.

---
 arch/arm/boot/dts/mv78x00.dtsi | 126 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 arch/arm/boot/dts/mv78x00.dtsi
arch/arm/boot/dts/mv78x00.dtsi new file +62 -0
new file mode 100644
index 0000000..df496f5
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2013 Gregory CLEMENT <[email protected]>
+ *
+ * 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/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell MV78X00 SoC";
+	compatible = "marvell,mv78x00";
+	interrupt-parent = <&intc>;
+
+	intc: interrupt-controller {
+		compatible = "marvell,orion-intc", "marvell,intc";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0xf1020210 0x04>,
+		      <0xf1020214 0x04>,
+		      <0xf102020c 0x04>;
+	};
+
+	ocp at f1000000 {
+		compatible = "simple-bus";
+		ranges = <0x00000000 0xf1000000 0x4000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		gpio0: gpio at 10100 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0x10100 0x40>;
+			ngpios = <32>;
+			interrupts = <56>, <57>, <58>, <59>;
+		};
+
+		serial at 12000 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <12>;
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+		serial at 12100 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <13>;
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+		serial at 12200 {
+			compatible = "ns16550a";
+			reg = <0x12200 0x100>;
+			reg-shift = <2>;
+			interrupts = <14>;

arch/arm/boot/dts/mv78x00.dtsi line 72

Quoted 10 lines
arch/arm/boot/dts/mv78x00.dtsi new file +10 -0
+			/* set clock-frequency in board dts */
+			status = "disabled";
+		};
+
+		serial at 12300 {
+			compatible = "ns16550a";
+			reg = <0x12300 0x100>;
+			reg-shift = <2>;
+			interrupts = <15>;
+			/* set clock-frequency in board dts */

We should probably add a note to these comments that this is only until mv78x00 is converted to the clock infrastructure.

thx,

Jason.

Quoted 57 lines
arch/arm/boot/dts/mv78x00.dtsi new file +54 -0
+			status = "disabled";
+		};
+
+
+		sata at a0000 {
+			compatible = "marvell,orion-sata";
+			reg = <0xa0000 0x5000>;
+			interrupts = <26>;
+			status = "disabled";
+		};
+
+		i2c at 10000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x10000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <2>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
+
+		i2c at 11000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x11000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <3>;
+			clock-frequency = <100000>;
+			status = "disabled";
+		};
+
+		ehci at 50000 {
+			compatible = "marvell,orion-ehci";
+			reg = <0x50000 0x1000>;
+			interrupts = <16>;
+			status = "disabled";
+		};
+
+		ehci at 51000 {
+			compatible = "marvell,orion-ehci";
+			reg = <0x51000 0x1000>;
+			interrupts = <17>;
+			status = "disabled";
+		};
+
+		ehci at 52000 {
+			compatible = "marvell,orion-ehci";
+			reg = <0x52000 0x1000>;
+			interrupts = <18>;
+			status = "disabled";
+		};
+
+	};
+};
Signature · 1 line
1.8.1.2
#9 lore raw

RFC PATCH 4/5 ARM: mv78x00: Add the Device Tree support for MV78X00 family

Quoted 10 lines · Jason Cooper
Quoted 9 lines · Gregory CLEMENT

This commit adds the Device Tree support for the mv78x00 SoC family. It adds an mv78x00.dtsi description of the mv78x00 SoC

So far, the Device Tree contains the interrupt controller, the GPIO bank, the UART controllers, the USB host controllers, the SATA controllers and the I2C controllers.

---

...

Quoted 9 lines

arch/arm/boot/dts/mv78x00.dtsi line 72

Quoted 6 lines
arch/arm/boot/dts/mv78x00.dtsi new file +6 -0
+		serial at 12300 {
+			compatible = "ns16550a";
+			reg =<0x12300 0x100>;
+			reg-shift =<2>;
+			interrupts =<15>;
+			/* set clock-frequency in board dts */

We should probably add a note to these comments that this is only until mv78x00 is converted to the clock infrastructure.

Or use a fixed-rate clock node, reference here, and set that in board dts?

Sebastian

#10 lore raw

RFC PATCH 4/5 ARM: mv78x00: Add the Device Tree support for MV78X00 family

Quoted 22 lines · Sebastian Hesselbarth
Quoted 10 lines · Jason Cooper
Quoted 9 lines · Gregory CLEMENT

This commit adds the Device Tree support for the mv78x00 SoC family. It adds an mv78x00.dtsi description of the mv78x00 SoC

So far, the Device Tree contains the interrupt controller, the GPIO bank, the UART controllers, the USB host controllers, the SATA controllers and the I2C controllers.

---

...

Quoted 9 lines

arch/arm/boot/dts/mv78x00.dtsi line 72

Quoted 6 lines
arch/arm/boot/dts/mv78x00.dtsi new file +6 -0
+		serial at 12300 {
+			compatible = "ns16550a";
+			reg =<0x12300 0x100>;
+			reg-shift =<2>;
+			interrupts =<15>;
+			/* set clock-frequency in board dts */

We should probably add a note to these comments that this is only until mv78x00 is converted to the clock infrastructure.

Quoted 2 lines

Or use a fixed-rate clock node, reference here, and set that in board dts?

Yes, I realized (of course _after_ hitting send), that the whole issue I was recalling was wrt gated clocks. iirc now, mv78xx0 doesn't have gated clocks.

thx,

Jason.

#11 lore raw

RFC PATCH 5/5 ARM: mv78x00: Add Device Tree support for the RD-78X00-mASA board

In reply to Gregory CLEMENT

This commit adds the device tree support for the RD-78X00-mASA board. It mainly converts the platform resource from the former board file to the dts. It also add this device tree to the list of the dtbs make rule.

Currently support includes:
- UARTs
- USBs
- I2Cs
- RTC
- SATAs

The mains lacks are PCI and Ethernet which will be added when converted to device tree.

---
 arch/arm/boot/dts/Makefile            |  1 +
 arch/arm/boot/dts/mv78x00-masa-db.dts | 61 +++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 arch/arm/boot/dts/mv78x00-masa-db.dts
arch/arm/boot/dts/Makefile +1 -0
index b9f7121..f152b89 100644
@@ -91,6 +91,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
 dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
 	msm8960-cdp.dtb
+dtb-$(CONFIG_ARCH_MV78X00) += mv78x00-masa-db.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
 	armada-370-mirabox.dtb \
 	armada-370-rd.dtb \
arch/arm/boot/dts/mv78x00-masa-db.dts new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.8.1.2
maintainer
#12 lore raw

cover ARM: mv78x00: First step to convert mv78x00 to Device Tree

In reply to Gregory CLEMENT
Quoted 17 lines · Gregory CLEMENT

Hello,

This patch set is a first step in order to convert mach-mv78x00 to device tree before it joins mach-mvebu.

I managed to test it on the RD-78X00-mASA board. All the peripherals I have tested work as they work before the migration to the device tree:
- UART
- Ethernet
- USB
- SATA

My main concern is that the mv78x00 are MP but not SMP capable. Currently the same kernel run on the 2 cores and it is in the board file that the peripherals are assigned for each CPU. (Actually I didn't test this behavior, but the code is written in this way.)

Quoted 5 lines

I don't know how to assign a peripheral to a given CPU with the device tree. The only way I have in mind is to have a dts per CPU, but I am not sure it is very convenient.

So for now the code assigns all the peripherals to the CPU.

Hi Gregory

Could you explain what you have in a bit more detail. Are you just bringing up one CPU and assigning all peripherals to that? Or do all peripherals get assigned to the first CPU but both are running?

As you say, it looks like you need a DTS subtree per CPU for placing peripherals. No idea if it will work, but i guess i would try:

       ocp at f1000000@cpu0 {
/include/ "mv78x00-peripherals.dtsi"
       }
       ocp at f1000000@cpu1 {
/include/ "mv78x00-peripherals.dtsi"
       }

so you get all the peripherals twice, disabled by default. In the board-dt.c you can then do something like:

	if (mv78xx0_core_index() == 0) {
	   np = of_find_node_by_name(NULL, "ocp at f1000000@cpu0");
	else
	   np = of_find_node_by_name(NULL, "ocp at f1000000@cpu1");
	
        of_platform_populate(np, kirkwood_dt_match_table, NULL, NULL);

There are a few more details, like the GPIO controller has a different mask register for CPU1, but that is not supported in the current mvebu gpio code. However none of the current 3 boards make use of GPIO, let alone GPIO interrupts.

Quoted 4 lines

I am also concerned by the 2 other boards: the Marvell DB-78x00-BP Development Board and the Buffalo WLX (Terastation Duo) NAS. I don't have them and so I can't test them if I want to convert them to device tree too.

The Buffalo WLX is interesting. The wxl_init() does not differentiate between CPU0 and CPU1, where as the Marvell reference boards do. So i suspect only one CPU is running, or its broken.

It might be interesting to ask on the buffalo forums if anybody is actually using mainline on TS-WLX.

Andrew

#13 lore raw

cover ARM: mv78x00: First step to convert mv78x00 to Device Tree

Quoted 18 lines · Andrew Lunn
Quoted 17 lines · Gregory CLEMENT

Hello,

This patch set is a first step in order to convert mach-mv78x00 to device tree before it joins mach-mvebu.

I managed to test it on the RD-78X00-mASA board. All the peripherals I have tested work as they work before the migration to the device tree:
- UART
- Ethernet
- USB
- SATA

My main concern is that the mv78x00 are MP but not SMP capable. Currently the same kernel run on the 2 cores and it is in the board file that the peripherals are assigned for each CPU. (Actually I didn't test this behavior, but the code is written in this way.)

Quoted 7 lines
Quoted 5 lines

I don't know how to assign a peripheral to a given CPU with the device tree. The only way I have in mind is to have a dts per CPU, but I am not sure it is very convenient.

So for now the code assigns all the peripherals to the CPU.

Hi Gregory

Hi Andrew,

Quoted 4 lines

Could you explain what you have in a bit more detail. Are you just bringing up one CPU and assigning all peripherals to that? Or do all peripherals get assigned to the first CPU but both are running?

Currently I didn't find (but I didn't looked for so much) how to boot the kernel on both CPU even with the legacy code. So I am just bringing up one CPU and assigning all peripherals to that.

Quoted 15 lines

As you say, it looks like you need a DTS subtree per CPU for placing peripherals. No idea if it will work, but i guess i would try:

       ocp at f1000000@cpu0 {
/include/ "mv78x00-peripherals.dtsi"
       }
       ocp at f1000000@cpu1 {
/include/ "mv78x00-peripherals.dtsi"
       }

so you get all the peripherals twice, disabled by default. In the board-dt.c you can then do something like:

Quoted 7 lines
	if (mv78xx0_core_index() == 0) {
	   np = of_find_node_by_name(NULL, "ocp at f1000000@cpu0");
	else
	   np = of_find_node_by_name(NULL, "ocp at f1000000@cpu1");
	
        of_platform_populate(np, kirkwood_dt_match_table, NULL, NULL);

very interesting idea, I will try it to see how it goes!

Quoted 5 lines

There are a few more details, like the GPIO controller has a different mask register for CPU1, but that is not supported in the current mvebu gpio code. However none of the current 3 boards make use of GPIO, let alone GPIO interrupts.

Quoted 8 lines
Quoted 4 lines

I am also concerned by the 2 other boards: the Marvell DB-78x00-BP Development Board and the Buffalo WLX (Terastation Duo) NAS. I don't have them and so I can't test them if I want to convert them to device tree too.

The Buffalo WLX is interesting. The wxl_init() does not differentiate between CPU0 and CPU1, where as the Marvell reference boards do. So i suspect only one CPU is running, or its broken.

It looked like a copy and paste of the rd78x00_masa_init function: it kept the comment about the 2 CPUs "Partition on-chip peripherals between the two CPU cores."

Quoted 3 lines

It might be interesting to ask on the buffalo forums if anybody is actually using mainline on TS-WLX.

Do you know where is this forum?

Thanks for your review and your ideas!

Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
maintainer
#14 lore raw

cover ARM: mv78x00: First step to convert mv78x00 to Device Tree

Quoted 30 lines · Gregory CLEMENT
Quoted 18 lines · Andrew Lunn
Quoted 17 lines · Gregory CLEMENT

Hello,

This patch set is a first step in order to convert mach-mv78x00 to device tree before it joins mach-mvebu.

I managed to test it on the RD-78X00-mASA board. All the peripherals I have tested work as they work before the migration to the device tree:
- UART
- Ethernet
- USB
- SATA

My main concern is that the mv78x00 are MP but not SMP capable. Currently the same kernel run on the 2 cores and it is in the board file that the peripherals are assigned for each CPU. (Actually I didn't test this behavior, but the code is written in this way.)

Quoted 7 lines
Quoted 5 lines

I don't know how to assign a peripheral to a given CPU with the device tree. The only way I have in mind is to have a dts per CPU, but I am not sure it is very convenient.

So for now the code assigns all the peripherals to the CPU.

Hi Gregory

Hi Andrew,

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Could you explain what you have in a bit more detail. Are you just bringing up one CPU and assigning all peripherals to that? Or do all peripherals get assigned to the first CPU but both are running?

Currently I didn't find (but I didn't looked for so much) how to boot the kernel on both CPU even with the legacy code. So I am just bringing up one CPU and assigning all peripherals to that.

Hi Gregory

Did you try looking at UART 1. It could be there is a second uboot instance running on it which is for CPU1.

Quoted 4 lines
Quoted 2 lines

It might be interesting to ask on the buffalo forums if anybody is actually using mainline on TS-WLX.

Do you know where is this forum?

http://forum.buffalo.nas-central.org

Andrew