aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-versatile/core.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-07-26 05:19:06 -0400
committerGrant Likely <grant.likely@secretlab.ca>2011-07-28 03:32:04 -0400
commit3ba7222ac992d24d09ccd0b55940b54849eef752 (patch)
tree278ee248319b6a71cb72fafa36fa90ff1c641cfe /arch/arm/mach-versatile/core.c
parent7e71330169d8056536b299290544980bccc6b300 (diff)
arm/versatile: Add device tree support
For testing the dt work, define a dt-enabled versatile platform. This patch adds a new versatile platform for when using the device tree. Add platform and amba devices are discovered and registered by parsing the device tree. Clocks and initial io mappings are still configured statically. This patch still depends on some static platform_data for a few devices which is passed via the auxdata structure to of_platform_populate(), but it is a viable starting point until the drivers can get all configuration data out of the device tree. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/arm/mach-versatile/core.c')
-rw-r--r--arch/arm/mach-versatile/core.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 0c99cf076c63..e340a54251df 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -24,6 +24,9 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irqdomain.h>
28#include <linux/of_address.h>
29#include <linux/of_platform.h>
27#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
28#include <linux/amba/clcd.h> 31#include <linux/amba/clcd.h>
29#include <linux/amba/pl061.h> 32#include <linux/amba/pl061.h>
@@ -83,13 +86,26 @@ static struct fpga_irq_data sic_irq = {
83#define PIC_MASK 0 86#define PIC_MASK 0
84#endif 87#endif
85 88
89/* Lookup table for finding a DT node that represents the vic instance */
90static const struct of_device_id vic_of_match[] __initconst = {
91 { .compatible = "arm,versatile-vic", },
92 {}
93};
94
95static const struct of_device_id sic_of_match[] __initconst = {
96 { .compatible = "arm,versatile-sic", },
97 {}
98};
99
86void __init versatile_init_irq(void) 100void __init versatile_init_irq(void)
87{ 101{
88 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0); 102 vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0);
103 irq_domain_generate_simple(vic_of_match, VERSATILE_VIC_BASE, IRQ_VIC_START);
89 104
90 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 105 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
91 106
92 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq); 107 fpga_irq_init(IRQ_VICSOURCE31, ~PIC_MASK, &sic_irq);
108 irq_domain_generate_simple(sic_of_match, VERSATILE_SIC_BASE, IRQ_SIC_START);
93 109
94 /* 110 /*
95 * Interrupts on secondary controller from 0 to 8 are routed to 111 * Interrupts on secondary controller from 0 to 8 are routed to
@@ -646,6 +662,52 @@ static struct amba_device *amba_devs[] __initdata = {
646 &kmi1_device, 662 &kmi1_device,
647}; 663};
648 664
665#ifdef CONFIG_OF
666/*
667 * Lookup table for attaching a specific name and platform_data pointer to
668 * devices as they get created by of_platform_populate(). Ideally this table
669 * would not exist, but the current clock implementation depends on some devices
670 * having a specific name.
671 */
672struct of_dev_auxdata versatile_auxdata_lookup[] __initdata = {
673 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI0_BASE, "fpga:05", NULL),
674 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI0_BASE, "fpga:06", NULL),
675 OF_DEV_AUXDATA("arm,primecell", VERSATILE_KMI1_BASE, "fpga:07", NULL),
676 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART3_BASE, "fpga:09", NULL),
677 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MMCI1_BASE, "fpga:0b", NULL),
678
679 OF_DEV_AUXDATA("arm,primecell", VERSATILE_CLCD_BASE, "dev:20", &clcd_plat_data),
680 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART0_BASE, "dev:f1", NULL),
681 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART1_BASE, "dev:f2", NULL),
682 OF_DEV_AUXDATA("arm,primecell", VERSATILE_UART2_BASE, "dev:f3", NULL),
683 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SSP_BASE, "dev:f4", NULL),
684
685#if 0
686 /*
687 * These entries are unnecessary because no clocks referencing
688 * them. I've left them in for now as place holders in case
689 * any of them need to be added back, but they should be
690 * removed before actually committing this patch. --gcl
691 */
692 OF_DEV_AUXDATA("arm,primecell", VERSATILE_AACI_BASE, "fpga:04", NULL),
693 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI1_BASE, "fpga:0a", NULL),
694 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SMC_BASE, "dev:00", NULL),
695 OF_DEV_AUXDATA("arm,primecell", VERSATILE_MPMC_BASE, "dev:10", NULL),
696 OF_DEV_AUXDATA("arm,primecell", VERSATILE_DMAC_BASE, "dev:30", NULL),
697
698 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCTL_BASE, "dev:e0", NULL),
699 OF_DEV_AUXDATA("arm,primecell", VERSATILE_WATCHDOG_BASE, "dev:e1", NULL),
700 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO0_BASE, "dev:e4", NULL),
701 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO1_BASE, "dev:e5", NULL),
702 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO2_BASE, "dev:e6", NULL),
703 OF_DEV_AUXDATA("arm,primecell", VERSATILE_GPIO3_BASE, "dev:e7", NULL),
704 OF_DEV_AUXDATA("arm,primecell", VERSATILE_RTC_BASE, "dev:e8", NULL),
705 OF_DEV_AUXDATA("arm,primecell", VERSATILE_SCI_BASE, "dev:f0", NULL),
706#endif
707 {}
708};
709#endif
710
649#ifdef CONFIG_LEDS 711#ifdef CONFIG_LEDS
650#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET) 712#define VA_LEDS_BASE (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
651 713