Skip to contentSkip to conversation

Versatile Express DT support

PATCH New Pawel Moll 8 participants 38 messages Dec 15, 2011 – Jan 31, 2012

Subsystems (4)
lore
Share & tools
lore

Pawel Moll

author
#0 lore raw

v6 cover Versatile Express DT support

Hi All,

This is the last (at least this year) version of the patches. I've added
Tested-by: Tixy to the patches that hasn't change since v5. I didn't add Arnd's and Rob's Acked-bys as the code changed significantly since. If still applicable, I'll add then on the first opportunity.

Arnd, Russell, if you think that the code is ready enough for 3.3, please pull from this branch based on today's tip (v3.2-rc5+):

8<--------------------------------------------------------------------- The following changes since commit 55b02d2f4445ad625213817a1736bf2884d32547:

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux (2011-12-14 19:45:40 -0800)

are available in the git repository at:

git://git.linaro.org/people/pawelmoll/linux.git vexpress-dt
8<---------------------------------------------------------------------

I also have a "vexpress-dt-rmk-devel-stable" branch there, based on today's Russell's devel-stable. The only difference is "handle_irq" added to DT machine description.

If there are still some issues I'll address them once I'm back from holiday (today it's the last day before I loose all access to the Internet for a month).

Changes since v5:

* As suggested by Russell, DT-based local timers take precedence over statically defined ones (so the twd_base if overwritten).

* Minor redactorial changes in DT-based SMP initialization (the logic stays the same).

* Added last missing device node to the V2M trees: "arm,vexpress-vram".

* Similarly to "arm,vexpress-cf" added "arm,vexpress-psram" to the relevant node, just in case we need to detect it in future.

Tested on:
- V2P-CA9 with ATAGs (both with a ATAGs-only and ATAGs+DT kernels).
- V2P-CA9 with DT
- V2P-CA5s with DT
- V2P-CA15 with DT
- V2F-2XV6 Cortex-A7 SMM with DT

Thanks to all involved for your help! 8<---------------------------------------------------------------------

Pawel Moll (9):
ARM: versatile: Add missing ENDPROC to headsmp.S
ARM: vexpress: Get rid of MMIO_P2V
ARM: versatile: Map local timers using Device Tree when possible
ARM: vexpress: Use FDT data in platform SMP calls
ARM: vexpress: Add Device Tree support
ARM: vexpress: Motherboard RS1 memory map support
ARM: vexpress: Add Device Tree for V2P-CA5s core tile
ARM: vexpress: Add Device Tree for V2P-CA9 core tile
ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

 Documentation/devicetree/bindings/arm/vexpress.txt |  144 ++++++++++
 arch/arm/Kconfig                                   |    2 +-
 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi            |  201 ++++++++++++++
 arch/arm/boot/dts/vexpress-v2m.dtsi                |  200 ++++++++++++++
 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts        |  155 +++++++++++
 arch/arm/boot/dts/vexpress-v2p-ca5s.dts            |  160 +++++++++++
 arch/arm/boot/dts/vexpress-v2p-ca9.dts             |  190 +++++++++++++
 arch/arm/include/asm/hardware/arm_timer.h          |    5 +
 arch/arm/mach-realview/platsmp.c                   |    3 +-
 arch/arm/mach-vexpress/Kconfig                     |   45 +++-
 arch/arm/mach-vexpress/Makefile.boot               |    6 +
 arch/arm/mach-vexpress/core.h                      |    9 +-
 arch/arm/mach-vexpress/ct-ca9x4.c                  |   48 +---
 arch/arm/mach-vexpress/include/mach/ct-ca9x4.h     |   13 +-
 arch/arm/mach-vexpress/include/mach/debug-macro.S  |   37 +++-
 arch/arm/mach-vexpress/include/mach/irqs.h         |    2 +-
 arch/arm/mach-vexpress/include/mach/motherboard.h  |   58 +++--
 arch/arm/mach-vexpress/include/mach/uncompress.h   |   13 +-
 arch/arm/mach-vexpress/platsmp.c                   |  153 ++++++++++-
 arch/arm/mach-vexpress/v2m.c                       |  282 ++++++++++++++++++--
 arch/arm/mm/Kconfig                                |    2 +-
 arch/arm/plat-versatile/headsmp.S                  |    1 +
 arch/arm/plat-versatile/localtimer.c               |   12 +
 23 files changed, 1621 insertions(+), 120 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/vexpress.txt
 create mode 100644 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
 create mode 100644 arch/arm/boot/dts/vexpress-v2m.dtsi
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca5s.dts
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca9.dts
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH v6 1/9 ARM: versatile: Add missing ENDPROC to headsmp.S

Once the ENDPROC is in place, BSYM() in not longer necessary to get correct pointer to versatile_secondary_startup().

---
 arch/arm/mach-realview/platsmp.c  |    3 +--
 arch/arm/mach-vexpress/platsmp.c  |    4 +---
 arch/arm/plat-versatile/headsmp.S |    1 +
 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-realview/platsmp.c +1 -2
index e83c654..17c878d 100644
@@ -17,7 +17,6 @@
 #include <asm/hardware/gic.h>
 #include <asm/mach-types.h>
 #include <asm/smp_scu.h>
-#include <asm/unified.h>
 
 #include <mach/board-eb.h>
 #include <mach/board-pb11mp.h>
@@ -75,6 +74,6 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 	 * until it receives a soft interrupt, and then the
 	 * secondary CPU branches to this address.
 	 */
-	__raw_writel(BSYM(virt_to_phys(versatile_secondary_startup)),
+	__raw_writel(virt_to_phys(versatile_secondary_startup),
 		     __io_address(REALVIEW_SYS_FLAGSSET));
 }
arch/arm/mach-vexpress/platsmp.c +1 -3
index 2b5f7ac..124ffb1 100644
@@ -13,8 +13,6 @@
 #include <linux/smp.h>
 #include <linux/io.h>
 
-#include <asm/unified.h>
-
 #include <mach/motherboard.h>
 #define V2M_PA_CS7 0x10000000
 
@@ -46,6 +44,6 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 	 * secondary CPU branches to this address.
 	 */
 	writel(~0, MMIO_P2V(V2M_SYS_FLAGSCLR));
-	writel(BSYM(virt_to_phys(versatile_secondary_startup)),
+	writel(virt_to_phys(versatile_secondary_startup),
 		MMIO_P2V(V2M_SYS_FLAGSSET));
 }
arch/arm/plat-versatile/headsmp.S +1 -0
index d397a1f..dd703ef 100644
@@ -38,3 +38,4 @@ pen:	ldr	r7, [r6]
 	.align
 1:	.long	.
 	.long	pen_release
+ENDPROC(versatile_secondary_startup)
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH v6 2/9 ARM: vexpress: Get rid of MMIO_P2V

In reply to Pawel Moll

This patch gets rid of the MMIO_P2V and __MMIO_P2V macros, defining constant virtual base for motherboard and tile peripherals instead.

Additionally, in preparation for the new motherboard memory map, the motherboard peripherals are using base pointers calculated in runtime, instead of compile-time calculated values.

---
 arch/arm/include/asm/hardware/arm_timer.h         |    5 ++
 arch/arm/mach-vexpress/core.h                     |    9 ++-
 arch/arm/mach-vexpress/ct-ca9x4.c                 |   48 +++------------
 arch/arm/mach-vexpress/include/mach/ct-ca9x4.h    |   13 ++---
 arch/arm/mach-vexpress/include/mach/motherboard.h |   52 ++++++++--------
 arch/arm/mach-vexpress/platsmp.c                  |    5 +-
 arch/arm/mach-vexpress/v2m.c                      |   68 ++++++++++++++-------
 7 files changed, 98 insertions(+), 102 deletions(-)
arch/arm/include/asm/hardware/arm_timer.h +5 -0
index c0f4e7b..d6030ff 100644
@@ -9,7 +9,12 @@
  *
  * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview
  * can have 16-bit or 32-bit selectable via a bit in the control register.
+ *
+ * Every SP804 contains two identical timers.
  */
+#define TIMER_1_BASE	0x00
+#define TIMER_2_BASE	0x20
+
 #define TIMER_LOAD	0x00			/* ACVR rw */
 #define TIMER_VALUE	0x04			/* ACVR ro */
 #define TIMER_CTRL	0x08			/* ACVR rw */
arch/arm/mach-vexpress/core.h +6 -3
index f439715..75a640a 100644
@@ -1,6 +1,3 @@
-#define __MMIO_P2V(x)	(((x) & 0xfffff) | (((x) & 0x0f000000) >> 4) | 0xf8000000)
-#define MMIO_P2V(x)	((void __iomem *)__MMIO_P2V(x))
-
 #define AMBA_DEVICE(name,busid,base,plat)	\
 struct amba_device name##_device = {		\
 	.dev		= {			\
@@ -17,3 +14,9 @@ struct amba_device name##_device = {		\
 	.irq		= IRQ_##base,		\
 	/* .dma		= DMA_##base,*/		\
 }
+
+/* 2MB large area for motherboard's peripherals static mapping */
+#define V2M_PERIPH ((void __iomem *)0xf8000000)
+
+/* Tile's peripherals static mappings should start here */
+#define V2T_PERIPH ((void __iomem *)0xf8200000)
arch/arm/mach-vexpress/ct-ca9x4.c +10 -38

88 lines not on this page · raw message

arch/arm/mach-vexpress/include/mach/ct-ca9x4.h +5 -8
index a34d3d4..8f962fb 100644
@@ -22,14 +22,11 @@
 #define CT_CA9X4_SYSWDT		(0x1e007000)
 #define CT_CA9X4_L2CC		(0x1e00a000)
 
-#define CT_CA9X4_TIMER0		(CT_CA9X4_SP804_TIMER + 0x000)
-#define CT_CA9X4_TIMER1		(CT_CA9X4_SP804_TIMER + 0x020)
-
-#define A9_MPCORE_SCU		(CT_CA9X4_MPIC + 0x0000)
-#define A9_MPCORE_GIC_CPU	(CT_CA9X4_MPIC + 0x0100)
-#define A9_MPCORE_GIT		(CT_CA9X4_MPIC + 0x0200)
-#define A9_MPCORE_TWD		(CT_CA9X4_MPIC + 0x0600)
-#define A9_MPCORE_GIC_DIST	(CT_CA9X4_MPIC + 0x1000)
+#define A9_MPCORE_SCU		0x0000
+#define A9_MPCORE_GIC_CPU	0x0100
+#define A9_MPCORE_GIT		0x0200
+#define A9_MPCORE_TWD		0x0600
+#define A9_MPCORE_GIC_DIST	0x1000
 
 /*
  * Interrupts.  Those in {} are for AMBA devices
arch/arm/mach-vexpress/include/mach/motherboard.h +25 -27

64 lines not on this page · raw message

arch/arm/mach-vexpress/platsmp.c +1 -4
index 124ffb1..a1ed6d6 100644
@@ -14,7 +14,6 @@
 #include <linux/io.h>
 
 #include <mach/motherboard.h>
-#define V2M_PA_CS7 0x10000000
 
 #include "core.h"
 
@@ -43,7 +42,5 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 	 * until it receives a soft interrupt, and then the
 	 * secondary CPU branches to this address.
 	 */
-	writel(~0, MMIO_P2V(V2M_SYS_FLAGSCLR));
-	writel(virt_to_phys(versatile_secondary_startup),
-		MMIO_P2V(V2M_SYS_FLAGSSET));
+	v2m_flags_set(virt_to_phys(versatile_secondary_startup));
 }
arch/arm/mach-vexpress/v2m.c +46 -22

145 lines not on this page · raw message

Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH v6 3/9 ARM: versatile: Map local timers using Device Tree when possible

In reply to Pawel Moll

