Skip to contentSkip to conversation

ARM: integrator: move CM base into device tree

PATCH Superseded Linus Walleij 2 participants 3 messages Oct 3, 2013 – Oct 10, 2013

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 ARM: integrator: move CM base into device tree

This moves the core module (CM) control base into the device tree. It is a simple memory range of 0x200 bytes. Move the cm header down into the machine directory and unexport the cm_control() symbol as no modules are using it.

---
 Documentation/devicetree/bindings/arm/arm-boards |  17 +++-
 arch/arm/boot/dts/integrator.dtsi                |   5 +
 arch/arm/mach-integrator/cm.h                    |  40 ++++++++
 arch/arm/mach-integrator/core.c                  | 120 +++++++++++++++--------
 arch/arm/mach-integrator/include/mach/cm.h       |  38 -------
 arch/arm/mach-integrator/integrator_ap.c         |   6 +-
 arch/arm/mach-integrator/integrator_cp.c         |   3 +-
 arch/arm/mach-integrator/leds.c                  |   3 +-
 8 files changed, 142 insertions(+), 90 deletions(-)
 create mode 100644 arch/arm/mach-integrator/cm.h
 delete mode 100644 arch/arm/mach-integrator/include/mach/cm.h
Documentation/devicetree/bindings/arm/arm-boards +13 -4
index 06e5370..1a2a81d 100644
@@ -10,11 +10,15 @@ Required properties (in root node):
 FPGA type interrupt controllers, see the versatile-fpga-irq binding doc.
 
 Required nodes:
+- core-module: the root node to the Integrator platforms must have
+  a core-module with regs and the compatible-string
+  "arm,core-module-integrator"
+- cpcon/syscon: the root node the Integrator/CP must have a /cpcon
+  node pointing to the CP control registers, and the Integrator/AP
+  must have a /syscon node pointing to the Integrator/AP system
+  controller. The AP syscon node must include the logical module
+  interrupts.
 
-In the root node the Integrator/CP must have a /cpcon node pointing
-to the CP control registers, and the Integrator/AP must have a
-/syscon node pointing to the Integrator/AP system controller.
-The AP syscon node must include the logical module interrupts,
 example:
 
 /dts-v1/;
@@ -24,6 +28,11 @@ example:
 	model = "ARM Integrator/AP";
 	compatible = "arm,integrator-ap";
 
