Skip to contentSkip to conversation

arm64: ARMv8 RTSM model SoC support

PATCH Superseded Catalin Marinas 4 participants 17 messages Jan 4, 2013 – Jan 9, 2013

Subsystems (11)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Catalin Marinas

author maintainer
#0 lore raw

v3 cover arm64: ARMv8 RTSM model SoC support

Hi,

That's the third version of the patch series adding support for the ARMv8 RTSM model (vexpress-like) to the AArch64 kernel. There is no SoC-specific code under arch/arm64/ as the kernel makes use of the vexpress support already under drivers/ (apart from dts, defconfig and some Kconfig changes).

The patches here can be found on this branch:

git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64.git soc-armv8-experimental

In addition, there are two patches from Ryan and Tixy adding DT support for CLCD, together with my patches for CLCD support on the ARMv8 RTSM model (full, not the foundation one). My understanding is that Pawel will push an updated patch for CLCD/DT support, so I won't worry about it.

I'll push the arch/arm64/ patches myself but I expect the other patches to go in via the arm-soc tree (sp810.h, vexpress clk/sysreg). I'll send a pull request for the latter to arm-soc once Pawel is back from holiday acks them.

Catalin

Catalin Marinas (6):
arm: Move sp810.h to include/linux/amba/
vexpress: Match the "arm,sp810" DT entry for clock initialisation
vexpress: Allow vexpress-sysreg to self-initialise
arm64: Populate the platform devices
arm64: Enable ARMv8 RTSM model (SoC) support
arm64: Add simple earlyprintk support

Pawel Moll (1):
arm64: Add dts files for the ARMv8 RTSM model

 Documentation/arm64/memory.txt                     |   2 +
 arch/arm/plat-spear/restart.c                      |   2 +-
 arch/arm64/Kconfig                                 |  12 +-
 arch/arm64/Kconfig.debug                           |   9 +
 arch/arm64/boot/dts/Makefile                       |   2 +
 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts             | 154 ++++++++++++++
 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi       | 234 +++++++++++++++++++++
 arch/arm64/boot/dts/skeleton.dtsi                  |  13 ++
 arch/arm64/configs/vexpress_defconfig              |  90 ++++++++
 arch/arm64/include/asm/io.h                        |   3 +
 arch/arm64/include/asm/memory.h                    |   1 +
 arch/arm64/include/asm/mmu.h                       |   1 +
 arch/arm64/kernel/Makefile                         |   1 +
 arch/arm64/kernel/early_printk.c                   | 118 +++++++++++
 arch/arm64/kernel/head.S                           |  12 +-
 arch/arm64/kernel/setup.c                          |   8 +
 arch/arm64/mm/mmu.c                                |  42 ++++
 drivers/clk/versatile/clk-vexpress.c               |  31 +--
 drivers/mfd/vexpress-sysreg.c                      |   8 +-
 drivers/net/ethernet/smsc/Kconfig                  |   4 +-
 .../asm/hardware => include/linux/amba}/sp810.h    |   0
 include/linux/vexpress.h                           |   2 +-
 22 files changed, 727 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
 create mode 100644 arch/arm64/boot/dts/skeleton.dtsi
 create mode 100644 arch/arm64/configs/vexpress_defconfig
 create mode 100644 arch/arm64/kernel/early_printk.c
 rename {arch/arm/include/asm/hardware => include/linux/amba}/sp810.h (100%)
author maintainer
#1 lore raw

PATCH v3 1/7 arm: Move sp810.h to include/linux/amba/

Since it is now used by code under drivers/clk/ it makes sense for this file to be in a more generic location. This is required for building vexpress support on arm64.

---
 arch/arm/plat-spear/restart.c                                 | 2 +-
 drivers/clk/versatile/clk-vexpress.c                          | 3 +--
 {arch/arm/include/asm/hardware => include/linux/amba}/sp810.h | 0
 3 files changed, 2 insertions(+), 3 deletions(-)
 rename {arch/arm/include/asm/hardware => include/linux/amba}/sp810.h (100%)
arch/arm/plat-spear/restart.c +1 -1
index 4f99011..7d4616d 100644
@@ -11,8 +11,8 @@
  * warranty of any kind, whether express or implied.
  */
 #include <linux/io.h>
+#include <linux/amba/sp810.h>
 #include <asm/system_misc.h>
-#include <asm/hardware/sp810.h>
 #include <mach/spear.h>
 #include <mach/generic.h>
 
drivers/clk/versatile/clk-vexpress.c +1 -2
index c742ac7..4f83ff9 100644
@@ -11,6 +11,7 @@
  * Copyright (C) 2012 ARM Limited
  */
 