Try to map TWD registers basing on a "arm,smp-twd" Device Tree node (compatible value as used in Highbank's DT). This overrides existing twd_base value.

---
 arch/arm/plat-versatile/localtimer.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/plat-versatile/localtimer.c +12 -0
index 0fb3961..8f0dc10 100644
@@ -11,6 +11,8 @@
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/clockchips.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/smp_twd.h>
 #include <asm/localtimer.h>
@@ -21,6 +23,16 @@
  */
 int __cpuinit local_timer_setup(struct clock_event_device *evt)
 {
+#if defined(CONFIG_OF)
+	struct device_node *node = of_find_compatible_node(NULL,
+			NULL, "arm,smp-twd");
+
+	if (node)
+		twd_base = of_iomap(node, 0);
+#endif
+	if (!twd_base)
+		return -ENXIO;
+
 	evt->irq = IRQ_LOCALTIMER;
 	twd_timer_setup(evt);
 	return 0;
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH v6 3/9 ARM: versatile: Map local timers using Device Tree when possible

Quoted 23 lines · Pawel Moll

Try to map TWD registers basing on a "arm,smp-twd" Device Tree node (compatible value as used in Highbank's DT). This overrides existing twd_base value.

---
 arch/arm/plat-versatile/localtimer.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/plat-versatile/localtimer.c +2 -0
index 0fb3961..8f0dc10 100644
@@ -11,6 +11,8 @@
 #include <linux/init.h>
 #include <linux/smp.h>
 #include <linux/clockchips.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/smp_twd.h>
 #include <asm/localtimer.h>

arch/arm/plat-versatile/localtimer.c line 32

Quoted 10 lines
arch/arm/plat-versatile/localtimer.c +7 -0
@@ -21,6 +23,16 @@
  */
 int __cpuinit local_timer_setup(struct clock_event_device *evt)
 {
+#if defined(CONFIG_OF)
+	struct device_node *node = of_find_compatible_node(NULL,
+			NULL, "arm,smp-twd");
+
+	if (node)
+		twd_base = of_iomap(node, 0);
+#endif

I think your previous version was more correct. This is going to find the node and do ioremap N times where N is the number of cores. It does work though because that is what I did initially too.

Rob

author
#5 lore raw

PATCH v6 3/9 ARM: versatile: Map local timers using Device Tree when possible

Quoted 7 lines · Rob Herring
Quoted 7 lines
arch/arm/plat-versatile/localtimer.c +3 -0
@@ -21,6 +23,16 @@
  */
 int __cpuinit local_timer_setup(struct clock_event_device *evt)
 {
+#if defined(CONFIG_OF)
+	struct device_node *node = of_find_compatible_node(NULL,
+			NULL, "arm,smp-twd");
Quoted 8 lines

arch/arm/plat-versatile/localtimer.c line 32

Quoted 4 lines
arch/arm/plat-versatile/localtimer.c +4 -0
+
+	if (node)
+		twd_base = of_iomap(node, 0);
+#endif

I think your previous version was more correct. This is going to find the node and do ioremap N times where N is the number of cores. It does work though because that is what I did initially too.

Right, how about that, then:

@@ -21,6 +23,22 @@
*/
int __cpuinit local_timer_setup(struct clock_event_device *evt) {
+#if defined(CONFIG_OF)
+ static int dt_node_probed;
+
+ if (!dt_node_probed) {
+ struct device_node *node = of_find_compatible_node(NULL,
+ NULL, "arm,smp-twd");
+
+ if (node)
+ twd_base = of_iomap(node, 0);
+
+ dt_node_probed = 1;
+ }
+#endif
+ if (!twd_base)
+ return -ENXIO;
+

        evt->irq = IRQ_LOCALTIMER;
        twd_timer_setup(evt);
        return 0;

Cheers!

Pawe?

author
#6 lore raw

PATCH v6 3/9 ARM: versatile: Map local timers using Device Tree when possible

Quoted 19 lines · Pawel Moll
Quoted 3 lines

I think your previous version was more correct. This is going to find the node and do ioremap N times where N is the number of cores. It does work though because that is what I did initially too.

Right, how about that, then:

arch/arm/plat-versatile/localtimer.c +9 -0
@@ -21,6 +23,22 @@
  */
 int __cpuinit local_timer_setup(struct clock_event_device *evt)
 {
+#if defined(CONFIG_OF)
+       static int dt_node_probed;
+
+       if (!dt_node_probed) {
+               struct device_node *node = of_find_compatible_node(NULL,
+                               NULL, "arm,smp-twd");
+
+               if (node)
+                       twd_base = of_iomap(node, 0);

arch/arm/plat-versatile/localtimer.c line 44

Quoted 10 lines
arch/arm/plat-versatile/localtimer.c +7 -0
+
+               dt_node_probed = 1;
+       }
+#endif
+       if (!twd_base)
+               return -ENXIO;
+
        evt->irq = IRQ_LOCALTIMER;
        twd_timer_setup(evt);
        return 0;

Ok, so I have updated the both vexpress-dt and
vexpress-dt-rmk-devel-stable branches like that.

Arnd, Russell, the new pull request below.

I'll see you all next year!

Cheers!

Pawe?

8<-------------------------------------------------------------------

The following changes since commit 55b02d2f4445ad625213817a1736bf2884d32547:

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux (2011-12-14 19:45:40 -0800)

are available in the git repository at:

git://git.linaro.org/people/pawelmoll/linux.git vexpress-dt

Pawel Moll (9):
ARM: versatile: Add missing ENDPROC to headsmp.S
ARM: vexpress: Get rid of MMIO_P2V
ARM: versatile: Map local timers using Device Tree when possible
ARM: vexpress: Use FDT data in platform SMP calls
ARM: vexpress: Add Device Tree support
ARM: vexpress: Motherboard RS1 memory map support
ARM: vexpress: Add Device Tree for V2P-CA5s core tile
ARM: vexpress: Add Device Tree for V2P-CA9 core tile
ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

 Documentation/devicetree/bindings/arm/vexpress.txt |  144 ++++++++++
 arch/arm/Kconfig                                   |    2 +-
 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi            |  201 ++++++++++++++
 arch/arm/boot/dts/vexpress-v2m.dtsi                |  200 ++++++++++++++
 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts        |  155 +++++++++++
 arch/arm/boot/dts/vexpress-v2p-ca5s.dts            |  160 +++++++++++
 arch/arm/boot/dts/vexpress-v2p-ca9.dts             |  190 +++++++++++++
 arch/arm/include/asm/hardware/arm_timer.h          |    5 +
 arch/arm/mach-realview/platsmp.c                   |    3 +-
 arch/arm/mach-vexpress/Kconfig                     |   45 +++-
 arch/arm/mach-vexpress/Makefile.boot               |    6 +
 arch/arm/mach-vexpress/core.h                      |    9 +-
 arch/arm/mach-vexpress/ct-ca9x4.c                  |   48 +---
 arch/arm/mach-vexpress/include/mach/ct-ca9x4.h     |   13 +-
 arch/arm/mach-vexpress/include/mach/debug-macro.S  |   37 +++-
 arch/arm/mach-vexpress/include/mach/irqs.h         |    2 +-
 arch/arm/mach-vexpress/include/mach/motherboard.h  |   58 +++--
 arch/arm/mach-vexpress/include/mach/uncompress.h   |   13 +-
 arch/arm/mach-vexpress/platsmp.c                   |  153 ++++++++++-
 arch/arm/mach-vexpress/v2m.c                       |  282 ++++++++++++++++++--
 arch/arm/mm/Kconfig                                |    2 +-
 arch/arm/plat-versatile/headsmp.S                  |    1 +
 arch/arm/plat-versatile/localtimer.c               |   19 ++
 23 files changed, 1628 insertions(+), 120 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/vexpress.txt
 create mode 100644 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
 create mode 100644 arch/arm/boot/dts/vexpress-v2m.dtsi
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca5s.dts
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca9.dts
author
#7 lore raw

PATCH v6 4/9 ARM: vexpress: Use FDT data in platform SMP calls

In reply to Pawel Moll

If ct_desc is not set (so a board was booted with DT machine ID) try to look for "arm,cortex-a9-scu" node and initialize the SCU using base address in "reg" property.

Otherwise assume that there is no special SCU initialization required and initialize CPUs basing on numbers of "cpu" type devices in "cpus" node of the Device Tree.

---
 arch/arm/mach-vexpress/platsmp.c |  148 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 146 insertions(+), 2 deletions(-)
arch/arm/mach-vexpress/platsmp.c +146 -2
index a1ed6d6..d49e800d 100644
@@ -12,6 +12,11 @@
 #include <linux/errno.h>
 #include <linux/smp.h>
 #include <linux/io.h>
+#include <linux/of_fdt.h>
+
+#include <asm/smp_scu.h>
+#include <asm/hardware/gic.h>
+#include <asm/mach/map.h>
 
 #include <mach/motherboard.h>
 
@@ -19,13 +24,149 @@
 
 extern void versatile_secondary_startup(void);
 
+#if defined(CONFIG_OF)
+
+static enum {
+	UNKNOWN_SCU,
+	GENERIC_SCU,
+	CORTEX_A9_SCU,
+} vexpress_dt_scu = UNKNOWN_SCU;
+
+static void __init vexpress_dt_init_cpu_map(int ncores)
+{
+	int i;
+
+	if (ncores > nr_cpu_ids) {
+		pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
+				ncores, nr_cpu_ids);
+		ncores = nr_cpu_ids;
+	}
+
+	for (i = 0; i < ncores; ++i)
+		set_cpu_possible(i, true);
+}
+
+static struct map_desc vexpress_dt_cortex_a9_scu_map[] __initdata = {
+	{
+		.virtual	= (unsigned long)V2T_PERIPH,
+		/* .pfn	set in vexpress_dt_init_cortex_a9_scu() */
+		.length		= SZ_128,
+		.type		= MT_DEVICE,
+	},
+};
+
+static int __init vexpress_dt_find_scu(unsigned long node,
+		const char *uname, int depth, void *data)
+{
+	if (of_flat_dt_is_compatible(node, "arm,cortex-a9-scu")) {
+		__be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
+
+		if (WARN_ON(!reg))
+			return -EINVAL;
+
+		vexpress_dt_cortex_a9_scu_map[0].pfn =
+				__phys_to_pfn(be32_to_cpup(reg));
+		iotable_init(vexpress_dt_cortex_a9_scu_map,
+				ARRAY_SIZE(vexpress_dt_cortex_a9_scu_map));
+
+		vexpress_dt_init_cpu_map(scu_get_core_count(V2T_PERIPH));
+		set_smp_cross_call(gic_raise_softirq);
+
+		vexpress_dt_scu = CORTEX_A9_SCU;
+
+		return 1;
+	}
+
+	return 0;
+}
+
+static int __init vexpress_dt_nr_cpus(unsigned long node, const char *uname,
+		int depth, void *data)
+{
+	static int prev_depth = -1;
+	static int nr_cpus = -1;
+
+	if (prev_depth > depth && nr_cpus > 0)
+		return nr_cpus;
+
+	if (nr_cpus < 0 && strcmp(uname, "cpus") == 0)
+		nr_cpus = 0;
+
+	if (nr_cpus >= 0) {
+		const char *device_type = of_get_flat_dt_prop(node,
+				"device_type", NULL);
+
+		if (device_type && strcmp(device_type, "cpu") == 0)
+			nr_cpus++;
+	}
+
+	prev_depth = depth;
+
+	return 0;
+}
+
+static void __init vexpress_dt_smp_init_cpus(void)
+{
+	int res = of_scan_flat_dt(vexpress_dt_find_scu, NULL);
+
+	if (WARN_ON(res < 0))
+		return;
+
+	if (vexpress_dt_scu == UNKNOWN_SCU) {
+		int ncores = of_scan_flat_dt(vexpress_dt_nr_cpus, NULL);
+		if (ncores < 2)
+			return;
+
+		vexpress_dt_scu = GENERIC_SCU;
+
+		vexpress_dt_init_cpu_map(ncores);
+		set_smp_cross_call(gic_raise_softirq);
+	}
+}
+
+static void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
+{
+	int i;
+
+	switch (vexpress_dt_scu) {
+	case GENERIC_SCU:
+		for (i = 0; i < max_cpus; i++)
+			set_cpu_present(i, true);
+		break;
+	case CORTEX_A9_SCU:
+		scu_enable(V2T_PERIPH);
+		break;
+	default:
+		WARN_ON(1);
+		break;
+	}
+}
+
+#else
+
+static void __init vexpress_dt_smp_init_cpus(void)
+{
+	WARN_ON(1);
+}
+
+void __init vexpress_dt_smp_prepare_cpus(unsigned int max_cpus)
+{
+	WARN_ON(1);
+}
+
+#endif
+
 /*
  * Initialise the CPU possible map early - this describes the CPUs
  * which may be present or become present in the system.
  */
 void __init smp_init_cpus(void)
 {
-	ct_desc->init_cpu_map();
+	if (ct_desc)
+		ct_desc->init_cpu_map();
+	else
+		vexpress_dt_smp_init_cpus();
+
 }
 
 void __init platform_smp_prepare_cpus(unsigned int max_cpus)
@@ -34,7 +175,10 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
 	 * Initialise the present map, which describes the set of CPUs
 	 * actually populated at the present time.
 	 */
-	ct_desc->smp_enable(max_cpus);
+	if (ct_desc)
+		ct_desc->smp_enable(max_cpus);
+	else
+		vexpress_dt_smp_prepare_cpus(max_cpus);
 
 	/*
 	 * Write the address of secondary startup into the
Signature · 1 line
1.7.5.4
author
#8 lore raw

PATCH v6 5/9 ARM: vexpress: Add Device Tree support

In reply to Pawel Moll

This patch adds generic Versatile Express DT machine description, Device Tree description for the motherboard and documentation for the bindings.

---
 Documentation/devicetree/bindings/arm/vexpress.txt |  144 ++++++++++++++
 arch/arm/Kconfig                                   |    2 +-
 arch/arm/boot/dts/vexpress-v2m.dtsi                |  200 ++++++++++++++++++++
 arch/arm/mach-vexpress/Kconfig                     |   45 ++++-
 arch/arm/mach-vexpress/Makefile.boot               |    2 +
 arch/arm/mach-vexpress/include/mach/motherboard.h  |    6 +
 arch/arm/mach-vexpress/v2m.c                       |  152 +++++++++++++++-
 arch/arm/mm/Kconfig                                |    2 +-
 8 files changed, 546 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/vexpress.txt
 create mode 100644 arch/arm/boot/dts/vexpress-v2m.dtsi
Documentation/devicetree/bindings/arm/vexpress.txt new file +144 -0
new file mode 100644
index 0000000..87b9ee7
@@ -0,0 +1,144 @@
+ARM Versatile Express boards family
+-----------------------------------
+
+ARM's Versatile Express platform consists of a motherboard and one
+or more daughterboards (tiles). The motherboard provides a set of
+peripherals. Processor and RAM "live" on the tiles.
+
+The motherboard and each core tile should be described by a separate
+Device Tree source file, with the tile's description including
+the motherboard file using a /include/ directive. As the motherboard
+can be initialized in one of two different configurations ("memory
+maps"), care must be taken to include the correct one.
+
+Required properties in the root node:
+- compatible value:
+	compatible = "arm,vexpress,<model>", "arm,vexpress";
+  where <model> is the full tile model name (as used in the tile's
+    Technical Reference Manual), eg.:
+    - for Coretile Express A5x2 (V2P-CA5s):
+	compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
+    - for Coretile Express A9x4 (V2P-CA9):
+	compatible = "arm,vexpress,v2p-ca9", "arm,vexpress";
+  If a tile comes in several variants or can be used in more then one
+  configuration, the compatible value should be:
+	compatible = "arm,vexpress,<model>,<variant>", \
+				"arm,vexpress,<model>", "arm,vexpress";
+  eg:
+    - Coretile Express A15x2 (V2P-CA15) with Tech Chip 1:
+	compatible = "arm,vexpress,v2p-ca15,tc1", \
+				"arm,vexpress,v2p-ca15", "arm,vexpress";
+    - LogicTile Express 13MG (V2F-2XV6) running Cortex-A7 (3 cores) SMM:
+	compatible = "arm,vexpress,v2f-2xv6,ca7x3", \
+				"arm,vexpress,v2f-2xv6", "arm,vexpress";
+
+Optional properties in the root node:
+- tile model name (use name from the tile's Technical Reference
+  Manual, eg. "V2P-CA5s")
+	model = "<model>";
+- tile's HBI number (unique ARM's board model ID, visible on the
+  PCB's silkscreen) in hexadecimal transcription:
+	arm,hbi = <0xhbi>
+  eg:
+  - for Coretile Express A5x2 (V2P-CA5s) HBI-0191:
+	arm,hbi = <0x191>;
+  - Coretile Express A9x4 (V2P-CA9) HBI-0225:
+	arm,hbi = <0x225>;
+
+Top-level standard "cpus" node is required. It must contain a node
+with device_type = "cpu" property for every available core, eg.:
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0>;
+		};
+	};
+
+The motherboard description file provides a single "motherboard" node
+using 2 address cells corresponding to the Static Memory Bus used
+between the motherboard and the tile. The first cell defines the Chip
+Select (CS) line number, the second cell address offset within the CS.
+All interrupt lines between the motherboard and the tile are active
+high and are described using single cell.
+
+Optional properties of the "motherboard" node:
+- motherboard's memory map variant:
+	arm,v2m-memory-map = "<name>";
+  where name is one of:
+  - "rs1" - for RS1 map (i.a. peripherals on CS3); this map is also
+            referred to as "ARM Cortex-A Series memory map":
+	arm,v2m-memory-map = "rs1";
+  When this property is missing, the motherboard is using the original
+  memory map (also known as the "Legacy memory map", primarily used
+  with the original CoreTile Express A9x4) with peripherals on CS7.
+
+Motherboard .dtsi files provide a set of labelled peripherals that
+can be used to obtain required phandle in the tile's "aliases" node:
+- UARTs, note that the numbers correspond to the physical connectors
+  on the motherboard's back panel:
+	v2m_serial0, v2m_serial1, v2m_serial2 and v2m_serial3
+- I2C controllers:
+	v2m_i2c_dvi and v2m_i2c_pcie
+- SP804 timers:
+	v2m_timer01 and v2m_timer23
+
+Current Linux implementation requires a "arm,v2m_timer" alias
+pointing at one of the motherboard's SP804 timers, if it is to be
+used as the system timer. This alias should be defined in the
+motherboard files.
+
+The tile description must define "ranges", "interrupt-map-mask" and
+"interrupt-map" properties to translate the motherboard's address
+and interrupt space into one used by the tile's processor.
+
+Abbreviated example:
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "V2P-CA5s";
+	arm,hbi = <0x225>;
+	compatible = "arm,vexpress-v2p-ca5s", "arm,vexpress";
+	interrupt-parent = <&gic>;
+
+	aliases {
+		serial0 = &v2m_serial0;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0>;
+		};
+	};
+
+	gic: interrupt-controller at 2c001000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0x2c001000 0x1000>,
+		      <0x2c000100 0x100>;
+	};
+
+	motherboard {
+		/* CS0 is visible at 0x08000000 */
+		ranges = <0 0 0x08000000 0x04000000>;
+		interrupt-map-mask = <0 0 63>;
+		/* Active high IRQ 0 is connected to GIC's SPI0 */
+		interrupt-map = <0 0 0 &gic 0 0 4>;
+	};
+};
+
+/include/ "vexpress-v2m-rs1.dtsi"
arch/arm/Kconfig +1 -1
index 776d76b..9e484a7 100644
@@ -1441,7 +1441,7 @@ config SMP
 	depends on GENERIC_CLOCKEVENTS
 	depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \
 		 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
-		 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
+		 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS || \
 		 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE || ARCH_HIGHBANK || SOC_IMX6Q
 	depends on MMU
 	select USE_GENERIC_SMP_HELPERS
arch/arm/boot/dts/vexpress-v2m.dtsi new file +200 -0

200 lines not on this page · raw message

arch/arm/mach-vexpress/Kconfig +42 -3

54 lines not on this page · raw message

arch/arm/mach-vexpress/Makefile.boot +2 -0
index 8630b3d..c6dd891 100644
@@ -1,3 +1,5 @@
+# Those numbers are used only by the non-DT V2P-CA9 platform
+# The DT-enabled ones require CONFIG_AUTO_ZRELADDR=y
    zreladdr-y	+= 0x60008000
 params_phys-y	:= 0x60000100
 initrd_phys-y	:= 0x60800000
arch/arm/mach-vexpress/include/mach/motherboard.h +6 -0
index b4c498c..31a9289 100644
@@ -117,6 +117,12 @@ int v2m_cfg_read(u32 devfn, u32 *data);
 void v2m_flags_set(u32 data);
 
 /*
+ * Miscellaneous
+ */
+#define SYS_MISC_MASTERSITE	(1 << 14)
+#define SYS_PROCIDx_HBI_MASK	0xfff
+
+/*
  * Core tile IDs
  */
 #define V2M_CT_ID_CA9		0x0c000191
arch/arm/mach-vexpress/v2m.c +150 -2

173 lines not on this page · raw message

arch/arm/mm/Kconfig +1 -1
index 67f75a0..2506e58 100644
@@ -821,7 +821,7 @@ config CACHE_L2X0
 	depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
 		   REALVIEW_EB_A9MP || ARCH_IMX_V6_V7 || MACH_REALVIEW_PBX || \
 		   ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \
-		   ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE || \
+		   ARCH_U8500 || ARCH_VEXPRESS || ARCH_SHMOBILE || \
 		   ARCH_PRIMA2 || ARCH_ZYNQ || ARCH_CNS3XXX || ARCH_HIGHBANK
 	default y
 	select OUTER_CACHE
Signature · 1 line
1.7.5.4
#9 lore raw

PATCH v6 5/9 ARM: vexpress: Add Device Tree support

Quoted 3 lines · Pawel Moll

This patch adds generic Versatile Express DT machine description, Device Tree description for the motherboard and documentation for the bindings.

[...]

Quoted 1 line
arch/arm/mach-vexpress/v2m.c +0 -0

[...]

arch/arm/mach-vexpress/v2m.c MACHINE_START(VEXPRESS, "ARM-Versatile Express") · line 622

Quoted 8 lines
arch/arm/mach-vexpress/v2m.c +8 -0
+DT_MACHINE_START(VEXPRESS_DT, "ARM Versatile Express")
+	.map_io		= v2m_dt_map_io,
+	.init_early	= v2m_dt_init_early,
+	.init_irq	= v2m_dt_init_irq,
+	.timer		= &v2m_dt_timer,
+	.init_machine	= v2m_dt_init,
+	.dt_compat	= v2m_dt_match,
+MACHINE_END

The machine name here is missing a '-' that is in the original non device-tree machine description, which is "ARM-Versatile Express". The hyphen is also in Integrator and Realview machine names, so this seems to be a convention with ARM boards.

(I found this because Android parses machine name for configuration purposes.)

Signature · 1 line
Tixy
author
#10 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

In reply to Pawel Moll

This patch adds support for RS1 memory map based Versatile Express motherboard.

---
 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi           |  201 +++++++++++++++++++++
 arch/arm/mach-vexpress/include/mach/debug-macro.S |   37 ++++-
 arch/arm/mach-vexpress/include/mach/uncompress.h  |   13 ++-
 arch/arm/mach-vexpress/v2m.c                      |   64 +++++++-
 4 files changed, 309 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
arch/arm/boot/dts/vexpress-v2m-rs1.dtsi new file +201 -0
new file mode 100644
index 0000000..16076e2
@@ -0,0 +1,201 @@
+/*
+ * ARM Ltd. Versatile Express
+ *
+ * Motherboard Express uATX
+ * V2M-P1
+ *
+ * HBI-0190D
+ *
+ * RS1 memory map ("ARM Cortex-A Series memory map" in the board's
+ * Technical Reference Manual)
+ *
+ * WARNING! The hardware described in this file is independent from the
+ * original variant (vexpress-v2m.dtsi), but there is a strong
+ * correspondence between the two configurations.
+ *
+ * TAKE CARE WHEN MAINTAINING THIS FILE TO PROPAGATE ANY RELEVANT
+ * CHANGES TO vexpress-v2m.dtsi!
+ */
+
+/ {
+	aliases {
+		arm,v2m_timer = &v2m_timer01;
+	};
+
+	motherboard {
+		compatible = "simple-bus";
+		arm,v2m-memory-map = "rs1";
+		#address-cells = <2>; /* SMB chipselect number and offset */
+		#size-cells = <1>;
+		#interrupt-cells = <1>;
+
+		flash at 0,00000000 {
+			compatible = "arm,vexpress-flash", "cfi-flash";
+			reg = <0 0x00000000 0x04000000>,
+			      <4 0x00000000 0x04000000>;
+			bank-width = <4>;
+		};
+
+		psram at 1,00000000 {
+			compatible = "arm,vexpress-psram", "mtd-ram";
+			reg = <1 0x00000000 0x02000000>;
+			bank-width = <4>;
+		};
+
+		vram at 2,00000000 {
+			compatible = "arm,vexpress-vram";
+			reg = <2 0x00000000 0x00800000>;
+		};
+
+		ethernet at 2,02000000 {
+			compatible = "smsc,lan9118", "smsc,lan9115";
+			reg = <2 0x02000000 0x10000>;
+			interrupts = <15>;
+			phy-mode = "mii";
+			reg-io-width = <4>;
+			smsc,irq-active-high;
+			smsc,irq-push-pull;
+		};
+
+		usb at 2,03000000 {
+			compatible = "nxp,usb-isp1761";
+			reg = <2 0x03000000 0x20000>;
+			interrupts = <16>;
+			port1-otg;
+		};
+
+		iofpga at 3,00000000 {
+			compatible = "arm,amba-bus", "simple-bus";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 3 0 0x200000>;
+
+			sysreg at 010000 {
+				compatible = "arm,vexpress-sysreg";
+				reg = <0x010000 0x1000>;
+			};
+
+			sysctl at 020000 {
+				compatible = "arm,sp810", "arm,primecell";
+				reg = <0x020000 0x1000>;
+			};
+
+			/* PCI-E I2C bus */
+			v2m_i2c_pcie: i2c at 030000 {
+				compatible = "arm,versatile-i2c";
+				reg = <0x030000 0x1000>;
+
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				pcie-switch at 60 {
+					compatible = "idt,89hpes32h8";
+					reg = <0x60>;
+				};
+			};
+
+			aaci at 040000 {
+				compatible = "arm,pl041", "arm,primecell";
+				reg = <0x040000 0x1000>;
+				interrupts = <11>;
+			};
+
+			mmci at 050000 {
+				compatible = "arm,pl180", "arm,primecell";
+				reg = <0x050000 0x1000>;
+				interrupts = <9 10>;
+			};
+
+			kmi at 060000 {
+				compatible = "arm,pl050", "arm,primecell";
+				reg = <0x060000 0x1000>;
+				interrupts = <12>;
+			};
+
+			kmi at 070000 {
+				compatible = "arm,pl050", "arm,primecell";
+				reg = <0x070000 0x1000>;
+				interrupts = <13>;
+			};
+
+			v2m_serial0: uart at 090000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0x090000 0x1000>;
+				interrupts = <5>;
+			};
+
+			v2m_serial1: uart at 0a0000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0x0a0000 0x1000>;
+				interrupts = <6>;
+			};
+
+			v2m_serial2: uart at 0b0000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0x0b0000 0x1000>;
+				interrupts = <7>;
+			};
+
+			v2m_serial3: uart at 0c0000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0x0c0000 0x1000>;
+				interrupts = <8>;
+			};
+
+			wdt at 0f0000 {
+				compatible = "arm,sp805", "arm,primecell";
+				reg = <0x0f0000 0x1000>;
+				interrupts = <0>;
+			};
+
+			v2m_timer01: timer at 110000 {
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0x110000 0x1000>;
+				interrupts = <2>;
+			};
+
+			v2m_timer23: timer at 120000 {
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0x120000 0x1000>;
+			};
+
+			/* DVI I2C bus */
+			v2m_i2c_dvi: i2c at 160000 {
+				compatible = "arm,versatile-i2c";
+				reg = <0x160000 0x1000>;
+
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				dvi-transmitter at 39 {
+					compatible = "sil,sii9022-tpi", "sil,sii9022";
+					reg = <0x39>;
+				};
+
+				dvi-transmitter at 60 {
+					compatible = "sil,sii9022-cpi", "sil,sii9022";
+					reg = <0x60>;
+				};
+			};
+
+			rtc at 170000 {
+				compatible = "arm,pl031", "arm,primecell";
+				reg = <0x170000 0x1000>;
+				interrupts = <4>;
+			};
+
+			compact-flash at 1a0000 {
+				compatible = "arm,vexpress-cf", "ata-generic";
+				reg = <0x1a0000 0x100
+				       0x1a0100 0xf00>;
+				reg-shift = <2>;
+			};
+
+			clcd at 1f0000 {
+				compatible = "arm,pl111", "arm,primecell";
+				reg = <0x1f0000 0x1000>;
+				interrupts = <14>;
+			};
+		};
+	};
+};
arch/arm/mach-vexpress/include/mach/debug-macro.S +33 -4
index fd9e6c7..8010ff9 100644
@@ -10,12 +10,41 @@
  * published by the Free Software Foundation.
  */
 
