aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-11-01 20:20:43 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-11-16 16:26:07 -0500
commit64100a03ad0b94a45ed2753632d9dd68379ad3ac (patch)
tree2311102288e54bee4810cd435441ea4264e2344f
parente67ae6be734de909954e20317c38472af983b92c (diff)
ARM: integrator: hook the CP into the SoC bus
This hooks the Integrator/CP into the SoC bus when booting from device tree, by mapping the CP controller registers first, then registering the SoC device, and then populating the device tree with the SoC device as parent. Cc: Lee Jones <lee.jones@linaro.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/arm/arm-boards4
-rw-r--r--arch/arm/boot/dts/integratorcp.dts5
-rw-r--r--arch/arm/mach-integrator/Kconfig1
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c57
4 files changed, 65 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm-boards b/Documentation/devicetree/bindings/arm/arm-boards
index fc81a7d6b0f1..db5858e32d3f 100644
--- a/Documentation/devicetree/bindings/arm/arm-boards
+++ b/Documentation/devicetree/bindings/arm/arm-boards
@@ -9,6 +9,10 @@ Required properties (in root node):
9 9
10FPGA type interrupt controllers, see the versatile-fpga-irq binding doc. 10FPGA type interrupt controllers, see the versatile-fpga-irq binding doc.
11 11
12In the root node the Integrator/CP must have a /cpcon node pointing
13to the CP control registers, and the Integrator/AP must have a
14/syscon node pointing to the Integrator/AP system controller.
15
12 16
13ARM Versatile Application and Platform Baseboards 17ARM Versatile Application and Platform Baseboards
14------------------------------------------------- 18-------------------------------------------------
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts
index 2dd5e4e48481..8b119399025a 100644
--- a/arch/arm/boot/dts/integratorcp.dts
+++ b/arch/arm/boot/dts/integratorcp.dts
@@ -18,6 +18,11 @@
18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk"; 18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk";
19 }; 19 };
20 20
21 cpcon {
22 /* CP controller registers */
23 reg = <0xcb000000 0x100>;
24 };
25
21 timer0: timer@13000000 { 26 timer0: timer@13000000 {
22 compatible = "arm,sp804", "arm,primecell"; 27 compatible = "arm,sp804", "arm,primecell";
23 }; 28 };
diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index 3961942c9e11..abeff25532ab 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -20,6 +20,7 @@ config ARCH_INTEGRATOR_CP
20 select PLAT_VERSATILE_CLCD 20 select PLAT_VERSATILE_CLCD
21 select SERIAL_AMBA_PL011 21 select SERIAL_AMBA_PL011
22 select SERIAL_AMBA_PL011_CONSOLE 22 select SERIAL_AMBA_PL011_CONSOLE
23 select SOC_BUS
23 help 24 help
24 Include support for the ARM(R) Integrator CP platform. 25 Include support for the ARM(R) Integrator CP platform.
25 26
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 5b08e8e4cc83..9194a4f3339c 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -26,6 +26,7 @@
26#include <linux/of_irq.h> 26#include <linux/of_irq.h>
27#include <linux/of_address.h> 27#include <linux/of_address.h>
28#include <linux/of_platform.h> 28#include <linux/of_platform.h>
29#include <linux/sys_soc.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31#include <mach/platform.h> 32#include <mach/platform.h>
@@ -336,10 +337,62 @@ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
336 { /* sentinel */ }, 337 { /* sentinel */ },
337}; 338};
338 339
340/* Base address to the CP controller */
341static void __iomem *intcp_con_base;
342
339static void __init intcp_init_of(void) 343static void __init intcp_init_of(void)
340{ 344{
341 of_platform_populate(NULL, of_default_bus_match_table, 345 struct device_node *root;
342 intcp_auxdata_lookup, NULL); 346 struct device_node *cpcon;
347 struct device *parent;
348 struct soc_device *soc_dev;
349 struct soc_device_attribute *soc_dev_attr;
350 u32 intcp_sc_id;
351 int err;
352
353 /* Here we create an SoC device for the root node */
354 root = of_find_node_by_path("/");
355 if (!root)
356 return;
357 cpcon = of_find_node_by_path("/cpcon");
358 if (!cpcon)
359 return;
360
361 intcp_con_base = of_iomap(cpcon, 0);
362 if (!intcp_con_base)
363 return;
364
365 intcp_sc_id = readl(intcp_con_base);
366
367 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
368 if (!soc_dev_attr)
369 return;
370
371 err = of_property_read_string(root, "compatible",
372 &soc_dev_attr->soc_id);
373 if (err)
374 return;
375 err = of_property_read_string(root, "model", &soc_dev_attr->machine);
376 if (err)
377 return;
378 soc_dev_attr->family = "Integrator";
379 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%c",
380 'A' + (intcp_sc_id & 0x0f));
381
382 soc_dev = soc_device_register(soc_dev_attr);
383 if (IS_ERR_OR_NULL(soc_dev)) {
384 kfree(soc_dev_attr->revision);
385 kfree(soc_dev_attr);
386 return;
387 }
388
389 parent = soc_device_to_device(soc_dev);
390
391 if (!IS_ERR_OR_NULL(parent))
392 integrator_init_sysfs(parent, intcp_sc_id);
393
394 of_platform_populate(root, of_default_bus_match_table,
395 intcp_auxdata_lookup, parent);
343} 396}
344 397
345static const char * intcp_dt_board_compat[] = { 398static const char * intcp_dt_board_compat[] = {