+#include <linux/amba/sp810.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
@@ -18,8 +19,6 @@
 #include <linux/of_address.h>
 #include <linux/vexpress.h>
 
-#include <asm/hardware/sp810.h>
-
 static struct clk *vexpress_sp810_timerclken[4];
 static DEFINE_SPINLOCK(vexpress_sp810_lock);
 
include/linux/amba/sp810.h renamed from arch/arm/include/asm/hardware/sp810.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/hardware/sp810.h
rename to include/linux/amba/sp810.h
author maintainer
#2 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

In reply to Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

---
 drivers/clk/versatile/clk-vexpress.c | 28 +++++++++++++++++-----------
 include/linux/vexpress.h             |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/clk/versatile/clk-vexpress.c +17 -11
index 4f83ff9..a3754e7 100644
@@ -98,21 +98,11 @@ struct clk *vexpress_sp810_of_get(struct of_phandle_args *clkspec, void *data)
 	return vexpress_sp810_timerclken[clkspec->args[0]];
 }
 
-static const __initconst struct of_device_id vexpress_fixed_clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
-	{}
-};
-
-void __init vexpress_clk_of_init(void)
+static void __init vexpress_sp810_of_setup(struct device_node *node)
 {
-	struct device_node *node;
 	struct clk *clk;
 	struct clk *refclk, *timclk;
 
-	of_clk_init(vexpress_fixed_clk_match);
-
-	node = of_find_compatible_node(NULL, NULL, "arm,sp810");
 	vexpress_sp810_init(of_iomap(node, 0));
 	of_clk_add_provider(node, vexpress_sp810_of_get, NULL);
 
@@ -138,4 +128,20 @@ void __init vexpress_clk_of_init(void)
 				"v2m-timer1", "sp804"));
 }
 
+static const __initconst struct of_device_id vexpress_clk_match[] = {
+	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
+	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
+	{ .compatible = "arm,sp810", .data = vexpress_sp810_of_setup, },
+	{}
+};
+
+int __init vexpress_clk_of_init(void)
+{
+	of_clk_init(vexpress_clk_match);
+	return 0;
+}
+#ifdef CONFIG_ARM64
+arch_initcall(vexpress_clk_of_init);
+#endif
+
 #endif
include/linux/vexpress.h +1 -1
index c52215f..b55ae6a 100644
@@ -116,6 +116,6 @@ struct clk *vexpress_osc_setup(struct device *dev);
 void vexpress_osc_of_setup(struct device_node *node);
 
 void vexpress_clk_init(void __iomem *sp810_base);
-void vexpress_clk_of_init(void);
+int vexpress_clk_of_init(void);
 
 #endif
#3 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

Hi Catalin,

Quoted 21 lines · Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

---
 drivers/clk/versatile/clk-vexpress.c | 28 +++++++++++++++++-----------
 include/linux/vexpress.h             |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/clk/versatile/clk-vexpress.c +0 -0
index 4f83ff9..a3754e7 100644

[...]

Quoted 9 lines
drivers/clk/versatile/clk-vexpress.c +5 -0
@@ -138,4 +128,20 @@ void __init vexpress_clk_of_init(void)
 				"v2m-timer1", "sp804"));
 }
 
+static const __initconst struct of_device_id vexpress_clk_match[] = {
+	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
+	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
+	{ .compatible = "arm,sp810", .data = vexpress_sp810_of_setup, },
+	{}

drivers/clk/versatile/clk-vexpress.c void __init vexpress_clk_of_init(void) · line 145

Quoted 10 lines
drivers/clk/versatile/clk-vexpress.c +10 -0
+};
+
+int __init vexpress_clk_of_init(void)
+{
+	of_clk_init(vexpress_clk_match);
+	return 0;
+}
+#ifdef CONFIG_ARM64
+arch_initcall(vexpress_clk_of_init);
+#endif

Any way to avoid the ifdef? Is it intended to be a temporarily solution?

Thanks,
Christopher

Signature · 3 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
the Linux Foundation
author maintainer
#4 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

Quoted 38 lines · Christopher Covington
Quoted 21 lines · Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

---
 drivers/clk/versatile/clk-vexpress.c | 28 +++++++++++++++++-----------
 include/linux/vexpress.h             |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/clk/versatile/clk-vexpress.c +0 -0
index 4f83ff9..a3754e7 100644

[...]

Quoted 13 lines
drivers/clk/versatile/clk-vexpress.c +9 -0
@@ -138,4 +128,20 @@ void __init vexpress_clk_of_init(void)
 				"v2m-timer1", "sp804"));
 }
 