-#define DEBUG_LL_UART_OFFSET	0x00009000
+#define DEBUG_LL_PHYS_BASE		0x10000000
+#define DEBUG_LL_UART_OFFSET		0x00009000
+
+#define DEBUG_LL_PHYS_BASE_RS1		0x1c000000
+#define DEBUG_LL_UART_OFFSET_RS1	0x00090000
+
+#define DEBUG_LL_VIRT_BASE		0xf8000000
 
 		.macro	addruart,rp,rv,tmp
-		mov	\rp, #DEBUG_LL_UART_OFFSET
-		orr	\rv, \rp, #0xf8000000	@ virtual base
-		orr	\rp, \rp, #0x10000000	@ physical base
+
+		@ Check the MMU state
+#if defined(CONFIG_MMU)
+		mrc	p15, 0, \tmp, c1, c0	@ SCTRL
+		tst	\tmp, #1		@ MMU enabled?
+		moveq	\tmp, #DEBUG_LL_PHYS_BASE
+		movne	\tmp, #DEBUG_LL_VIRT_BASE
+#else
+		mov	\tmp, #DEBUG_LL_PHYS_BASE
+#endif
+
+		@ PL011 present in "original" place?
+		orr	\tmp, \tmp, #DEBUG_LL_UART_OFFSET
+		ldr	\tmp, [\tmp, #0xfe0]	@ PeriphID0
+		teq	\tmp, #0x11		@ PL011
+
+		@ Original memory map
+		moveq	\rp, #DEBUG_LL_UART_OFFSET
+		orreq	\rv, \rp, #DEBUG_LL_VIRT_BASE
+		orreq	\rp, \rp, #DEBUG_LL_PHYS_BASE
+
+		@ RS1 memory map
+		movne	\rp, #DEBUG_LL_UART_OFFSET_RS1
+		orrne	\rv, \rp, #DEBUG_LL_VIRT_BASE
+		orrne	\rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
+
 		.endm
 
 #include <asm/hardware/debug-pl01x.S>
arch/arm/mach-vexpress/include/mach/uncompress.h +12 -1
index 7972c57..c491565 100644
@@ -22,7 +22,18 @@
 #define AMBA_UART_CR(base)	(*(volatile unsigned char *)((base) + 0x30))
 #define AMBA_UART_FR(base)	(*(volatile unsigned char *)((base) + 0x18))
 
-#define get_uart_base()	(0x10000000 + 0x00009000)
+#define AMBA_PERIPH_ID0(base)	(*(volatile unsigned char *)((base) + 0xfe0))
+
+#define UART_BASE	0x10009000
+#define UART_BASE_RS1	0x1c090000
+
+static unsigned long get_uart_base(void)
+{
+	if (AMBA_PERIPH_ID0(UART_BASE) == 0x11)
+		return UART_BASE;
+	else
+		return UART_BASE_RS1;
+}
 
 /*
  * This does not append a newline
arch/arm/mach-vexpress/v2m.c +63 -1

84 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#11 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

Quoted 3 lines · Pawel Moll

This patch adds support for RS1 memory map based Versatile Express motherboard.

[...]

Quoted 23 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +11 -4
@@ -10,12 +10,41 @@
  * published by the Free Software Foundation.
  */
 
-#define DEBUG_LL_UART_OFFSET	0x00009000
+#define DEBUG_LL_PHYS_BASE		0x10000000
+#define DEBUG_LL_UART_OFFSET		0x00009000
+
+#define DEBUG_LL_PHYS_BASE_RS1		0x1c000000
+#define DEBUG_LL_UART_OFFSET_RS1	0x00090000
+
+#define DEBUG_LL_VIRT_BASE		0xf8000000
 
 		.macro	addruart,rp,rv,tmp
-		mov	\rp, #DEBUG_LL_UART_OFFSET
-		orr	\rv, \rp, #0xf8000000	@ virtual base
-		orr	\rp, \rp, #0x10000000	@ physical base
+
+		@ Check the MMU state
+#if defined(CONFIG_MMU)
+		mrc	p15, 0, \tmp, c1, c0	@ SCTRL

arch/arm/mach-vexpress/include/mach/debug-macro.S line 35

Quoted 10 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +10 -0
+		tst	\tmp, #1		@ MMU enabled?
+		moveq	\tmp, #DEBUG_LL_PHYS_BASE
+		movne	\tmp, #DEBUG_LL_VIRT_BASE
+#else
+		mov	\tmp, #DEBUG_LL_PHYS_BASE
+#endif
+
+		@ PL011 present in "original" place?
+		orr	\tmp, \tmp, #DEBUG_LL_UART_OFFSET
+		ldr	\tmp, [\tmp, #0xfe0]	@ PeriphID0

This doesn't work with CONFIG_EARLY_PRINTK=y on a system with the RS1
memory map. __create_page_tables has only mapped the single physical
page at 0x1c090000 and thus the test for the UART in the other memory map faults.

I made it work with this hack, but I'm not sure what the correct solution would be.

(quoted diff) +0 -0

b/arch/arm/mach-vexpress/include/mach/debug-macro.S index 8010ff9..af443b4 100644

arch/arm/mach-vexpress/include/mach/debug-macro.S +6 -4
@@ -30,6 +30,7 @@
 		mov	\tmp, #DEBUG_LL_PHYS_BASE
 #endif
 
+#if 0
 		@ PL011 present in "original" place?
 		orr	\tmp, \tmp, #DEBUG_LL_UART_OFFSET
 		ldr	\tmp, [\tmp, #0xfe0]	@ PeriphID0
@@ -39,11 +40,12 @@
 		moveq	\rp, #DEBUG_LL_UART_OFFSET
 		orreq	\rv, \rp, #DEBUG_LL_VIRT_BASE
 		orreq	\rp, \rp, #DEBUG_LL_PHYS_BASE
+#endif
 
-		@ RS1 memory map
-		movne	\rp, #DEBUG_LL_UART_OFFSET_RS1
-		orrne	\rv, \rp, #DEBUG_LL_VIRT_BASE
-		orrne	\rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
+       		@ RS1 memory map
+		mov	\rp, #DEBUG_LL_UART_OFFSET_RS1
+		mov	\rv, \rp, #DEBUG_LL_VIRT_BASE
+		orr	\rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
 
 		.endm
 
Quoted 5 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +5 -0
+		teq	\tmp, #0x11		@ PL011
+
+		@ Original memory map
+		moveq	\rp, #DEBUG_LL_UART_OFFSET
+		orreq	\rv, \rp, #DEBUG_LL_VIRT_BASE

arch/arm/mach-vexpress/include/mach/debug-macro.S line 50

Quoted 10 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +7 -0
+		orreq	\rp, \rp, #DEBUG_LL_PHYS_BASE
+
+		@ RS1 memory map
+		movne	\rp, #DEBUG_LL_UART_OFFSET_RS1
+		orrne	\rv, \rp, #DEBUG_LL_VIRT_BASE
+		orrne	\rp, \rp, #DEBUG_LL_PHYS_BASE_RS1
+
 		.endm
 
 #include <asm/hardware/debug-pl01x.S>

David

author
#12 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

Hi,

Sorry about loooong delay - I've been on holiday.

Quoted 33 lines · David Vrabel
Quoted 3 lines · Pawel Moll

This patch adds support for RS1 memory map based Versatile Express motherboard.

[...]

Quoted 28 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +16 -4
@@ -10,12 +10,41 @@
  * published by the Free Software Foundation.
  */
 
-#define DEBUG_LL_UART_OFFSET	0x00009000
+#define DEBUG_LL_PHYS_BASE		0x10000000
+#define DEBUG_LL_UART_OFFSET		0x00009000
+
+#define DEBUG_LL_PHYS_BASE_RS1		0x1c000000
+#define DEBUG_LL_UART_OFFSET_RS1	0x00090000
+
+#define DEBUG_LL_VIRT_BASE		0xf8000000
 
 		.macro	addruart,rp,rv,tmp
-		mov	\rp, #DEBUG_LL_UART_OFFSET
-		orr	\rv, \rp, #0xf8000000	@ virtual base
-		orr	\rp, \rp, #0x10000000	@ physical base
+
+		@ Check the MMU state
+#if defined(CONFIG_MMU)
+		mrc	p15, 0, \tmp, c1, c0	@ SCTRL
+		tst	\tmp, #1		@ MMU enabled?
+		moveq	\tmp, #DEBUG_LL_PHYS_BASE
+		movne	\tmp, #DEBUG_LL_VIRT_BASE
+#else
+		mov	\tmp, #DEBUG_LL_PHYS_BASE
Quoted 8 lines

arch/arm/mach-vexpress/include/mach/debug-macro.S line 35

Quoted 5 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +5 -0
+#endif
+
+		@ PL011 present in "original" place?
+		orr	\tmp, \tmp, #DEBUG_LL_UART_OFFSET
+		ldr	\tmp, [\tmp, #0xfe0]	@ PeriphID0

This doesn't work with CONFIG_EARLY_PRINTK=y on a system with the RS1 memory map.

It does for me:

# zcat /proc/config.gz | grep EARLY_PRINTK
CONFIG_EARLY_PRINTK=y
# cat /proc/device-tree/motherboard/arm,v2m-memory-map && echo
rs1     
#

Can you tell me what exactly is going wrong in your case? Does it hang without any warning? Do you get at least part of the boot log? Can you send me (privately probably) your kernel config?

Quoted 3 lines

__create_page_tables has only mapped the single physical
page at 0x1c090000 and thus the test for the UART in the other memory map faults.

I investigated this when writing the code and I vaguely remember it was fine, partly by accident. I'll dig in again and let you know my findings.

Thanks for trying this out!

Pawe?

#13 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

Quoted 47 lines · Pawel Moll

Hi,

Sorry about loooong delay - I've been on holiday.

Quoted 33 lines · David Vrabel
Quoted 3 lines · Pawel Moll

This patch adds support for RS1 memory map based Versatile Express motherboard.

[...]

Quoted 28 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +16 -4
@@ -10,12 +10,41 @@
  * published by the Free Software Foundation.
  */
 
-#define DEBUG_LL_UART_OFFSET	0x00009000
+#define DEBUG_LL_PHYS_BASE		0x10000000
+#define DEBUG_LL_UART_OFFSET		0x00009000
+
+#define DEBUG_LL_PHYS_BASE_RS1		0x1c000000
+#define DEBUG_LL_UART_OFFSET_RS1	0x00090000
+
+#define DEBUG_LL_VIRT_BASE		0xf8000000
 
 		.macro	addruart,rp,rv,tmp
-		mov	\rp, #DEBUG_LL_UART_OFFSET
-		orr	\rv, \rp, #0xf8000000	@ virtual base
-		orr	\rp, \rp, #0x10000000	@ physical base
+
+		@ Check the MMU state
+#if defined(CONFIG_MMU)
+		mrc	p15, 0, \tmp, c1, c0	@ SCTRL
+		tst	\tmp, #1		@ MMU enabled?
+		moveq	\tmp, #DEBUG_LL_PHYS_BASE
+		movne	\tmp, #DEBUG_LL_VIRT_BASE
+#else
+		mov	\tmp, #DEBUG_LL_PHYS_BASE
Quoted 8 lines

arch/arm/mach-vexpress/include/mach/debug-macro.S line 35

Quoted 5 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +5 -0
+#endif
+
+		@ PL011 present in "original" place?
+		orr	\tmp, \tmp, #DEBUG_LL_UART_OFFSET
+		ldr	\tmp, [\tmp, #0xfe0]	@ PeriphID0

This doesn't work with CONFIG_EARLY_PRINTK=y on a system with the RS1 memory map.

Quoted 7 lines

It does for me:

# zcat /proc/config.gz | grep EARLY_PRINTK
CONFIG_EARLY_PRINTK=y
# cat /proc/device-tree/motherboard/arm,v2m-memory-map && echo
rs1     
#

earlyprintk needs to be on the kernel command line to enable it. Without this option it will work fine.

Quoted 3 lines

Can you tell me what exactly is going wrong in your case? Does it hang without any warning? Do you get at least part of the boot log? Can you send me (privately probably) your kernel config?

The only output is from the zImage decompressor.

It's a synchronous data fault and DFAR is 0xf8009fe0.

Quoted 7 lines
Quoted 3 lines

__create_page_tables has only mapped the single physical
page at 0x1c090000 and thus the test for the UART in the other memory map faults.

I investigated this when writing the code and I vaguely remember it was fine, partly by accident. I'll dig in again and let you know my findings.

It's also a problem when running as a guest under a hypervisor as there won't be any stage 2 translation table entries for non-existent peripherals.

I think there needs to be someway of finding out from the DTB which UART to use.

David

author
#14 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

Quoted 10 lines · David Vrabel
Quoted 7 lines

It does for me:

# zcat /proc/config.gz | grep EARLY_PRINTK
CONFIG_EARLY_PRINTK=y
# cat /proc/device-tree/motherboard/arm,v2m-memory-map && echo
rs1     
#

earlyprintk needs to be on the kernel command line to enable it. Without this option it will work fine.

# cat /proc/cmdline
console=ttyAMA0,38400 earlyprintk rootwait root=/dev/mmcblk0p2 mmci.fmax=12000000 debug

I'll investigate the matter to the bottom, though. Your kernel config would be helpful, thanks!

Quoted 5 lines

It's also a problem when running as a guest under a hypervisor as there won't be any stage 2 translation table entries for non-existent peripherals.

I think there needs to be someway of finding out from the DTB which UART to use.

Yess... The DT+earlyprintk problem was discussed several times already, without any happy resolution so far...

Pawe?

author
#15 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

In reply to David Vrabel
Quoted 3 lines · David Vrabel
Quoted 3 lines
Quoted 3 lines

__create_page_tables has only mapped the single physical
page at 0x1c090000 and thus the test for the UART in the other memory map faults.

I got to the bottom of the problem... The mapping created by the DEBUG_LL code in __create_page_tables is actually a section (1MB) so covers both possible accesses (0xf8009000 and 0xf8090000). The difference between model and hardware is that "real" RS1 VE has a DAP ROM located between 0xf8000000 and 0xf800ffff so the 0xf8009000 succeeds (returning some irrelevant data), while model is "empty" in that space, so it faults.

Anyway, I have an idea how to solve (or rather work around) the problem and will get if working on models in the next version of the series. I'll send you a modified version of the relevant patch before that so you can test it.

Thanks for your time!

Pawe?

#16 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

Quoted 13 lines · Pawel Moll
Quoted 3 lines · David Vrabel
Quoted 3 lines
Quoted 3 lines

__create_page_tables has only mapped the single physical
page at 0x1c090000 and thus the test for the UART in the other memory map faults.

I got to the bottom of the problem... The mapping created by the DEBUG_LL code in __create_page_tables is actually a section (1MB) so covers both possible accesses (0xf8009000 and 0xf8090000). The difference between model and hardware is that "real" RS1 VE has a DAP ROM located between 0xf8000000 and 0xf800ffff so the 0xf8009000 succeeds (returning some irrelevant data), while model is "empty" in that space, so it faults.

Quoted 6 lines

Anyway, I have an idea how to solve (or rather work around) the problem and will get if working on models in the next version of the series. I'll send you a modified version of the relevant patch before that so you can test it.

Thanks for your time!

I would be interested in that too.

However, I would still prefer the explicit debug UART selection route, since we already have to do that for many boards and I'm not sure how much I trust the memory maps of future tiles and models to "evolve" relative to what currently exists. Are you sure it won't change again?

If we rely on lucky arrangement of slaves on the bus in order to have a workaround, sooner or later our luck is liable to run out.

Cheers
---Dave

#17 lore raw

PATCH v6 6/9 ARM: vexpress: Motherboard RS1 memory map support

In reply to Pawel Moll
Quoted 55 lines · Pawel Moll

Hi,

Sorry about loooong delay - I've been on holiday.

Quoted 33 lines · David Vrabel
Quoted 3 lines · Pawel Moll

This patch adds support for RS1 memory map based Versatile Express motherboard.

[...]

Quoted 28 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +16 -4
@@ -10,12 +10,41 @@
  * published by the Free Software Foundation.
  */
 
-#define DEBUG_LL_UART_OFFSET	0x00009000
+#define DEBUG_LL_PHYS_BASE		0x10000000
+#define DEBUG_LL_UART_OFFSET		0x00009000
+
+#define DEBUG_LL_PHYS_BASE_RS1		0x1c000000
+#define DEBUG_LL_UART_OFFSET_RS1	0x00090000
+
+#define DEBUG_LL_VIRT_BASE		0xf8000000
 
 		.macro	addruart,rp,rv,tmp
-		mov	\rp, #DEBUG_LL_UART_OFFSET
-		orr	\rv, \rp, #0xf8000000	@ virtual base
-		orr	\rp, \rp, #0x10000000	@ physical base
+
+		@ Check the MMU state
+#if defined(CONFIG_MMU)
+		mrc	p15, 0, \tmp, c1, c0	@ SCTRL
+		tst	\tmp, #1		@ MMU enabled?
+		moveq	\tmp, #DEBUG_LL_PHYS_BASE
+		movne	\tmp, #DEBUG_LL_VIRT_BASE
+#else
+		mov	\tmp, #DEBUG_LL_PHYS_BASE
Quoted 8 lines

arch/arm/mach-vexpress/include/mach/debug-macro.S line 35

Quoted 5 lines
arch/arm/mach-vexpress/include/mach/debug-macro.S +5 -0
+#endif
+
+		@ PL011 present in "original" place?
+		orr	\tmp, \tmp, #DEBUG_LL_UART_OFFSET
+		ldr	\tmp, [\tmp, #0xfe0]	@ PeriphID0

This doesn't work with CONFIG_EARLY_PRINTK=y on a system with the RS1 memory map.

It does for me:

# zcat /proc/config.gz | grep EARLY_PRINTK
CONFIG_EARLY_PRINTK=y
# cat /proc/device-tree/motherboard/arm,v2m-memory-map && echo
rs1     
#
Quoted 3 lines

Can you tell me what exactly is going wrong in your case? Does it hang without any warning? Do you get at least part of the boot log? Can you send me (privately probably) your kernel config?

I had to disable this when running on the ARM fast model with your vexpress DT series. I didn't debug into exactly why I had to disable it, but I think I was getting aborts when the kernel was probing for nonexistent legacy memory map location of the UART. I don't know whether this will affect real hardware though... and maybe I was hitting the problem due to something else.

Anyway unless I've misunderstood something, AMBA devices are only really probable if there is some real bus slave at the probed address, which is free from nasty side-effects.

Really we should have a way for getting this info from the device tree, yada yada. (Repeating myself here, I know)

In the meantime, I don't see a practical alternative to adding distinct lowlevel debug UART selection options for the two memory maps ...?

Cheers
---Dave

author
#18 lore raw

PATCH v6 7/9 ARM: vexpress: Add Device Tree for V2P-CA5s core tile

In reply to Pawel Moll

This patch adds Device Tree file for the CoreTile Express A5x2 (V2P-CA5s).

---
 arch/arm/boot/dts/vexpress-v2p-ca5s.dts |  160 +++++++++++++++++++++++++++++++
 arch/arm/mach-vexpress/Makefile.boot    |    2 +
 2 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca5s.dts
arch/arm/boot/dts/vexpress-v2p-ca5s.dts new file +160 -0
new file mode 100644
index 0000000..da26a13
@@ -0,0 +1,160 @@
+/*
+ * ARM Ltd. Versatile Express
+ *
+ * CoreTile Express A5x2
+ * Cortex-A5 MPCore (V2P-CA5s)
+ *
+ * HBI-0225B
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "V2P-CA5s";
+	arm,hbi = <0x225>;
+	compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
+	interrupt-parent = <&gic>;
+
+	aliases {
+		serial0 = &v2m_serial0;
+		serial1 = &v2m_serial1;
+		serial2 = &v2m_serial2;
+		serial3 = &v2m_serial3;
+		i2c0 = &v2m_i2c_dvi;
+		i2c1 = &v2m_i2c_pcie;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <0>;
+			next-level-cache = <&L2>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a5";
+			reg = <1>;
+			next-level-cache = <&L2>;
+		};
+	};
+
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x40000000>;
+	};
+
+	hdlcd at 2a110000 {
+		compatible = "arm,hdlcd";
+		reg = <0x2a110000 0x1000>;
+		interrupts = <0 85 4>;
+	};
+
+	memory-controller at 2a150000 {
+		compatible = "arm,pl341", "arm,primecell";
+		reg = <0x2a150000 0x1000>;
+	};
+
+	memory-controller at 2a190000 {
+		compatible = "arm,pl354", "arm,primecell";
+		reg = <0x2a190000 0x1000>;
+		interrupts = <0 86 4>,
+			     <0 87 4>;
+	};
+
+	scu at 2c000000 {
+		compatible = "arm,cortex-a9-scu";
+		reg = <0x2c000000 0x58>;
+	};
+
+	timer at 2c000600 {
+		compatible = "arm,smp-twd";
+		reg = <0x2c000600 0x38>;
+		interrupts = <1 2 0x304>,
+			     <1 3 0x304>;
+	};
+
+	gic: interrupt-controller at 2c001000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0x2c001000 0x1000>,
+		      <0x2c000100 0x100>;
+	};
+
+	L2: cache-controller at 2c0f0000 {
+		compatible = "arm,pl310-cache";
+		reg = <0x2c0f0000 0x1000>;
+		interrupts = <0 84 4>;
+		cache-level = <2>;
+	};
+
+	pmu {
+		compatible = "arm,cortex-a9-pmu";
+		interrupts = <0 68 4>,
+			     <0 69 4>;
+	};
+
+	motherboard {
+		ranges = <0 0 0x08000000 0x04000000>,
+			 <1 0 0x14000000 0x04000000>,
+			 <2 0 0x18000000 0x04000000>,
+			 <3 0 0x1c000000 0x04000000>,
+			 <4 0 0x0c000000 0x04000000>,
+			 <5 0 0x10000000 0x04000000>;
+
+		interrupt-map-mask = <0 0 63>;
+		interrupt-map = <0 0  0 &gic 0  0 4>,
+				<0 0  1 &gic 0  1 4>,
+				<0 0  2 &gic 0  2 4>,
+				<0 0  3 &gic 0  3 4>,
+				<0 0  4 &gic 0  4 4>,
+				<0 0  5 &gic 0  5 4>,
+				<0 0  6 &gic 0  6 4>,
+				<0 0  7 &gic 0  7 4>,
+				<0 0  8 &gic 0  8 4>,
+				<0 0  9 &gic 0  9 4>,
+				<0 0 10 &gic 0 10 4>,
+				<0 0 11 &gic 0 11 4>,
+				<0 0 12 &gic 0 12 4>,
+				<0 0 13 &gic 0 13 4>,
+				<0 0 14 &gic 0 14 4>,
+				<0 0 15 &gic 0 15 4>,
+				<0 0 16 &gic 0 16 4>,
+				<0 0 17 &gic 0 17 4>,
+				<0 0 18 &gic 0 18 4>,
+				<0 0 19 &gic 0 19 4>,
+				<0 0 20 &gic 0 20 4>,
+				<0 0 21 &gic 0 21 4>,
+				<0 0 22 &gic 0 22 4>,
+				<0 0 23 &gic 0 23 4>,
+				<0 0 24 &gic 0 24 4>,
+				<0 0 25 &gic 0 25 4>,
+				<0 0 26 &gic 0 26 4>,
+				<0 0 27 &gic 0 27 4>,
+				<0 0 28 &gic 0 28 4>,
+				<0 0 29 &gic 0 29 4>,
+				<0 0 30 &gic 0 30 4>,
+				<0 0 31 &gic 0 31 4>,
+				<0 0 32 &gic 0 32 4>,
+				<0 0 33 &gic 0 33 4>,
+				<0 0 34 &gic 0 34 4>,
+				<0 0 35 &gic 0 35 4>,
+				<0 0 36 &gic 0 36 4>,
+				<0 0 37 &gic 0 37 4>,
+				<0 0 38 &gic 0 38 4>,
+				<0 0 39 &gic 0 39 4>,
+				<0 0 40 &gic 0 40 4>,
+				<0 0 41 &gic 0 41 4>,
+				<0 0 42 &gic 0 42 4>;
+	};
+};
+
+/include/ "vexpress-v2m-rs1.dtsi"
arch/arm/mach-vexpress/Makefile.boot +2 -0
index c6dd891..5e2177e 100644
@@ -3,3 +3,5 @@
    zreladdr-y	+= 0x60008000
 params_phys-y	:= 0x60000100
 initrd_phys-y	:= 0x60800000
+
+dtb-$(CONFIG_ARCH_VEXPRESS_DT)	+= vexpress-v2p-ca5s.dtb
Signature · 1 line
1.7.5.4
author
#19 lore raw

PATCH v6 8/9 ARM: vexpress: Add Device Tree for V2P-CA9 core tile

In reply to Pawel Moll

This patch adds Device Tree file for the CoreTile Express A9x4 (V2P-CA9).

---
 arch/arm/boot/dts/vexpress-v2p-ca9.dts |  190 ++++++++++++++++++++++++++++++++
 arch/arm/mach-vexpress/Makefile.boot   |    3 +-
 2 files changed, 192 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca9.dts
arch/arm/boot/dts/vexpress-v2p-ca9.dts new file +190 -0
new file mode 100644
index 0000000..84542e7
@@ -0,0 +1,190 @@
+/*
+ * ARM Ltd. Versatile Express
+ *
+ * CoreTile Express A9x4
+ * Cortex-A9 MPCore (V2P-CA9)
+ *
+ * HBI-0191B
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "V2P-CA9";
+	arm,hbi = <0x191>;
+	compatible = "arm,vexpress,v2p-ca9", "arm,vexpress";
+	interrupt-parent = <&gic>;
+
+	aliases {
+		serial0 = &v2m_serial0;
+		serial1 = &v2m_serial1;
+		serial2 = &v2m_serial2;
+		serial3 = &v2m_serial3;
+		i2c0 = &v2m_i2c_dvi;
+		i2c1 = &v2m_i2c_pcie;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0>;
+			next-level-cache = <&L2>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <1>;
+			next-level-cache = <&L2>;
+		};
+
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <2>;
+			next-level-cache = <&L2>;
+		};
+
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <3>;
+			next-level-cache = <&L2>;
+		};
+	};
+
+	memory at 60000000 {
+		device_type = "memory";
+		reg = <0x60000000 0x40000000>;
+	};
+
+	clcd at 10020000 {
+		compatible = "arm,pl111", "arm,primecell";
+		reg = <0x10020000 0x1000>;
+		interrupts = <0 44 4>;
+	};
+
+	memory-controller at 100e0000 {
+		compatible = "arm,pl341", "arm,primecell";
+		reg = <0x100e0000 0x1000>;
+	};
+
+	memory-controller at 100e1000 {
+		compatible = "arm,pl354", "arm,primecell";
+		reg = <0x100e1000 0x1000>;
+		interrupts = <0 45 4>,
+			     <0 46 4>;
+	};
+
+	timer at 100e4000 {
+		compatible = "arm,sp804", "arm,primecell";
+		reg = <0x100e4000 0x1000>;
+		interrupts = <0 48 4>,
+			     <0 49 4>;
+	};
+
+	watchdog at 100e5000 {
+		compatible = "arm,sp805", "arm,primecell";
+		reg = <0x100e5000 0x1000>;
+		interrupts = <0 51 4>;
+	};
+
+	scu at 1e000000 {
+		compatible = "arm,cortex-a9-scu";
+		reg = <0x1e000000 0x58>;
+	};
+
+	timer at 1e000600 {
+		compatible = "arm,smp-twd";
+		reg = <0x1e000600 0x20>;
+		interrupts = <1 2 0xf04>,
+			     <1 3 0xf04>;
+	};
+
+	gic: interrupt-controller at 1e001000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0x1e001000 0x1000>,
+		      <0x1e000100 0x100>;
+	};
+
+	L2: cache-controller at 1e00a000 {
+		compatible = "arm,pl310-cache";
+		reg = <0x1e00a000 0x1000>;
+		interrupts = <0 43 4>;
+		cache-level = <2>;
+		arm,data-latency = <1 1 1>;
+		arm,tag-latency = <1 1 1>;
+	};
+
+	pmu {
+		compatible = "arm,cortex-a9-pmu";
+		interrupts = <0 60 4>,
+			     <0 61 4>,
+			     <0 62 4>,
+			     <0 63 4>;
+	};
+
+	motherboard {
+		ranges = <0 0 0x40000000 0x04000000>,
+			 <1 0 0x44000000 0x04000000>,
+			 <2 0 0x48000000 0x04000000>,
+			 <3 0 0x4c000000 0x04000000>,
+			 <7 0 0x10000000 0x00020000>;
+
+		interrupt-map-mask = <0 0 63>;
+		interrupt-map = <0 0  0 &gic 0  0 4>,
+				<0 0  1 &gic 0  1 4>,
+				<0 0  2 &gic 0  2 4>,
+				<0 0  3 &gic 0  3 4>,
+				<0 0  4 &gic 0  4 4>,
+				<0 0  5 &gic 0  5 4>,
+				<0 0  6 &gic 0  6 4>,
+				<0 0  7 &gic 0  7 4>,
+				<0 0  8 &gic 0  8 4>,
+				<0 0  9 &gic 0  9 4>,
+				<0 0 10 &gic 0 10 4>,
+				<0 0 11 &gic 0 11 4>,
+				<0 0 12 &gic 0 12 4>,
+				<0 0 13 &gic 0 13 4>,
+				<0 0 14 &gic 0 14 4>,
+				<0 0 15 &gic 0 15 4>,
+				<0 0 16 &gic 0 16 4>,
+				<0 0 17 &gic 0 17 4>,
+				<0 0 18 &gic 0 18 4>,
+				<0 0 19 &gic 0 19 4>,
+				<0 0 20 &gic 0 20 4>,
+				<0 0 21 &gic 0 21 4>,
+				<0 0 22 &gic 0 22 4>,
+				<0 0 23 &gic 0 23 4>,
+				<0 0 24 &gic 0 24 4>,
+				<0 0 25 &gic 0 25 4>,
+				<0 0 26 &gic 0 26 4>,
+				<0 0 27 &gic 0 27 4>,
+				<0 0 28 &gic 0 28 4>,
+				<0 0 29 &gic 0 29 4>,
+				<0 0 30 &gic 0 30 4>,
+				<0 0 31 &gic 0 31 4>,
+				<0 0 32 &gic 0 32 4>,
+				<0 0 33 &gic 0 33 4>,
+				<0 0 34 &gic 0 34 4>,
+				<0 0 35 &gic 0 35 4>,
+				<0 0 36 &gic 0 36 4>,
+				<0 0 37 &gic 0 37 4>,
+				<0 0 38 &gic 0 38 4>,
+				<0 0 39 &gic 0 39 4>,
+				<0 0 40 &gic 0 40 4>,
+				<0 0 41 &gic 0 41 4>,
+				<0 0 42 &gic 0 42 4>;
+	};
+};
+
+/include/ "vexpress-v2m.dtsi"
arch/arm/mach-vexpress/Makefile.boot +2 -1
index 5e2177e..2f0ad9f 100644
@@ -4,4 +4,5 @@
 params_phys-y	:= 0x60000100
 initrd_phys-y	:= 0x60800000
 
-dtb-$(CONFIG_ARCH_VEXPRESS_DT)	+= vexpress-v2p-ca5s.dtb
+dtb-$(CONFIG_ARCH_VEXPRESS_DT)	+= vexpress-v2p-ca5s.dtb \
+				   vexpress-v2p-ca9.dtb
Signature · 1 line
1.7.5.4
author
#20 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

In reply to Pawel Moll

This patch adds Device Tree file for the CoreTile Express A15x2 (V2P-CA15) with Test Chip 1.

As the chip's GIC has 160 interrupt inputs and equivalent SMM (FPGA) has GIC synthesised with 256 interrupts, NR_IRQS is increased.

---
 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts |  155 +++++++++++++++++++++++++++
 arch/arm/mach-vexpress/Makefile.boot        |    3 +-
 arch/arm/mach-vexpress/include/mach/irqs.h  |    2 +-
 3 files changed, 158 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +155 -0
new file mode 100644
index 0000000..02cada5
@@ -0,0 +1,155 @@
+/*
+ * ARM Ltd. Versatile Express
+ *
+ * CoreTile Express A15x2 (version with Test Chip 1)
+ * Cortex-A15 MPCore (V2P-CA15)
+ *
+ * HBI-0237A
+ */
+
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "V2P-CA15";
+	arm,hbi = <0x237>;
+	compatible = "arm,vexpress,v2p-ca15,tc1", "arm,vexpress,v2p-ca15", "arm,vexpress";
+	interrupt-parent = <&gic>;
+
+	aliases {
+		serial0 = &v2m_serial0;
+		serial1 = &v2m_serial1;
+		serial2 = &v2m_serial2;
+		serial3 = &v2m_serial3;
+		i2c0 = &v2m_i2c_dvi;
+		i2c1 = &v2m_i2c_pcie;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a15";
+			reg = <0>;
+		};
+
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a15";
+			reg = <1>;
+		};
+	};
+
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x40000000>;
+	};
+
+	hdlcd at 2b000000 {
+		compatible = "arm,hdlcd";
+		reg = <0x2b000000 0x1000>;
+		interrupts = <0 85 4>;
+	};
+
+	memory-controller at 2b0a0000 {
+		compatible = "arm,pl341", "arm,primecell";
+		reg = <0x2b0a0000 0x1000>;
+	};
+
+	wdt at 2b060000 {
+		compatible = "arm,sp805", "arm,primecell";
+		reg = <0x2b060000 0x1000>;
+		interrupts = <98>;
+	};
+
+	gic: interrupt-controller at 2c001000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0x2c001000 0x1000>,
+		      <0x2c002000 0x100>;
+	};
+
+	memory-controller at 7ffd0000 {
+		compatible = "arm,pl354", "arm,primecell";
+		reg = <0x7ffd0000 0x1000>;
+		interrupts = <0 86 4>,
+			     <0 87 4>;
+	};
+
+	dma at 7ffb0000 {
+		compatible = "arm,pl330", "arm,primecell";
+		reg = <0x7ffb0000 0x1000>;
+		interrupts = <0 92 4>,
+			     <0 88 4>,
+			     <0 89 4>,
+			     <0 90 4>,
+			     <0 91 4>;
+	};
+
+	pmu {
+		compatible = "arm,cortex-a9-pmu";
+		interrupts = <0 68 4>,
+			     <0 69 4>;
+	};
+
+	motherboard {
+		ranges = <0 0 0x08000000 0x04000000>,
+			 <1 0 0x14000000 0x04000000>,
+			 <2 0 0x18000000 0x04000000>,
+			 <3 0 0x1c000000 0x04000000>,
+			 <4 0 0x0c000000 0x04000000>,
+			 <5 0 0x10000000 0x04000000>;
+
+		interrupt-map-mask = <0 0 63>;
+		interrupt-map = <0 0  0 &gic 0  0 4>,
+				<0 0  1 &gic 0  1 4>,
+				<0 0  2 &gic 0  2 4>,
+				<0 0  3 &gic 0  3 4>,
+				<0 0  4 &gic 0  4 4>,
+				<0 0  5 &gic 0  5 4>,
+				<0 0  6 &gic 0  6 4>,
+				<0 0  7 &gic 0  7 4>,
+				<0 0  8 &gic 0  8 4>,
+				<0 0  9 &gic 0  9 4>,
+				<0 0 10 &gic 0 10 4>,
+				<0 0 11 &gic 0 11 4>,
+				<0 0 12 &gic 0 12 4>,
+				<0 0 13 &gic 0 13 4>,
+				<0 0 14 &gic 0 14 4>,
+				<0 0 15 &gic 0 15 4>,
+				<0 0 16 &gic 0 16 4>,
+				<0 0 17 &gic 0 17 4>,
+				<0 0 18 &gic 0 18 4>,
+				<0 0 19 &gic 0 19 4>,
+				<0 0 20 &gic 0 20 4>,
+				<0 0 21 &gic 0 21 4>,
+				<0 0 22 &gic 0 22 4>,
+				<0 0 23 &gic 0 23 4>,
+				<0 0 24 &gic 0 24 4>,
+				<0 0 25 &gic 0 25 4>,
+				<0 0 26 &gic 0 26 4>,
+				<0 0 27 &gic 0 27 4>,
+				<0 0 28 &gic 0 28 4>,
+				<0 0 29 &gic 0 29 4>,
+				<0 0 30 &gic 0 30 4>,
+				<0 0 31 &gic 0 31 4>,
+				<0 0 32 &gic 0 32 4>,
+				<0 0 33 &gic 0 33 4>,
+				<0 0 34 &gic 0 34 4>,
+				<0 0 35 &gic 0 35 4>,
+				<0 0 36 &gic 0 36 4>,
+				<0 0 37 &gic 0 37 4>,
+				<0 0 38 &gic 0 38 4>,
+				<0 0 39 &gic 0 39 4>,
+				<0 0 40 &gic 0 40 4>,
+				<0 0 41 &gic 0 41 4>,
+				<0 0 42 &gic 0 42 4>;
+	};
+};
+
+/include/ "vexpress-v2m-rs1.dtsi"
arch/arm/mach-vexpress/Makefile.boot +2 -1
index 2f0ad9f..909f85e 100644
@@ -5,4 +5,5 @@ params_phys-y	:= 0x60000100
 initrd_phys-y	:= 0x60800000
 
 dtb-$(CONFIG_ARCH_VEXPRESS_DT)	+= vexpress-v2p-ca5s.dtb \
-				   vexpress-v2p-ca9.dtb
+				   vexpress-v2p-ca9.dtb \
+				   vexpress-v2p-ca15-tc1.dtb
arch/arm/mach-vexpress/include/mach/irqs.h +1 -1
index 7054cbf..4b10ee7 100644
@@ -1,4 +1,4 @@
 #define IRQ_LOCALTIMER		29
 #define IRQ_LOCALWDOG		30
 
-#define NR_IRQS	128
+#define NR_IRQS	256
Signature · 1 line
1.7.5.4
#21 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 2 lines · Pawel Moll

This patch adds Device Tree file for the CoreTile Express A15x2 (V2P-CA15) with Test Chip 1.

This doesn't work as-is with the software model as accessing some of the peripherals that aren't modeled will cause an exception. Is it worth having a device tree file suitable for the models? Or are the models too configurable for this to be workable?

Quoted 4 lines

As the chip's GIC has 160 interrupt inputs and equivalent SMM (FPGA) has GIC synthesised with 256 interrupts, NR_IRQS is increased.

[...]

Quoted 2 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +0 -0

[...]

arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts

Quoted 4 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +4 -0
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x40000000>;
+	};

