aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-06-15 20:44:27 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-10-16 08:09:56 -0400
commitbb4dbefe4c6ae3685152d03e318e093d5f6f795a (patch)
treea35a87afcae726267ec39ecfaa9549e3d719109b
parent578fdfdf32a84ca17ed2090dba4ff2c8e688cc89 (diff)
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. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/arm/arm-boards19
-rw-r--r--arch/arm/boot/dts/integrator.dtsi5
-rw-r--r--arch/arm/mach-integrator/cm.h (renamed from arch/arm/mach-integrator/include/mach/cm.h)4
-rw-r--r--arch/arm/mach-integrator/core.c120
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c6
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c3
-rw-r--r--arch/arm/mach-integrator/leds.c3
7 files changed, 111 insertions, 49 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm-boards b/Documentation/devicetree/bindings/arm/arm-boards
index 5fdd7b9eeb52..0ebf3d94e8bf 100644
--- a/Documentation/devicetree/bindings/arm/arm-boards
+++ b/Documentation/devicetree/bindings/arm/arm-boards
@@ -11,6 +11,20 @@ FPGA type interrupt controllers, see the versatile-fpga-irq binding doc.
11 11
12Required nodes: 12Required nodes:
13 13
14- core-module: the root node to the Integrator platforms must have
15 a core-module with regs and the compatible string
16 "arm,core-module-integrator"
17
18 Required properties for the core module:
19 - regs: the location and size of the core module registers, one
20 range of 0x200 bytes.
21
22- cpcon/syscon: the root node the Integrator/CP must have a /cpcon
23 node pointing to the CP control registers, and the Integrator/AP
24 must have a /syscon node pointing to the Integrator/AP system
25 controller. The AP syscon node must include the logical module
26 interrupts.
27
14In the root node the Integrator/CP must have a /cpcon node pointing 28In the root node the Integrator/CP must have a /cpcon node pointing
15to the CP control registers, and the Integrator/AP must have a 29to the CP control registers, and the Integrator/AP must have a
16/syscon node pointing to the Integrator/AP system controller. 30/syscon node pointing to the Integrator/AP system controller.
@@ -25,6 +39,11 @@ example:
25 model = "ARM Integrator/AP"; 39 model = "ARM Integrator/AP";
26 compatible = "arm,integrator-ap"; 40 compatible = "arm,integrator-ap";
27 41
42 core-module@10000000 {
43 compatible = "arm,core-module-integrator";
44 reg = <0x10000000 0x200>;
45 };
46
28 syscon { 47 syscon {
29 /* AP system controller registers */ 48 /* AP system controller registers */
30 reg = <0x11000000 0x100>; 49 reg = <0x11000000 0x100>;
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
index 813b91d7bea2..0f06f8687b0b 100644
--- a/arch/arm/boot/dts/integrator.dtsi
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -5,6 +5,11 @@
5/include/ "skeleton.dtsi" 5/include/ "skeleton.dtsi"
6 6
7/ { 7/ {
8 core-module@10000000 {
9 compatible = "arm,core-module-integrator";
10 reg = <0x10000000 0x200>;
11 };
12
8 timer@13000000 { 13 timer@13000000 {
9 reg = <0x13000000 0x100>; 14 reg = <0x13000000 0x100>;
10 interrupt-parent = <&pic>; 15 interrupt-parent = <&pic>;
diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/cm.h
index ae6085f1db19..4ecff7bff482 100644
--- a/arch/arm/mach-integrator/include/mach/cm.h
+++ b/arch/arm/mach-integrator/cm.h
@@ -4,7 +4,9 @@
4u32 cm_get(void); 4u32 cm_get(void);
5void cm_control(u32, u32); 5void cm_control(u32, u32);
6 6
7#define CM_CTRL __io_address(INTEGRATOR_HDR_CTRL) 7struct device_node;
8void cm_init(void);
9void cm_clear_irqs(void);
8 10
9#define CM_CTRL_LED (1 << 0) 11#define CM_CTRL_LED (1 << 0)
10#define CM_CTRL_nMBDET (1 << 1) 12#define CM_CTRL_nMBDET (1 << 1)
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index dd85cc9d234c..00ddf20ed91b 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -22,18 +22,21 @@
22#include <linux/amba/serial.h> 22#include <linux/amba/serial.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/stat.h> 24#include <linux/stat.h>
25#include <linux/of.h>
26#include <linux/of_address.h>
25 27
26#include <mach/hardware.h> 28#include <mach/hardware.h>
27#include <mach/platform.h> 29#include <mach/platform.h>
28#include <mach/cm.h>
29 30
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/mach/time.h> 32#include <asm/mach/time.h>
32#include <asm/pgtable.h> 33#include <asm/pgtable.h>
33 34
35#include "cm.h"
34#include "common.h" 36#include "common.h"
35 37
36static DEFINE_RAW_SPINLOCK(cm_lock); 38static DEFINE_RAW_SPINLOCK(cm_lock);
39static void __iomem *cm_base;
37 40
38/** 41/**
39 * cm_get - get the value from the CM_CTRL register 42 * cm_get - get the value from the CM_CTRL register
@@ -54,12 +57,80 @@ void cm_control(u32 mask, u32 set)
54 u32 val; 57 u32 val;
55 58
56 raw_spin_lock_irqsave(&cm_lock, flags); 59 raw_spin_lock_irqsave(&cm_lock, flags);
57 val = readl(CM_CTRL) & ~mask; 60 val = readl(cm_base + INTEGRATOR_HDR_CTRL_OFFSET) & ~mask;
58 writel(val | set, CM_CTRL); 61 writel(val | set, cm_base + INTEGRATOR_HDR_CTRL_OFFSET);
59 raw_spin_unlock_irqrestore(&cm_lock, flags); 62 raw_spin_unlock_irqrestore(&cm_lock, flags);
60} 63}
61 64
62EXPORT_SYMBOL(cm_control); 65static const char *integrator_arch_str(u32 id)
66{
67 switch ((id >> 16) & 0xff) {
68 case 0x00:
69 return "ASB little-endian";
70 case 0x01:
71 return "AHB little-endian";
72 case 0x03:
73 return "AHB-Lite system bus, bi-endian";
74 case 0x04:
75 return "AHB";
76 case 0x08:
77 return "AHB system bus, ASB processor bus";
78 default:
79 return "Unknown";
80 }
81}
82
83static const char *integrator_fpga_str(u32 id)
84{
85 switch ((id >> 12) & 0xf) {
86 case 0x01:
87 return "XC4062";
88 case 0x02:
89 return "XC4085";
90 case 0x03:
91 return "XVC600";
92 case 0x04:
93 return "EPM7256AE (Altera PLD)";
94 default:
95 return "Unknown";
96 }
97}
98
99void cm_clear_irqs(void)
100{
101 /* disable core module IRQs */
102 writel(0xffffffffU, cm_base + INTEGRATOR_HDR_IC_OFFSET +
103 IRQ_ENABLE_CLEAR);
104}
105
106static const struct of_device_id cm_match[] = {
107 { .compatible = "arm,core-module-integrator"},
108 { },
109};
110
111void cm_init(void)
112{
113 struct device_node *cm = of_find_matching_node(NULL, cm_match);
114 u32 val;
115
116 if (!cm) {
117 pr_crit("no core module node found in device tree\n");
118 return;
119 }
120 cm_base = of_iomap(cm, 0);
121 if (!cm_base) {
122 pr_crit("could not remap core module\n");
123 return;
124 }
125 cm_clear_irqs();
126 val = readl(cm_base + INTEGRATOR_HDR_ID_OFFSET);
127 pr_info("Detected ARM core module:\n");
128 pr_info(" Manufacturer: %02x\n", (val >> 24));
129 pr_info(" Architecture: %s\n", integrator_arch_str(val));
130 pr_info(" FPGA: %s\n", integrator_fpga_str(val));
131 pr_info(" Build: %02x\n", (val >> 4) & 0xFF);
132 pr_info(" Rev: %c\n", ('A' + (val & 0x03)));
133}
63 134
64/* 135/*
65 * We need to stop things allocating the low memory; ideally we need a 136 * We need to stop things allocating the low memory; ideally we need a
@@ -95,27 +166,7 @@ static ssize_t intcp_get_arch(struct device *dev,
95 struct device_attribute *attr, 166 struct device_attribute *attr,
96 char *buf) 167 char *buf)
97{ 168{
98 const char *arch; 169 return sprintf(buf, "%s\n", integrator_arch_str(integrator_id));
99
100 switch ((integrator_id >> 16) & 0xff) {
101 case 0x00:
102 arch = "ASB little-endian";
103 break;
104 case 0x01:
105 arch = "AHB little-endian";
106 break;
107 case 0x03:
108 arch = "AHB-Lite system bus, bi-endian";
109 break;
110 case 0x04:
111 arch = "AHB";
112 break;
113 default:
114 arch = "Unknown";
115 break;
116 }
117
118 return sprintf(buf, "%s\n", arch);
119} 170}
120 171
121static struct device_attribute intcp_arch_attr = 172static struct device_attribute intcp_arch_attr =
@@ -125,24 +176,7 @@ static ssize_t intcp_get_fpga(struct device *dev,
125 struct device_attribute *attr, 176 struct device_attribute *attr,
126 char *buf) 177 char *buf)
127{ 178{
128 const char *fpga; 179 return sprintf(buf, "%s\n", integrator_fpga_str(integrator_id));
129
130 switch ((integrator_id >> 12) & 0xf) {
131 case 0x01:
132 fpga = "XC4062";
133 break;
134 case 0x02:
135 fpga = "XC4085";
136 break;
137 case 0x04:
138 fpga = "EPM7256AE (Altera PLD)";
139 break;
140 default:
141 fpga = "Unknown";
142 break;
143 }
144
145 return sprintf(buf, "%s\n", fpga);
146} 180}
147 181
148static struct device_attribute intcp_fpga_attr = 182static struct device_attribute intcp_fpga_attr =
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 88a62a5febc2..ece47556afe6 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -57,6 +57,7 @@
57#include <asm/mach/map.h> 57#include <asm/mach/map.h>
58#include <asm/mach/time.h> 58#include <asm/mach/time.h>
59 59
60#include "cm.h"
60#include "common.h" 61#include "common.h"
61#include "pci_v3.h" 62#include "pci_v3.h"
62 63
@@ -145,7 +146,7 @@ static int irq_suspend(void)
145static void irq_resume(void) 146static void irq_resume(void)
146{ 147{
147 /* disable all irq sources */ 148 /* disable all irq sources */
148 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR); 149 cm_clear_irqs();
149 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR); 150 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
150 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR); 151 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
151 152
@@ -447,8 +448,7 @@ static const struct of_device_id fpga_irq_of_match[] __initconst = {
447 448
448static void __init ap_init_irq_of(void) 449static void __init ap_init_irq_of(void)
449{ 450{
450 /* disable core module IRQs */ 451 cm_init();
451 writel(0xffffffffU, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
452 of_irq_init(fpga_irq_of_match); 452 of_irq_init(fpga_irq_of_match);
453 integrator_clk_init(false); 453 integrator_clk_init(false);
454} 454}
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 26b344197560..422c3f9b4163 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -36,7 +36,6 @@
36#include <asm/hardware/arm_timer.h> 36#include <asm/hardware/arm_timer.h>
37#include <asm/hardware/icst.h> 37#include <asm/hardware/icst.h>
38 38
39#include <mach/cm.h>
40#include <mach/lm.h> 39#include <mach/lm.h>
41 40
42#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
@@ -49,6 +48,7 @@
49#include <plat/clcd.h> 48#include <plat/clcd.h>
50#include <plat/sched_clock.h> 49#include <plat/sched_clock.h>
51 50
51#include "cm.h"
52#include "common.h" 52#include "common.h"
53 53
54/* Base address to the CP controller */ 54/* Base address to the CP controller */
@@ -255,6 +255,7 @@ static const struct of_device_id fpga_irq_of_match[] __initconst = {
255 255
256static void __init intcp_init_irq_of(void) 256static void __init intcp_init_irq_of(void)
257{ 257{
258 cm_init();
258 of_irq_init(fpga_irq_of_match); 259 of_irq_init(fpga_irq_of_match);
259 integrator_clk_init(true); 260 integrator_clk_init(true);
260} 261}
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
index ed82535845f7..cb6ac58f5e07 100644
--- a/arch/arm/mach-integrator/leds.c
+++ b/arch/arm/mach-integrator/leds.c
@@ -11,10 +11,11 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/leds.h> 12#include <linux/leds.h>
13 13
14#include <mach/cm.h>
15#include <mach/hardware.h> 14#include <mach/hardware.h>
16#include <mach/platform.h> 15#include <mach/platform.h>
17 16
17#include "cm.h"
18
18#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) 19#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
19 20
20#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE) 21#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE)