aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-versatile
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
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')
-rw-r--r--arch/arm/mach-versatile/Kconfig8
-rw-r--r--arch/arm/mach-versatile/Makefile1
-rw-r--r--arch/arm/mach-versatile/core.c62
-rw-r--r--arch/arm/mach-versatile/core.h4
-rw-r--r--arch/arm/mach-versatile/versatile_dt.c51
5 files changed, 126 insertions, 0 deletions
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 9cdec5aa04a0..c1f38f6625b2 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -17,4 +17,12 @@ config MACH_VERSATILE_AB
17 Include support for the ARM(R) Versatile Application Baseboard 17 Include support for the ARM(R) Versatile Application Baseboard
18 for the ARM926EJ-S. 18 for the ARM926EJ-S.
19 19
20config MACH_VERSATILE_DT
21 bool "Support Versatile platform from device tree"
22 select USE_OF
23 select CPU_ARM926T
24 help
25 Include support for the ARM(R) Versatile/PB platform,
26 using the device tree for discovery
27
20endmenu 28endmenu
diff --git a/arch/arm/mach-versatile/Makefile b/arch/arm/mach-versatile/Makefile
index 97cf4d831b0c..81fa3fe25e1a 100644
--- a/arch/arm/mach-versatile/Makefile
+++ b/arch/arm/mach-versatile/Makefile
@@ -5,4 +5,5 @@
5obj-y := core.o 5obj-y := core.o
6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o 6obj-$(CONFIG_ARCH_VERSATILE_PB) += versatile_pb.o
7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o 7obj-$(CONFIG_MACH_VERSATILE_AB) += versatile_ab.o
8obj-$(CONFIG_MACH_VERSATILE_DT) += versatile_dt.o
8obj-$(CONFIG_PCI) += pci.o 9obj-$(CONFIG_PCI) += pci.o
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
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index fd6404e5d788..e01422700ebb 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -23,6 +23,7 @@
23#define __ASM_ARCH_VERSATILE_H 23#define __ASM_ARCH_VERSATILE_H
24 24
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/of_platform.h>
26 27
27extern void __init versatile_init(void); 28extern void __init versatile_init(void);
28extern void __init versatile_init_early(void); 29extern void __init versatile_init_early(void);
@@ -30,6 +31,9 @@ extern void __init versatile_init_irq(void);
30extern void __init versatile_map_io(void); 31extern void __init versatile_map_io(void);
31extern struct sys_timer versatile_timer; 32extern struct sys_timer versatile_timer;
32extern unsigned int mmc_status(struct device *dev); 33extern unsigned int mmc_status(struct device *dev);
34#ifdef CONFIG_OF
35extern struct of_dev_auxdata versatile_auxdata_lookup[];
36#endif
33 37
34#define AMBA_DEVICE(name,busid,base,plat) \ 38#define AMBA_DEVICE(name,busid,base,plat) \
35static struct amba_device name##_device = { \ 39static struct amba_device name##_device = { \
diff --git a/arch/arm/mach-versatile/versatile_dt.c b/arch/arm/mach-versatile/versatile_dt.c
new file mode 100644
index 000000000000..54e037c090f5
--- /dev/null
+++ b/arch/arm/mach-versatile/versatile_dt.c
@@ -0,0 +1,51 @@
1/*
2 * Versatile board support using the device tree
3 *
4 * Copyright (C) 2010 Secret Lab Technologies Ltd.
5 * Copyright (C) 2009 Jeremy Kerr <jeremy.kerr@canonical.com>
6 * Copyright (C) 2004 ARM Limited
7 * Copyright (C) 2000 Deep Blue Solutions Ltd
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/init.h>
25#include <linux/of_irq.h>
26#include <linux/of_platform.h>
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30#include "core.h"
31
32static void __init versatile_dt_init(void)
33{
34 of_platform_populate(NULL, of_default_bus_match_table,
35 versatile_auxdata_lookup, NULL);
36}
37
38static const char *versatile_dt_match[] __initconst = {
39 "arm,versatile-ab",
40 "arm,versatile-pb",
41 NULL,
42};
43
44DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
45 .map_io = versatile_map_io,
46 .init_early = versatile_init_early,
47 .init_irq = versatile_init_irq,
48 .timer = &versatile_timer,
49 .init_machine = versatile_dt_init,
50 .dt_compat = versatile_dt_match,
51MACHINE_END