If CONFIG_ARM_ATAG_DTB_COMPAT is enabled the device tree will end up with two nodes describing the memory ("memory" and "memory at 80000000" in this case).

Quoted 1 line

From 22cc6a3410077b99d81e42c4d7f4e29eab6070e3 Mon Sep 17 00:00:00 2001

From: David Vrabel <[email protected]>
Date: Mon, 9 Jan 2012 16:13:19 +0000
Subject: [PATCH] ARM: vexpress: rename device tree "memory at ..." nodes to "memory"

If CONFIG_ARM_ATAG_DTB_COMPAT enabled it expects the memory information to be in a node named "memory". If the memory is described in a different node, the device tree will end up with two nodes describing the memory.

---
 arch/arm/boot/dts/vexpress-v2p-aem-v7a.dts  |    2 +-
 arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts |    2 +-
 arch/arm/boot/dts/vexpress-v2p-ca5s.dts     |    2 +-
 arch/arm/boot/dts/vexpress-v2p-ca9.dts      |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm/boot/dts/vexpress-v2p-aem-v7a.dts
index 064132e..6667936 100644

arch/arm/boot/dts/vexpress-v2p-aem-v7a.dts +1 -1
@@ -33,7 +33,7 @@
 		};
 	};
 
-	memory at 80000000 {
+	memory {
 		device_type = "memory";
 		reg = <0x80000000 0x40000000>;
 	};
(quoted diff) +0 -0

b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
index 02cada5..0d82ac8 100644

arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts +1 -1
@@ -43,7 +43,7 @@
 		};
 	};
 