+static const __initconst struct of_device_id vexpress_clk_match[] = {
+	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
+	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
+	{ .compatible = "arm,sp810", .data = vexpress_sp810_of_setup, },
+	{}
+};
+
+int __init vexpress_clk_of_init(void)
+{
Quoted 8 lines

drivers/clk/versatile/clk-vexpress.c void __init vexpress_clk_of_init(void) · line 145

Quoted 6 lines
drivers/clk/versatile/clk-vexpress.c +6 -0
+	of_clk_init(vexpress_clk_match);
+	return 0;
+}
+#ifdef CONFIG_ARM64
+arch_initcall(vexpress_clk_of_init);
+#endif

Any way to avoid the ifdef? Is it intended to be a temporarily solution?

It's harder since ARMv7 vexpress needs to initialise the clocks earlier (v2m_dt_timer_init). On ARMv8 we always have the architected timers and can afford an arch_initcall() here.

Signature · 1 line
Catalin
#5 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

In reply to Catalin Marinas
Quoted 9 lines · Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

Which they aren't on 32-bit vexpress ;-) leading to:

ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:refclk(0)
ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:timclk(1)

  ------------[ cut here ]------------
  WARNING: at drivers/clk/versatile/clk-vexpress.c:112 vexpress_sp810_of_setup+0x43/0xc8()
  Modules linked in:
  [<c0011cbd>] (unwind_backtrace+0x1/0x9c) from [<c001c1a9>] (warn_slowpath_common+0x39/0x50)
  [<c001c1a9>] (warn_slowpath_common+0x39/0x50) from [<c001c1d7>] (warn_slowpath_null+0x17/0x1c)
  [<c001c1d7>] (warn_slowpath_null+0x17/0x1c) from [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8)
  [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8) from [<c05b4e67>] (of_clk_init+0x1f/0x34)
  [<c05b4e67>] (of_clk_init+0x1f/0x34) from [<c05b515d>] (vexpress_clk_of_init+0x9/0x10)
  [<c05b515d>] (vexpress_clk_of_init+0x9/0x10) from [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78)
  [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78) from [<c05a4d09>] (time_init+0x11/0x20)
  [<c05a4d09>] (time_init+0x11/0x20) from [<c05a24fb>] (start_kernel+0x113/0x214)
  [<c05a24fb>] (start_kernel+0x113/0x214) from [<8000807f>] (0x8000807f)
  ---[ end trace 1b75b31a2719ed1c ]---

After moving all "fixed-clock" nodes to be the first devices in arch/arm/boot/dts/vexpress-v2m{-rs1,}.dtsi then all appears well. (I am only trying out patches 1-3 of this set at the moment).

Signature · 1 line
Tixy
Quoted 72 lines
---
 drivers/clk/versatile/clk-vexpress.c | 28 +++++++++++++++++-----------
 include/linux/vexpress.h             |  2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)
drivers/clk/versatile/clk-vexpress.c +17 -11
index 4f83ff9..a3754e7 100644
@@ -98,21 +98,11 @@ struct clk *vexpress_sp810_of_get(struct of_phandle_args *clkspec, void *data)
 	return vexpress_sp810_timerclken[clkspec->args[0]];
 }
 
-static const __initconst struct of_device_id vexpress_fixed_clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
-	{}
-};
-
-void __init vexpress_clk_of_init(void)
+static void __init vexpress_sp810_of_setup(struct device_node *node)
 {
-	struct device_node *node;
 	struct clk *clk;
 	struct clk *refclk, *timclk;
 
-	of_clk_init(vexpress_fixed_clk_match);
-
-	node = of_find_compatible_node(NULL, NULL, "arm,sp810");
 	vexpress_sp810_init(of_iomap(node, 0));
 	of_clk_add_provider(node, vexpress_sp810_of_get, NULL);
 
@@ -138,4 +128,20 @@ void __init vexpress_clk_of_init(void)
 				"v2m-timer1", "sp804"));
 }
 
+static const __initconst struct of_device_id vexpress_clk_match[] = {
+	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
+	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
+	{ .compatible = "arm,sp810", .data = vexpress_sp810_of_setup, },
+	{}
+};
+
+int __init vexpress_clk_of_init(void)
+{
+	of_clk_init(vexpress_clk_match);
+	return 0;
+}
+#ifdef CONFIG_ARM64
+arch_initcall(vexpress_clk_of_init);
+#endif
+
 #endif
include/linux/vexpress.h +1 -1
index c52215f..b55ae6a 100644
@@ -116,6 +116,6 @@ struct clk *vexpress_osc_setup(struct device *dev);
 void vexpress_osc_of_setup(struct device_node *node);
 
 void vexpress_clk_init(void __iomem *sp810_base);