+	core-module at 10000000 {
+		compatible = "arm,core-module-integrator";
+		reg = <0x10000000 0x200>;
+	};
+
 	syscon {
 		/* AP system controller registers */
 		reg = <0x11000000 0x100>;
arch/arm/boot/dts/integrator.dtsi +5 -0
index 813b91d..0f06f86 100644
@@ -5,6 +5,11 @@
 /include/ "skeleton.dtsi"
 
 / {
+	core-module at 10000000 {
+		compatible = "arm,core-module-integrator";
+		reg = <0x10000000 0x200>;
+	};
+
 	timer at 13000000 {
 		reg = <0x13000000 0x100>;
 		interrupt-parent = <&pic>;
arch/arm/mach-integrator/cm.h new file +40 -0
new file mode 100644
index 0000000..2ba8be0
@@ -0,0 +1,40 @@
+/*
+ * update the core module control register.
+ */
+void cm_control(u32, u32);
+
+struct device_node;
+void cm_init(void);
+void cm_clear_irqs(void);
+
+#define CM_CTRL_LED			(1 << 0)
+#define CM_CTRL_nMBDET			(1 << 1)
+#define CM_CTRL_REMAP			(1 << 2)
+#define CM_CTRL_RESET			(1 << 3)
+
+/*
+ * Integrator/AP,PP2 specific
+ */
+#define CM_CTRL_HIGHVECTORS		(1 << 4)
+#define CM_CTRL_BIGENDIAN		(1 << 5)
+#define CM_CTRL_FASTBUS			(1 << 6)
+#define CM_CTRL_SYNC			(1 << 7)
+
+/*
+ * ARM926/946/966 Integrator/CP specific
+ */
+#define CM_CTRL_LCDBIASEN		(1 << 8)
+#define CM_CTRL_LCDBIASUP		(1 << 9)
+#define CM_CTRL_LCDBIASDN		(1 << 10)
+#define CM_CTRL_LCDMUXSEL_MASK		(7 << 11)
+#define CM_CTRL_LCDMUXSEL_GENLCD	(1 << 11)
+#define CM_CTRL_LCDMUXSEL_VGA565_TFT555	(2 << 11)
+#define CM_CTRL_LCDMUXSEL_SHARPLCD	(3 << 11)
+#define CM_CTRL_LCDMUXSEL_VGA555_TFT555	(4 << 11)
+#define CM_CTRL_LCDEN0			(1 << 14)
+#define CM_CTRL_LCDEN1			(1 << 15)
+#define CM_CTRL_STATIC1			(1 << 16)
+#define CM_CTRL_STATIC2			(1 << 17)
+#define CM_CTRL_STATIC			(1 << 18)
+#define CM_CTRL_n24BITEN		(1 << 19)
+#define CM_CTRL_EBIWP			(1 << 20)
arch/arm/mach-integrator/core.c +77 -43

158 lines not on this page · raw message

arch/arm/mach-integrator/include/mach/cm.h deleted +0 -38
deleted file mode 100644
index 202e6a5..0000000
@@ -1,38 +0,0 @@
-/*
- * update the core module control register.
- */
-void cm_control(u32, u32);
-
-#define CM_CTRL	__io_address(INTEGRATOR_HDR_CTRL)
-
-#define CM_CTRL_LED			(1 << 0)
-#define CM_CTRL_nMBDET			(1 << 1)
-#define CM_CTRL_REMAP			(1 << 2)
-#define CM_CTRL_RESET			(1 << 3)
-
-/*
- * Integrator/AP,PP2 specific
- */
-#define CM_CTRL_HIGHVECTORS		(1 << 4)
-#define CM_CTRL_BIGENDIAN		(1 << 5)
-#define CM_CTRL_FASTBUS			(1 << 6)
-#define CM_CTRL_SYNC			(1 << 7)
-
-/*
- * ARM926/946/966 Integrator/CP specific
- */
-#define CM_CTRL_LCDBIASEN		(1 << 8)
-#define CM_CTRL_LCDBIASUP		(1 << 9)
-#define CM_CTRL_LCDBIASDN		(1 << 10)
-#define CM_CTRL_LCDMUXSEL_MASK		(7 << 11)
-#define CM_CTRL_LCDMUXSEL_GENLCD	(1 << 11)
-#define CM_CTRL_LCDMUXSEL_VGA565_TFT555	(2 << 11)
-#define CM_CTRL_LCDMUXSEL_SHARPLCD	(3 << 11)
-#define CM_CTRL_LCDMUXSEL_VGA555_TFT555	(4 << 11)
-#define CM_CTRL_LCDEN0			(1 << 14)
-#define CM_CTRL_LCDEN1			(1 << 15)
-#define CM_CTRL_STATIC1			(1 << 16)
-#define CM_CTRL_STATIC2			(1 << 17)
-#define CM_CTRL_STATIC			(1 << 18)
-#define CM_CTRL_n24BITEN		(1 << 19)
-#define CM_CTRL_EBIWP			(1 << 20)
arch/arm/mach-integrator/integrator_ap.c +3 -3
index 88a62a5..ece4755 100644
@@ -57,6 +57,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 
+#include "cm.h"
 #include "common.h"
 #include "pci_v3.h"
 
@@ -145,7 +146,7 @@ static int irq_suspend(void)
 static void irq_resume(void)
 {
 	/* disable all irq sources */
-	writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
+	cm_clear_irqs();
 	writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
 	writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
 
@@ -447,8 +448,7 @@ static const struct of_device_id fpga_irq_of_match[] __initconst = {
 
 static void __init ap_init_irq_of(void)
 {
-	/* disable core module IRQs */
-	writel(0xffffffffU, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
+	cm_init();
 	of_irq_init(fpga_irq_of_match);
 	integrator_clk_init(false);
 }
arch/arm/mach-integrator/integrator_cp.c +2 -1
index 26b3441..422c3f9 100644
@@ -36,7 +36,6 @@
 #include <asm/hardware/arm_timer.h>
 #include <asm/hardware/icst.h>
 
-#include <mach/cm.h>
 #include <mach/lm.h>
 
 #include <asm/mach/arch.h>
@@ -49,6 +48,7 @@
 #include <plat/clcd.h>
 #include <plat/sched_clock.h>
 
+#include "cm.h"
 #include "common.h"
 
 /* Base address to the CP controller */
@@ -255,6 +255,7 @@ static const struct of_device_id fpga_irq_of_match[] __initconst = {
 
 static void __init intcp_init_irq_of(void)
 {
+	cm_init();
 	of_irq_init(fpga_irq_of_match);
 	integrator_clk_init(true);
 }
arch/arm/mach-integrator/leds.c +2 -1
index 7a7f6d3..98fb74e 100644
@@ -11,10 +11,11 @@
 #include <linux/slab.h>
 #include <linux/leds.h>
 
-#include <mach/cm.h>
 #include <mach/hardware.h>
 #include <mach/platform.h>
 
+#include "cm.h"
+
 #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
 
 #define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 5/6 ARM: integrator: move CM base into device tree

[adding devicetree to Cc]

Quoted 24 lines · Linus Walleij

This moves the core module (CM) control base into the device tree. It is a simple memory range of 0x200 bytes. Move the cm header down into the machine directory and unexport the cm_control() symbol as no modules are using it.

---
 Documentation/devicetree/bindings/arm/arm-boards |  17 +++-
 arch/arm/boot/dts/integrator.dtsi                |   5 +
 arch/arm/mach-integrator/cm.h                    |  40 ++++++++
 arch/arm/mach-integrator/core.c                  | 120 +++++++++++++++--------
 arch/arm/mach-integrator/include/mach/cm.h       |  38 -------
 arch/arm/mach-integrator/integrator_ap.c         |   6 +-
 arch/arm/mach-integrator/integrator_cp.c         |   3 +-
 arch/arm/mach-integrator/leds.c                  |   3 +-
 8 files changed, 142 insertions(+), 90 deletions(-)
 create mode 100644 arch/arm/mach-integrator/cm.h
 delete mode 100644 arch/arm/mach-integrator/include/mach/cm.h
Documentation/devicetree/bindings/arm/arm-boards +0 -0
index 06e5370..1a2a81d 100644

Documentation/devicetree/bindings/arm/arm-boards Required properties (in root node): · line 15

Quoted 6 lines
Documentation/devicetree/bindings/arm/arm-boards +3 -0
@@ -10,11 +10,15 @@ Required properties (in root node):
 FPGA type interrupt controllers, see the versatile-fpga-irq binding doc.
 
 Required nodes:
+- core-module: the root node to the Integrator platforms must have
+  a core-module with regs and the compatible-string
+  "arm,core-module-integrator"

s/compatible-string/compatible string/

What are the regs -- one entry, or several?

What do they correspond to?

How big are they?

Documentation/devicetree/bindings/arm/arm-boards Required properties (in root node): · line 20

Quoted 5 lines
Documentation/devicetree/bindings/arm/arm-boards +5 -0
+- cpcon/syscon: the root node the Integrator/CP must have a /cpcon
+  node pointing to the CP control registers, and the Integrator/AP
+  must have a /syscon node pointing to the Integrator/AP system
+  controller. The AP syscon node must include the logical module
+  interrupts.

It's a shame we can't fix this up to have a compatible string...

Cheers,
Mark.

#2 lore raw

PATCH 5/6 ARM: integrator: move CM base into device tree

Quoted 5 lines · Mark Rutland

Documentation/devicetree/bindings/arm/arm-boards Required properties (in root node): · line 15

Quoted 4 lines

Required nodes:
+- core-module: the root node to the Integrator platforms must have

Documentation/devicetree/bindings/arm/arm-boards +2 -0
+  a core-module with regs and the compatible-string
+  "arm,core-module-integrator"
Quoted 7 lines

s/compatible-string/compatible string/

What are the regs -- one entry, or several?

What do they correspond to?

How big are they?

OK, sent a revised patch clarifying and extending the documentation.

Quoted 7 lines

Documentation/devicetree/bindings/arm/arm-boards Required properties (in root node): · line 20

Quoted 5 lines

+- cpcon/syscon: the root node the Integrator/CP must have a /cpcon

Documentation/devicetree/bindings/arm/arm-boards +4 -0
+  node pointing to the CP control registers, and the Integrator/AP
+  must have a /syscon node pointing to the Integrator/AP system
+  controller. The AP syscon node must include the logical module
+  interrupts.

It's a shame we can't fix this up to have a compatible string...

Who says we can't ;-)

I feel a bit guilty for this since it's my invention (I was young, I needed the DT support so badly) so now I feel I need to go in and write a patch for this.

In this patch it is just documenting the state of things so this needs to be a separate cleanup.

Yours,
Linus Walleij