-	memory at 80000000 {
+	memory {
 		device_type = "memory";
 		reg = <0x80000000 0x40000000>;
 	};
(quoted diff) +0 -0

b/arch/arm/boot/dts/vexpress-v2p-ca5s.dts
index da26a13..e4c3935 100644

arch/arm/boot/dts/vexpress-v2p-ca5s.dts +1 -1
@@ -45,7 +45,7 @@
 		};
 	};
 
-	memory at 80000000 {
+	memory {
 		device_type = "memory";
 		reg = <0x80000000 0x40000000>;
 	};
(quoted diff) +0 -0

b/arch/arm/boot/dts/vexpress-v2p-ca9.dts
index 84542e7..d4aa1cc 100644

arch/arm/boot/dts/vexpress-v2p-ca9.dts +1 -1
@@ -59,7 +59,7 @@
 		};
 	};
 
-	memory at 60000000 {
+	memory {
 		device_type = "memory";
 		reg = <0x60000000 0x40000000>;
 	};
Signature · 3 lines
1.7.2.5

David
author
#22 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 8 lines · David Vrabel
Quoted 2 lines · Pawel Moll

This patch adds Device Tree file for the CoreTile Express A15x2 (V2P-CA15) with Test Chip 1.

This doesn't work as-is with the software model as accessing some of the peripherals that aren't modeled will cause an exception. Is it worth having a device tree file suitable for the models? Or are the models too configurable for this to be workable?

The model as you have it doesn't exactly represent the board for a number of reasons, mainly because there was no hardware design when the model was created, so some of the solution was best-guessed by the model people. Anyway, current A15 model can't be considered a 1-to-1 equivalent of the VE board. The plan is that the models will be shipped with their own DTSes. I'll work on that in the following months, I can keep you updated (and use as a beta tester ;-) if you want.

Quoted 8 lines
Quoted 4 lines

As the chip's GIC has 160 interrupt inputs and equivalent SMM (FPGA) has GIC synthesised with 256 interrupts, NR_IRQS is increased.

[...]

Quoted 2 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +0 -0

[...]

Quoted 8 lines

arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts

Quoted 4 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +4 -0
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x40000000>;
+	};