-void vexpress_clk_of_init(void);
+int vexpress_clk_of_init(void);
 
 #endif

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

author maintainer
#6 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

Quoted 29 lines · Jon Medhurst (Tixy)
Quoted 9 lines · Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

Which they aren't on 32-bit vexpress ;-) leading to:

ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:refclk(0)
ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:timclk(1)

  ------------[ cut here ]------------
  WARNING: at drivers/clk/versatile/clk-vexpress.c:112 vexpress_sp810_of_setup+0x43/0xc8()
  Modules linked in:
  [<c0011cbd>] (unwind_backtrace+0x1/0x9c) from [<c001c1a9>] (warn_slowpath_common+0x39/0x50)
  [<c001c1a9>] (warn_slowpath_common+0x39/0x50) from [<c001c1d7>] (warn_slowpath_null+0x17/0x1c)
  [<c001c1d7>] (warn_slowpath_null+0x17/0x1c) from [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8)
  [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8) from [<c05b4e67>] (of_clk_init+0x1f/0x34)
  [<c05b4e67>] (of_clk_init+0x1f/0x34) from [<c05b515d>] (vexpress_clk_of_init+0x9/0x10)
  [<c05b515d>] (vexpress_clk_of_init+0x9/0x10) from [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78)
  [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78) from [<c05a4d09>] (time_init+0x11/0x20)
  [<c05a4d09>] (time_init+0x11/0x20) from [<c05a24fb>] (start_kernel+0x113/0x214)
  [<c05a24fb>] (start_kernel+0x113/0x214) from [<8000807f>] (0x8000807f)
  ---[ end trace 1b75b31a2719ed1c ]---
Quoted 3 lines

After moving all "fixed-clock" nodes to be the first devices in arch/arm/boot/dts/vexpress-v2m{-rs1,}.dtsi then all appears well. (I am only trying out patches 1-3 of this set at the moment).