If CONFIG_ARM_ATAG_DTB_COMPAT is enabled the device tree will end up with two nodes describing the memory ("memory" and "memory at 80000000" in this case).

You're right - the skeleton.dtsi contains "memory" mode... Funnily enough originally I was using that name, but then Rob Herring suggested changing it to @80000000, which seemed reasonable.

Now I wonder - is the "memory" node special and should not contain "@address", or the skelton shouldn't contain the empty "memory" node...

Cheers!

Pawe?

#23 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 35 lines · Pawel Moll
Quoted 8 lines · David Vrabel
Quoted 2 lines · Pawel Moll

This patch adds Device Tree file for the CoreTile Express A15x2 (V2P-CA15) with Test Chip 1.

This doesn't work as-is with the software model as accessing some of the peripherals that aren't modeled will cause an exception. Is it worth having a device tree file suitable for the models? Or are the models too configurable for this to be workable?

The model as you have it doesn't exactly represent the board for a number of reasons, mainly because there was no hardware design when the model was created, so some of the solution was best-guessed by the model people. Anyway, current A15 model can't be considered a 1-to-1 equivalent of the VE board. The plan is that the models will be shipped with their own DTSes. I'll work on that in the following months, I can keep you updated (and use as a beta tester ;-) if you want.

Quoted 8 lines
Quoted 4 lines

As the chip's GIC has 160 interrupt inputs and equivalent SMM (FPGA) has GIC synthesised with 256 interrupts, NR_IRQS is increased.

[...]

Quoted 2 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +0 -0

[...]

Quoted 8 lines

arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts

Quoted 4 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts new file +4 -0
+	memory at 80000000 {
+		device_type = "memory";
+		reg = <0x80000000 0x40000000>;
+	};

If CONFIG_ARM_ATAG_DTB_COMPAT is enabled the device tree will end up with two nodes describing the memory ("memory" and "memory at 80000000" in this case).

Quoted 7 lines

You're right - the skeleton.dtsi contains "memory" mode... Funnily enough originally I was using that name, but then Rob Herring suggested changing it to @80000000, which seemed reasonable.

Now I wonder - is the "memory" node special and should not contain "@address", or the skelton shouldn't contain the empty "memory" node...

Hummm... I guess you should just use "memory" if you are using skeleton.dtsi.

Rob

author
#24 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 10 lines · Rob Herring
Quoted 7 lines

You're right - the skeleton.dtsi contains "memory" mode... Funnily enough originally I was using that name, but then Rob Herring suggested changing it to @80000000, which seemed reasonable.

Now I wonder - is the "memory" node special and should not contain "@address", or the skelton shouldn't contain the empty "memory" node...

Hummm... I guess you should just use "memory" if you are using skeleton.dtsi.

Well, I don't mind _not_ using skeleton, but I had an impression the general policy was to use it?

Pawe?

#25 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 9 lines · Pawel Moll
Quoted 8 lines · Rob Herring
Quoted 7 lines

You're right - the skeleton.dtsi contains "memory" mode... Funnily enough originally I was using that name, but then Rob Herring suggested changing it to @80000000, which seemed reasonable.

Now I wonder - is the "memory" node special and should not contain "@address", or the skelton shouldn't contain the empty "memory" node...

Quoted 5 lines
Quoted 2 lines

Hummm... I guess you should just use "memory" if you are using skeleton.dtsi.

Well, I don't mind _not_ using skeleton, but I had an impression the general policy was to use it?

Either way is fine. I don't really think it buys you much.

Rob

author
#26 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 10 lines · Rob Herring
Quoted 9 lines · Pawel Moll
Quoted 8 lines · Rob Herring
Quoted 7 lines

You're right - the skeleton.dtsi contains "memory" mode... Funnily enough originally I was using that name, but then Rob Herring suggested changing it to @80000000, which seemed reasonable.

Now I wonder - is the "memory" node special and should not contain "@address", or the skelton shouldn't contain the empty "memory" node...

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Hummm... I guess you should just use "memory" if you are using skeleton.dtsi.

Well, I don't mind _not_ using skeleton, but I had an impression the general policy was to use it?

Either way is fine. I don't really think it buys you much.

Ok, /include/ "skeleton.dtsi" is gone then :-)

Cheers!

Pawe?

#27 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 14 lines · Pawel Moll
Quoted 13 lines · Rob Herring
Quoted 12 lines · Pawel Moll
Quoted 10 lines · Rob Herring
Quoted 7 lines

You're right - the skeleton.dtsi contains "memory" mode... Funnily enough originally I was using that name, but then Rob Herring suggested changing it to @80000000, which seemed reasonable.

Now I wonder - is the "memory" node special and should not contain "@address", or the skelton shouldn't contain the empty "memory" node...

Hummm... I guess you should just use "memory" if you are using skeleton.dtsi.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Well, I don't mind _not_ using skeleton, but I had an impression the general policy was to use it?

Either way is fine. I don't really think it buys you much.

Ok, /include/ "skeleton.dtsi" is gone then :-)

The problem wasn't with including skeleton.dtsi. With CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

I don't expect any real production vexpress system to use this config options -- we're using it now when running as a guest under Xen because Xen doesn't (yet) support device tree and we're using ATAGs to tell the guest how much RAM it's been allocated.

David

#28 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 2 lines · David Vrabel

I don't expect any real production vexpress system to use this config options

I do - _if_ I decide to try DT on my Versatile Express. That'll be with the existing boot setup, which will be ATAG based.

author
#29 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

In reply to David Vrabel
Quoted 1 line · David Vrabel

The problem wasn't with including skeleton.dtsi.

Including as it is creates two device_type="memory" nodes, one with regs=<0 0>, which is definitely wrong.

Quoted 7 lines

With
CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

The "memory at address" node name is in my opinion perfectly legal - p. 3.4 of the DT spec says "The name component of the node name (see 2.2.1) shall be memory.". So the decompressor code may be wrong in looking for adress-less "memory" node...

One way or the other, I'll get this fixed.

Thanks for letting me know!

Pawe?

#30 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 10 lines · Pawel Moll
Quoted 1 line · David Vrabel

The problem wasn't with including skeleton.dtsi.

Including as it is creates two device_type="memory" nodes, one with regs=<0 0>, which is definitely wrong.

Quoted 4 lines

With
CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

Quoted 8 lines
Quoted 3 lines

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

The "memory at address" node name is in my opinion perfectly legal - p. 3.4 of the DT spec says "The name component of the node name (see 2.2.1) shall be memory.". So the decompressor code may be wrong in looking for adress-less "memory" node...

I don't think you can expect such early code to properly parse a DT tree with a variability in how memory stuff is declared into that DT tree.

What if you have two memory nodes specified in the DT file, and the ATAG data contains one?

The more I look at this, the more I'm convinced that Grant's idea that DT should entirely override ATAGs all the way to the kernel proper was the wrong solution - at least in the kernel, if we had both available, we could make a choice there, and have the full DT library to be able to manipulate the DT blob.

Unfortunately, that's not so, so we're just going to have to accept that on ARM it should be "memory" if we want the ATAG code to override it. Expecting the decompressor to figure out that it needs to delete DT nodes and all that I think is asking far too much.

#31 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 20 lines · Russell King - ARM Linux
Quoted 10 lines · Pawel Moll
Quoted 1 line · David Vrabel

The problem wasn't with including skeleton.dtsi.

Including as it is creates two device_type="memory" nodes, one with regs=<0 0>, which is definitely wrong.

Quoted 4 lines

With
CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

Quoted 8 lines
Quoted 3 lines

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. ?Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

The "memory at address" node name is in my opinion perfectly legal - p. 3.4 of the DT spec says "The name component of the node name (see 2.2.1) shall be memory.". So the decompressor code may be wrong in looking for adress-less "memory" node...

Quoted 5 lines

I don't think you can expect such early code to properly parse a DT tree with a variability in how memory stuff is declared into that DT tree.