I'm waiting for Pawel's feedback (he's still on holiday). He may have a better solution for the vexpress code than relying on the dts order but for now the simples fix is to change the dts. An even better solution would be for the of_clk_init() code to track dependencies.

Signature · 1 line
Catalin
#7 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

Quoted 30 lines · Catalin Marinas
Quoted 29 lines · Jon Medhurst (Tixy)
Quoted 9 lines · Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

Which they aren't on 32-bit vexpress ;-) leading to:

ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:refclk(0)
ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:timclk(1)

  ------------[ cut here ]------------
  WARNING: at drivers/clk/versatile/clk-vexpress.c:112 vexpress_sp810_of_setup+0x43/0xc8()
  Modules linked in:
  [<c0011cbd>] (unwind_backtrace+0x1/0x9c) from [<c001c1a9>] (warn_slowpath_common+0x39/0x50)
  [<c001c1a9>] (warn_slowpath_common+0x39/0x50) from [<c001c1d7>] (warn_slowpath_null+0x17/0x1c)
  [<c001c1d7>] (warn_slowpath_null+0x17/0x1c) from [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8)
  [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8) from [<c05b4e67>] (of_clk_init+0x1f/0x34)
  [<c05b4e67>] (of_clk_init+0x1f/0x34) from [<c05b515d>] (vexpress_clk_of_init+0x9/0x10)
  [<c05b515d>] (vexpress_clk_of_init+0x9/0x10) from [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78)
  [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78) from [<c05a4d09>] (time_init+0x11/0x20)
  [<c05a4d09>] (time_init+0x11/0x20) from [<c05a24fb>] (start_kernel+0x113/0x214)
  [<c05a24fb>] (start_kernel+0x113/0x214) from [<8000807f>] (0x8000807f)
  ---[ end trace 1b75b31a2719ed1c ]---
Quoted 7 lines
Quoted 3 lines

After moving all "fixed-clock" nodes to be the first devices in arch/arm/boot/dts/vexpress-v2m{-rs1,}.dtsi then all appears well. (I am only trying out patches 1-3 of this set at the moment).

I'm waiting for Pawel's feedback (he's still on holiday). He may have a better solution for the vexpress code than relying on the dts order but for now the simples fix is to change the dts.

Fair enough. But if the patch series gets used as is then another patch will need to be added to it to fix the device-trees.

Signature · 1 line
Tixy
author maintainer
#8 lore raw

PATCH v3 2/7 vexpress: Match the "arm, sp810" DT entry for clock initialisation

Quoted 35 lines · Jon Medhurst (Tixy)
Quoted 34 lines · Catalin Marinas
Quoted 32 lines · Jon Medhurst (Tixy)
Quoted 9 lines · Catalin Marinas

Currently the clk-vexpress.c implementation relies on the vexpress code to call the vexpress_clk_of_init() function which performs the SP810 initialisation. This patch adds "arm,sp810" to the clock DT match array allowing of_clk_init() to call the vexpress_sp810_of_setup() function. In case of CONFIG_ARM64, make vexpress_clk_of_init() an arch_initcall().

Note that SP810 requires the fixed clocks to be already registered. Since the clock subsystem does not handle DT dependencies, the corresponding DT entries must be in the correct order.

Which they aren't on 32-bit vexpress ;-) leading to:

ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:refclk(0)
ERROR: could not get clock /smb/motherboard/iofpga at 3,00000000/sysctl at 020000:timclk(1)

  ------------[ cut here ]------------
  WARNING: at drivers/clk/versatile/clk-vexpress.c:112 vexpress_sp810_of_setup+0x43/0xc8()
  Modules linked in:
  [<c0011cbd>] (unwind_backtrace+0x1/0x9c) from [<c001c1a9>] (warn_slowpath_common+0x39/0x50)
  [<c001c1a9>] (warn_slowpath_common+0x39/0x50) from [<c001c1d7>] (warn_slowpath_null+0x17/0x1c)
  [<c001c1d7>] (warn_slowpath_null+0x17/0x1c) from [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8)
  [<c05b4fab>] (vexpress_sp810_of_setup+0x43/0xc8) from [<c05b4e67>] (of_clk_init+0x1f/0x34)
  [<c05b4e67>] (of_clk_init+0x1f/0x34) from [<c05b515d>] (vexpress_clk_of_init+0x9/0x10)
  [<c05b515d>] (vexpress_clk_of_init+0x9/0x10) from [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78)
  [<c05a7d2b>] (v2m_dt_timer_init+0x7/0x78) from [<c05a4d09>] (time_init+0x11/0x20)
  [<c05a4d09>] (time_init+0x11/0x20) from [<c05a24fb>] (start_kernel+0x113/0x214)
  [<c05a24fb>] (start_kernel+0x113/0x214) from [<8000807f>] (0x8000807f)
  ---[ end trace 1b75b31a2719ed1c ]---

After moving all "fixed-clock" nodes to be the first devices in arch/arm/boot/dts/vexpress-v2m{-rs1,}.dtsi then all appears well. (I am only trying out patches 1-3 of this set at the moment).

Quoted 6 lines
Quoted 3 lines

I'm waiting for Pawel's feedback (he's still on holiday). He may have a better solution for the vexpress code than relying on the dts order but for now the simples fix is to change the dts.

Fair enough. But if the patch series gets used as is then another patch will need to be added to it to fix the device-trees.

Yes, indeed. I won't break 32-bit support ;)

Signature · 1 line
Catalin
author maintainer
#9 lore raw

PATCH v3 3/7 vexpress: Allow vexpress-sysreg to self-initialise

In reply to Catalin Marinas

The vexpress_sysreg_init() is a core_initcall() already and it can trigger the early initialisation if a matching node is found. This patch allows the SoC code to avoid calling vexpress_sysreg_of_early_init() explicitly.

---
 drivers/mfd/vexpress-sysreg.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mfd/vexpress-sysreg.c +6 -2
index 733c06b..ff5d16c 100644
@@ -318,8 +318,9 @@ void __init vexpress_sysreg_early_init(void __iomem *base)
 	struct device_node *node = of_find_compatible_node(NULL, NULL,
 			"arm,vexpress-sysreg");
 
-	if (node)
-		base = of_iomap(node, 0);
+	if (!node)
+		return;
+	base = of_iomap(node, 0);
 
 	if (WARN_ON(!base))
 		return;
@@ -338,6 +339,8 @@ void __init vexpress_sysreg_early_init(void __iomem *base)
 
 void __init vexpress_sysreg_of_early_init(void)
 {
+	if (vexpress_sysreg_base)
+		return;
 	vexpress_sysreg_early_init(NULL);
 }
 
@@ -470,6 +473,7 @@ static struct platform_driver vexpress_sysreg_driver = {
 
 static int __init vexpress_sysreg_init(void)
 {
+	vexpress_sysreg_of_early_init();
 	return platform_driver_register(&vexpress_sysreg_driver);
 }
 core_initcall(vexpress_sysreg_init);
author maintainer
#10 lore raw

PATCH v3 4/7 arm64: Populate the platform devices

In reply to Catalin Marinas

This patch add a device_initcall() to populate the platform devices (of_default_bus_match_table). This allows SoC implementations that do not require earlier initcalls to avoid any platform-specific code under arch/arm64.

GIC and generic timer initialisation is done via FDT and CPU notifiers independently of the SoC code.

---
 arch/arm64/kernel/setup.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/kernel/setup.c +8 -0
index 7665a9b..894c1e5 100644
@@ -39,6 +39,7 @@
 #include <linux/proc_fs.h>
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
+#include <linux/of_platform.h>
 
 #include <asm/cputype.h>
 #include <asm/elf.h>
@@ -289,6 +290,13 @@ static int __init topology_init(void)
 }
 subsys_initcall(topology_init);
 
+static int __init arm64_device_probe(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	return 0;
+}
+device_initcall(arm64_device_probe);
+
 static const char *hwcap_str[] = {
 	"fp",
 	"asimd",
author maintainer
#11 lore raw

PATCH v3 5/7 arm64: Add dts files for the ARMv8 RTSM model

In reply to Catalin Marinas

From: Pawel Moll <[email protected]>

---
 arch/arm64/boot/dts/Makefile                 |   2 +
 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts       | 154 ++++++++++++++++++
 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi | 234 +++++++++++++++++++++++++++
 arch/arm64/boot/dts/skeleton.dtsi            |  13 ++
 4 files changed, 403 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
 create mode 100644 arch/arm64/boot/dts/skeleton.dtsi
arch/arm64/boot/dts/Makefile +2 -0
index 801e2d7..6d9a147 100644
@@ -1,3 +1,5 @@
+dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb
+
 targets += dtbs
 
 dtbs: $(addprefix $(obj)/, $(dtb-y))
arch/arm64/boot/dts/rtsm_ve-aemv8a.dts new file +154 -0

154 lines not on this page · raw message

arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi new file +234 -0

234 lines not on this page · raw message

arch/arm64/boot/dts/skeleton.dtsi new file +13 -0
new file mode 100644
index 0000000..38ead82
@@ -0,0 +1,13 @@
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.  The bootloader will typically populate the memory
+ * node.
+ */
+
+/ {
+	#address-cells = <2>;
+	#size-cells = <1>;
+	chosen { };
+	aliases { };
+	memory { device_type = "memory"; reg = <0 0 0>; };
+};
author maintainer
#12 lore raw

PATCH v3 6/7 arm64: Enable ARMv8 RTSM model (SoC) support

In reply to Catalin Marinas

This patch adds the necessary Kconfig entries to enable support for the ARMv8 software model (Versatile Express platform) together with vexpress_defconfig.

---
 arch/arm64/Kconfig                    | 12 ++++-
 arch/arm64/configs/vexpress_defconfig | 90 +++++++++++++++++++++++++++++++++++
 drivers/net/ethernet/smsc/Kconfig     |  4 +-
 3 files changed, 103 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm64/configs/vexpress_defconfig
arch/arm64/Kconfig +11 -1
index 87912dd..ae8cd1f 100644
@@ -98,7 +98,17 @@ source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
 
-menu "System Type"
+menu "Platform selection"
+
+config ARCH_VEXPRESS
+	bool "ARMv8 software model (Versatile Express)"
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_GIC
+	select COMMON_CLK_VERSATILE
+	select VEXPRESS_CONFIG
+	help
+	  This enables support for the ARMv8 software model (Versatile
+	  Express).
 
 endmenu
 
arch/arm64/configs/vexpress_defconfig new file +90 -0

90 lines not on this page · raw message

drivers/net/ethernet/smsc/Kconfig +2 -2
index 5a689af..bb4c167 100644
@@ -5,7 +5,7 @@
 config NET_VENDOR_SMSC
 	bool "SMC (SMSC)/Western Digital devices"
 	default y
-	depends on ARM || ISA || MAC || ARM || MIPS || M32R || SUPERH || \
+	depends on ARM || ISA || MAC || ARM64 || MIPS || M32R || SUPERH || \
 		BLACKFIN || MN10300 || COLDFIRE || PCI || PCMCIA
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y
@@ -40,7 +40,7 @@ config SMC91X
 	select NET_CORE
 	select MII
 	depends on (ARM || M32R || SUPERH || MIPS || BLACKFIN || \
-		    MN10300 || COLDFIRE)
+		    MN10300 || COLDFIRE || ARM64)
 	---help---
 	  This is a driver for SMC's 91x series of Ethernet chipsets,
 	  including the SMC91C94 and the SMC91C111. Say Y if you want it
author maintainer
#13 lore raw

PATCH v3 7/7 arm64: Add simple earlyprintk support

In reply to Catalin Marinas

This patch adds support for "earlyprintk=" parameter on the kernel command line. The format is:

earlyprintk=<name>[,<addr>][,<options>]

where <name> is the name of the (UART) device, e.g. "pl011", <addr> is the I/O address. The <options> aren't currently used.

The mapping of the earlyprintk device is done very early during kernel boot and there are restrictions on which functions it can call. A special early_io_map() function is added which creates the mapping from the pre-defined EARLY_IOBASE to the device I/O address passed via the kernel parameter. The pgd entry corresponding to EARLY_IOBASE is pre-populated in head.S during kernel boot.

Only PL011 is currently supported and it is assumed that the interface is already initialised by the boot loader before the kernel is started.

---
 Documentation/arm64/memory.txt   |   2 +
 arch/arm64/Kconfig.debug         |   9 +++
 arch/arm64/include/asm/io.h      |   3 +
 arch/arm64/include/asm/memory.h  |   1 +
 arch/arm64/include/asm/mmu.h     |   1 +
 arch/arm64/kernel/Makefile       |   1 +
 arch/arm64/kernel/early_printk.c | 118 +++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/head.S         |  12 +++-
 arch/arm64/mm/mmu.c              |  42 ++++++++++++++
 9 files changed, 187 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/kernel/early_printk.c
Documentation/arm64/memory.txt +2 -0
index d758702..5f583af 100644
@@ -35,6 +35,8 @@ ffffffbc00000000	ffffffbdffffffff	   8GB		vmemmap
 
 ffffffbe00000000	ffffffbffbbfffff	  ~8GB		[guard, future vmmemap]
 
+ffffffbffbc00000	ffffffbffbdfffff	   2MB		earlyprintk device
+
 ffffffbffbe00000	ffffffbffbe0ffff	  64KB		PCI I/O space
 
 ffffffbbffff0000	ffffffbcffffffff	  ~2MB		[guard]
arch/arm64/Kconfig.debug +9 -0
index d7553f2..79871cd 100644
@@ -24,4 +24,13 @@ config DEBUG_STACK_USAGE
 	  Enables the display of the minimum amount of free stack which each
 	  task has ever had available in the sysrq-T output.
 
+config EARLY_PRINTK
+	bool "Early printk support"
+	default y
+	help
+	  Say Y here if you want to have an early console using the
+	  earlyprintk=<name>[,<addr>][,<options>] kernel parameter. It
+	  is assumed that the early console device has been initialised
+	  by the boot loader prior to starting the Linux kernel.
+
 endmenu
arch/arm64/include/asm/io.h +3 -0
index d2f05a6..57f12c9 100644
@@ -230,6 +230,9 @@ extern void __iounmap(volatile void __iomem *addr);
 #define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
 #define iounmap				__iounmap
 
+#define PROT_SECT_DEFAULT	(PMD_TYPE_SECT | PMD_SECT_AF)
+#define PROT_SECT_DEVICE_nGnRE	(PROT_SECT_DEFAULT | PTE_PXN | PTE_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
+
 #define ARCH_HAS_IOREMAP_WC
 #include <asm-generic/iomap.h>
 
arch/arm64/include/asm/memory.h +1 -0
index 1cac16a..381f556 100644
@@ -43,6 +43,7 @@
 #define PAGE_OFFSET		UL(0xffffffc000000000)
 #define MODULES_END		(PAGE_OFFSET)
 #define MODULES_VADDR		(MODULES_END - SZ_64M)
+#define EARLYCON_IOBASE		(MODULES_VADDR - SZ_4M)
 #define VA_BITS			(39)
 #define TASK_SIZE_64		(UL(1) << VA_BITS)
 
arch/arm64/include/asm/mmu.h +1 -0
index d4f7fd5..2494fc0 100644
@@ -26,5 +26,6 @@ typedef struct {
 
 extern void paging_init(void);
 extern void setup_mm_for_reboot(void);
+extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
 
 #endif
arch/arm64/kernel/Makefile +1 -0
index 74239c3..a1cace4 100644
@@ -17,6 +17,7 @@ arm64-obj-$(CONFIG_MODULES)		+= arm64ksyms.o module.o
 arm64-obj-$(CONFIG_SMP)			+= smp.o
 arm64-obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event.o
 arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o
+arm64-obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
 obj-y					+= $(arm64-obj-y) vdso/
 obj-m					+= $(arm64-obj-m)
arch/arm64/kernel/early_printk.c new file +118 -0

118 lines not on this page · raw message

arch/arm64/kernel/head.S +10 -2
index 368ad1f..0a0a497 100644
@@ -82,10 +82,8 @@
 
 #ifdef CONFIG_ARM64_64K_PAGES
 #define MM_MMUFLAGS	PTE_ATTRINDX(MT_NORMAL) | PTE_FLAGS
-#define IO_MMUFLAGS	PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_XN | PTE_FLAGS
 #else
 #define MM_MMUFLAGS	PMD_ATTRINDX(MT_NORMAL) | PMD_FLAGS
-#define IO_MMUFLAGS	PMD_ATTRINDX(MT_DEVICE_nGnRE) | PMD_SECT_XN | PMD_FLAGS
 #endif
 
 /*
@@ -368,6 +366,7 @@ ENDPROC(__calc_phys_offset)
  *   - identity mapping to enable the MMU (low address, TTBR0)
  *   - first few MB of the kernel linear mapping to jump to once the MMU has
  *     been enabled, including the FDT blob (TTBR1)
+ *   - UART mapping if CONFIG_EARLY_PRINTK is enabled (TTBR1)
  */
 __create_page_tables:
 	pgtbl	x25, x26, x24			// idmap_pg_dir and swapper_pg_dir addresses
@@ -420,6 +419,15 @@ __create_page_tables:
 	sub	x6, x6, #1			// inclusive range
 	create_block_map x0, x7, x3, x5, x6
 1:
+#ifdef CONFIG_EARLY_PRINTK
+	/*
+	 * Create the pgd entry for the UART mapping. The full mapping is done
+	 * later based earlyprintk kernel parameter.
+	 */
+	ldr	x5, =EARLYCON_IOBASE		// UART virtual address
+	add	x0, x26, #2 * PAGE_SIZE		// section table address
+	create_pgd_entry x26, x0, x5, x6, x7
+#endif
 	ret
 ENDPROC(__create_page_tables)
 	.ltorg
arch/arm64/mm/mmu.c +42 -0

54 lines not on this page · raw message

maintainer
#14 lore raw

v3 cover arm64: ARMv8 RTSM model SoC support

In reply to Catalin Marinas
Quoted 5 lines · Catalin Marinas

That's the third version of the patch series adding support for the ARMv8 RTSM model (vexpress-like) to the AArch64 kernel. There is no SoC-specific code under arch/arm64/ as the kernel makes use of the vexpress support already under drivers/ (apart from dts, defconfig and some Kconfig changes).

Whole series:

#15 lore raw

v3 cover arm64: ARMv8 RTSM model SoC support

In reply to Catalin Marinas

Hi Catalin,

Quoted 11 lines · Catalin Marinas

Hi,

That's the third version of the patch series adding support for the ARMv8 RTSM model (vexpress-like) to the AArch64 kernel. There is no SoC-specific code under arch/arm64/ as the kernel makes use of the vexpress support already under drivers/ (apart from dts, defconfig and some Kconfig changes).

The patches here can be found on this branch:

git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64.git soc-armv8-experimental

In case you weren't aware:

git checkout catalin/soc-armv8-experimental
ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make vexpress_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make Image

CC drivers/irqchip/gic.o
drivers/irqchip/gic.c: In function 'gic_init':
drivers/irqchip/gic.c:399:2: error: 'handle_arch_irq' undeclared (first use in this function) drivers/irqchip/gic.c:399:2: note: each undeclared identifier is reported only once for each function it appears in

arm64 builds fine for me. I haven't tried merging Rob Herring's GIC stuff. I may just postpone further poking around until those changes land.

Regards,
Christopher

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
author maintainer
#16 lore raw

v3 cover arm64: ARMv8 RTSM model SoC support

Hi Christopher,

Quoted 17 lines · Christopher Covington
Quoted 9 lines · Catalin Marinas

That's the third version of the patch series adding support for the ARMv8 RTSM model (vexpress-like) to the AArch64 kernel. There is no SoC-specific code under arch/arm64/ as the kernel makes use of the vexpress support already under drivers/ (apart from dts, defconfig and some Kconfig changes).

The patches here can be found on this branch:

git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64.git soc-armv8-experimental

In case you weren't aware:

git checkout catalin/soc-armv8-experimental
ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make vexpress_defconfig ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- make Image

Quoted 8 lines

CC drivers/irqchip/gic.o
drivers/irqchip/gic.c: In function 'gic_init':
drivers/irqchip/gic.c:399:2: error: 'handle_arch_irq' undeclared (first use in this function) drivers/irqchip/gic.c:399:2: note: each undeclared identifier is reported only once for each function it appears in

arm64 builds fine for me. I haven't tried merging Rob Herring's GIC stuff. I may just postpone further poking around until those changes land.

I am aware of this, I have a temporary patch adding GIC support under drivers/irqchip/ (I should have named the config option ARM64_GIC to avoid building it with CONFIG_ARM). But the right approach is Rob's patches moving the GIC out of arch/arm/, so once they get into -next I'll drop mine.

Signature · 1 line
Catalin