What if you have two memory nodes specified in the DT file, and the ATAG data contains one?

Yes, just because it is technically legal doesn't make it okay. The pragmatic approach here is that the skeleton.dtsi file calls the node "memory", so this .dts file must do the same.

Quoted 5 lines

The more I look at this, the more I'm convinced that Grant's idea that DT should entirely override ATAGs all the way to the kernel proper was the wrong solution - at least in the kernel, if we had both available, we could make a choice there, and have the full DT library to be able to manipulate the DT blob.

Hey! I was originally lobbying for the dt pointer carried by an ATAG.
Nico conviced me otherwise. :-)

Quoted 4 lines

Unfortunately, that's not so, so we're just going to have to accept that on ARM it should be "memory" if we want the ATAG code to override it. ?Expecting the decompressor to figure out that it needs to delete DT nodes and all that I think is asking far too much.

+1

#32 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 32 lines · Grant Likely
Quoted 20 lines · Russell King - ARM Linux
Quoted 10 lines · Pawel Moll
Quoted 1 line · David Vrabel

The problem wasn't with including skeleton.dtsi.

Including as it is creates two device_type="memory" nodes, one with regs=<0 0>, which is definitely wrong.

Quoted 4 lines

With
CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

Quoted 8 lines
Quoted 3 lines

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. ?Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

The "memory at address" node name is in my opinion perfectly legal - p. 3.4 of the DT spec says "The name component of the node name (see 2.2.1) shall be memory.". So the decompressor code may be wrong in looking for adress-less "memory" node...

Quoted 5 lines

I don't think you can expect such early code to properly parse a DT tree with a variability in how memory stuff is declared into that DT tree.

What if you have two memory nodes specified in the DT file, and the ATAG data contains one?

Yes, just because it is technically legal doesn't make it okay. The pragmatic approach here is that the skeleton.dtsi file calls the node "memory", so this .dts file must do the same.

Quoted 8 lines
Quoted 5 lines

The more I look at this, the more I'm convinced that Grant's idea that DT should entirely override ATAGs all the way to the kernel proper was the wrong solution - at least in the kernel, if we had both available, we could make a choice there, and have the full DT library to be able to manipulate the DT blob.

Hey! I was originally lobbying for the dt pointer carried by an ATAG.
Nico conviced me otherwise. :-)

Hey! I was originally lobbying for people to have a fully DT aware bootloader if they wanted to play with DT, otherwise there is no incentive for updated bootloaders. But someone else convinced me otherwise. :-)

Mixed bags always have loose ends.

Nicolas

#33 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 43 lines · Nicolas Pitre
Quoted 32 lines · Grant Likely
Quoted 20 lines · Russell King - ARM Linux
Quoted 10 lines · Pawel Moll
Quoted 1 line · David Vrabel

The problem wasn't with including skeleton.dtsi.

Including as it is creates two device_type="memory" nodes, one with regs=<0 0>, which is definitely wrong.

Quoted 4 lines

With
CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

Quoted 8 lines
Quoted 3 lines

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. ?Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

The "memory at address" node name is in my opinion perfectly legal - p. 3.4 of the DT spec says "The name component of the node name (see 2.2.1) shall be memory.". So the decompressor code may be wrong in looking for adress-less "memory" node...

Quoted 5 lines

I don't think you can expect such early code to properly parse a DT tree with a variability in how memory stuff is declared into that DT tree.

What if you have two memory nodes specified in the DT file, and the ATAG data contains one?

Yes, just because it is technically legal doesn't make it okay. ?The pragmatic approach here is that the skeleton.dtsi file calls the node "memory", so this .dts file must do the same.

Quoted 8 lines
Quoted 5 lines

The more I look at this, the more I'm convinced that Grant's idea that DT should entirely override ATAGs all the way to the kernel proper was the wrong solution - at least in the kernel, if we had both available, we could make a choice there, and have the full DT library to be able to manipulate the DT blob.

Hey! ?I was originally lobbying for the dt pointer carried by an ATAG. ?Nico conviced me otherwise. ?:-)

Quoted 6 lines

Hey! ?I was originally lobbying for people to have a fully DT aware bootloader if they wanted to play with DT, otherwise there is no incentive for updated bootloaders. ?But someone else convinced me otherwise. ?:-)

Mixed bags always have loose ends.

Hahaha. Having said that though, I still strongly agree with what we have. Giving the kernel only one or the other avoids any weirdness about which the kernel should choose when both are present. The bootwrapper atag-to-dt conversion is a migration and development tool, and it should not do any DT manipulation must be kept to a bare minimum.

g.

author
#34 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

In reply to David Vrabel
Quoted 9 lines · David Vrabel
Quoted 1 line

Ok, /include/ "skeleton.dtsi" is gone then :-)

The problem wasn't with including skeleton.dtsi. With CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

As it turned out it was just the "skeleton.dtsi" problem after all - I mean the fact that there where two device_type="memory" nodes in the tree.

The decompressor's setprop() (arch/arm/boot/compressed/atags_to_fdt.c:12) uses libfdt's fdt_setprop(), which correctly ignores the "@00000000" component of the node name and sets the reg property as expected. So as long as there is exactly one "memory[@address]" node in the tree, CONFIG_ARM_ATAG_DTB_COMPAT is happy.

I will remove the /include/ from the dts files for VE (see below) in the v3.3-rc1 based series.

Thanks for spotting this!

Pawe?

arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts +4 -2
index 02cada5..2a690f2 100644
@@ -9,13 +9,15 @@
 
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
 	model = "V2P-CA15";
 	arm,hbi = <0x237>;
 	compatible = "arm,vexpress,v2p-ca15,tc1", "arm,vexpress,v2p-ca15", "arm,vexpress";
 	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
 
 	aliases {
 		serial0 = &v2m_serial0;
arch/arm/boot/dts/vexpress-v2p-ca5s.dts +4 -2
index da26a13..d4c5322 100644
@@ -9,13 +9,15 @@
 
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
 	model = "V2P-CA5s";
 	arm,hbi = <0x225>;
 	compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
 	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
 
 	aliases {
 		serial0 = &v2m_serial0;
arch/arm/boot/dts/vexpress-v2p-ca9.dts +4 -2
index 84542e7..5d90ce5 100644
@@ -9,13 +9,15 @@
 
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
 	model = "V2P-CA9";
 	arm,hbi = <0x191>;
 	compatible = "arm,vexpress,v2p-ca9", "arm,vexpress";
 	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
 
 	aliases {
 		serial0 = &v2m_serial0;
#35 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 22 lines · Pawel Moll
Quoted 9 lines · David Vrabel
Quoted 1 line

Ok, /include/ "skeleton.dtsi" is gone then :-)

The problem wasn't with including skeleton.dtsi. With CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

As it turned out it was just the "skeleton.dtsi" problem after all - I mean the fact that there where two device_type="memory" nodes in the tree.

The decompressor's setprop() (arch/arm/boot/compressed/atags_to_fdt.c:12) uses libfdt's fdt_setprop(), which correctly ignores the "@00000000" component of the node name and sets the reg property as expected. So as long as there is exactly one "memory[@address]" node in the tree, CONFIG_ARM_ATAG_DTB_COMPAT is happy.

Quoted 6 lines

I will remove the /include/ from the dts files for VE (see below) in the v3.3-rc1 based series.

Thanks for spotting this!

Pawe??

This carries a significant risk of unintended fragmentation and buggy maintenance. This patch is a good example of the kind of change which could easily go wrong. (I'm not saying that it is wrong -- just using it as an example.)

Since we will end up with a significantly large number of device trees for vexpress, I can foresee that we'll end up with a highly reduncant set of .dts{,i} files (each of which is often rather internally redundant too).

Does anyone have a view on whether it's acceptable to generate device tree sources from another form, instead of having them verbatim in the kernel tree? This could involve a preprocessor, or something more heavyweight.

The dts /include/ mechanism solves this problem only for the simplest of cases.

Cheers
---Dave

Quoted 75 lines
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts +4 -2
index 02cada5..2a690f2 100644
@@ -9,13 +9,15 @@
 
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
 	model = "V2P-CA15";
 	arm,hbi = <0x237>;
 	compatible = "arm,vexpress,v2p-ca15,tc1", "arm,vexpress,v2p-ca15", "arm,vexpress";
 	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
 
 	aliases {
 		serial0 = &v2m_serial0;
arch/arm/boot/dts/vexpress-v2p-ca5s.dts +4 -2
index da26a13..d4c5322 100644
@@ -9,13 +9,15 @@
 
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
 	model = "V2P-CA5s";
 	arm,hbi = <0x225>;
 	compatible = "arm,vexpress,v2p-ca5s", "arm,vexpress";
 	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
 
 	aliases {
 		serial0 = &v2m_serial0;
arch/arm/boot/dts/vexpress-v2p-ca9.dts +4 -2
index 84542e7..5d90ce5 100644
@@ -9,13 +9,15 @@
 
 /dts-v1/;
 
-/include/ "skeleton.dtsi"
-
 / {
 	model = "V2P-CA9";
 	arm,hbi = <0x191>;
 	compatible = "arm,vexpress,v2p-ca9", "arm,vexpress";
 	interrupt-parent = <&gic>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen { };
 
 	aliases {
 		serial0 = &v2m_serial0;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#36 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 40 lines · Dave Martin
Quoted 22 lines · Pawel Moll
Quoted 9 lines · David Vrabel
Quoted 1 line

Ok, /include/ "skeleton.dtsi" is gone then :-)

The problem wasn't with including skeleton.dtsi. With CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

As it turned out it was just the "skeleton.dtsi" problem after all - I mean the fact that there where two device_type="memory" nodes in the tree.

The decompressor's setprop() (arch/arm/boot/compressed/atags_to_fdt.c:12) uses libfdt's fdt_setprop(), which correctly ignores the "@00000000" component of the node name and sets the reg property as expected. So as long as there is exactly one "memory[@address]" node in the tree, CONFIG_ARM_ATAG_DTB_COMPAT is happy.

Quoted 6 lines

I will remove the /include/ from the dts files for VE (see below) in the v3.3-rc1 based series.

Thanks for spotting this!

Pawe??

This carries a significant risk of unintended fragmentation and buggy maintenance. This patch is a good example of the kind of change which could easily go wrong. (I'm not saying that it is wrong -- just using it as an example.)

Since we will end up with a significantly large number of device trees for vexpress, I can foresee that we'll end up with a highly reduncant set of .dts{,i} files (each of which is often rather internally redundant too).

Quoted 4 lines

Does anyone have a view on whether it's acceptable to generate device tree sources from another form, instead of having them verbatim in the kernel tree? This could involve a preprocessor, or something more heavyweight.

Yes, the xilinx folks have been using a dts generator to create the device tree that matches an FPGA design. This works on ppc and microblaze, and they'll do the same thing for their ARM FPGA SoC.

g.

#37 lore raw

PATCH v6 9/9 ARM: vexpress: Add Device Tree for V2P-CA15 core tile (TC1 variant)

Quoted 41 lines · Grant Likely
Quoted 40 lines · Dave Martin
Quoted 22 lines · Pawel Moll
Quoted 9 lines · David Vrabel
Quoted 1 line

Ok, /include/ "skeleton.dtsi" is gone then :-)

The problem wasn't with including skeleton.dtsi. With CONFIG_ARM_ATAG_DTB_COMPAT the zImage decompressor modifies the appended DTB using information from the ATAGs (see atags_to_fdt()).

If there's an ATAG giving the amount of RAM the DTB's "memory" node is replaced with a new one. Since the vexpress DTBs don't have a "memory" node it's added and the DTB ends up with two nodes describing memory.

As it turned out it was just the "skeleton.dtsi" problem after all - I mean the fact that there where two device_type="memory" nodes in the tree.

The decompressor's setprop() (arch/arm/boot/compressed/atags_to_fdt.c:12) uses libfdt's fdt_setprop(), which correctly ignores the "@00000000" component of the node name and sets the reg property as expected. So as long as there is exactly one "memory[@address]" node in the tree, CONFIG_ARM_ATAG_DTB_COMPAT is happy.

Quoted 6 lines

I will remove the /include/ from the dts files for VE (see below) in the v3.3-rc1 based series.

Thanks for spotting this!

Pawe??

This carries a significant risk of unintended fragmentation and buggy maintenance. This patch is a good example of the kind of change which could easily go wrong. (I'm not saying that it is wrong -- just using it as an example.)

Since we will end up with a significantly large number of device trees for vexpress, I can foresee that we'll end up with a highly reduncant set of .dts{,i} files (each of which is often rather internally redundant too).

Quoted 8 lines
Quoted 4 lines

Does anyone have a view on whether it's acceptable to generate device tree sources from another form, instead of having them verbatim in the kernel tree? This could involve a preprocessor, or something more heavyweight.

Yes, the xilinx folks have been using a dts generator to create the device tree that matches an FPGA design. This works on ppc and microblaze, and they'll do the same thing for their ARM FPGA SoC.

OK, well I guess it's good to know we have the option to consider such techniques for vexpress in the future.

For now, I suggest we paste in the .dts files as-is, since the situation is not too unmanageable for now, and we don't unnecessary feature creep to hold up merging of the series.

Cheers
---Dave