diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-02-28 15:57:50 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-02-29 03:15:09 -0500 |
commit | 9f0749e3eb88f94bfca2f24c77472d29bc18eb28 (patch) | |
tree | e42cc791bd1b501d5640d3db86c34bf1a8559f08 /arch/arm/mach-imx | |
parent | 6b21d18ed50c7d145220b0724ea7f2613abf0f95 (diff) |
ARM i.MX27: Add devicetree support
This patch adds basic devicetree support for i.MX27 based SoCs.
Only the bindings for which drivers exist are added here:
- UART
- fec
- CSPI
- I2C
- watchdog
- gpio
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 8 | ||||
-rw-r--r-- | arch/arm/mach-imx/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/clock-imx27.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx27-dt.c | 89 |
4 files changed, 116 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 4defb97bbfc8..85433b930045 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -376,6 +376,14 @@ config MACH_IMX27IPCAM | |||
376 | Include support for IMX27 IPCAM platform. This includes specific | 376 | Include support for IMX27 IPCAM platform. This includes specific |
377 | configurations for the board and its peripherals. | 377 | configurations for the board and its peripherals. |
378 | 378 | ||
379 | config MACH_IMX27_DT | ||
380 | bool "Support i.MX27 platforms from device tree" | ||
381 | select SOC_IMX27 | ||
382 | select USE_OF | ||
383 | help | ||
384 | Include support for Freescale i.MX27 based platforms | ||
385 | using the device tree for discovery | ||
386 | |||
379 | endif | 387 | endif |
380 | 388 | ||
381 | if ARCH_IMX_V6_V7 | 389 | if ARCH_IMX_V6_V7 |
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 55db9c488f2b..4ffeca7ee25e 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile | |||
@@ -41,6 +41,7 @@ obj-$(CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD) += eukrea_mbimx27-baseboard.o | |||
41 | obj-$(CONFIG_MACH_PCA100) += mach-pca100.o | 41 | obj-$(CONFIG_MACH_PCA100) += mach-pca100.o |
42 | obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o | 42 | obj-$(CONFIG_MACH_MXT_TD60) += mach-mxt_td60.o |
43 | obj-$(CONFIG_MACH_IMX27IPCAM) += mach-imx27ipcam.o | 43 | obj-$(CONFIG_MACH_IMX27IPCAM) += mach-imx27ipcam.o |
44 | obj-$(CONFIG_MACH_IMX27_DT) += imx27-dt.o | ||
44 | 45 | ||
45 | # i.MX31 based machines | 46 | # i.MX31 based machines |
46 | obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o | 47 | obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o |
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c index 88fe00a146e3..01ae3a45bd73 100644 --- a/arch/arm/mach-imx/clock-imx27.c +++ b/arch/arm/mach-imx/clock-imx27.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/clkdev.h> | 24 | #include <linux/clkdev.h> |
25 | #include <linux/of.h> | ||
25 | 26 | ||
26 | #include <asm/div64.h> | 27 | #include <asm/div64.h> |
27 | 28 | ||
@@ -764,3 +765,20 @@ int __init mx27_clocks_init(unsigned long fref) | |||
764 | return 0; | 765 | return 0; |
765 | } | 766 | } |
766 | 767 | ||
768 | #ifdef CONFIG_OF | ||
769 | int __init mx27_clocks_init_dt(void) | ||
770 | { | ||
771 | struct device_node *np; | ||
772 | u32 fref = 26000000; /* default */ | ||
773 | |||
774 | for_each_compatible_node(np, NULL, "fixed-clock") { | ||
775 | if (!of_device_is_compatible(np, "fsl,imx-osc26m")) | ||
776 | continue; | ||
777 | |||
778 | if (!of_property_read_u32(np, "clock-frequency", &fref)) | ||
779 | break; | ||
780 | } | ||
781 | |||
782 | return mx27_clocks_init(fref); | ||
783 | } | ||
784 | #endif | ||
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c new file mode 100644 index 000000000000..861ceb8232d6 --- /dev/null +++ b/arch/arm/mach-imx/imx27-dt.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Sascha Hauer, Pengutronix | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/irq.h> | ||
13 | #include <linux/irqdomain.h> | ||
14 | #include <linux/of_irq.h> | ||
15 | #include <linux/of_platform.h> | ||
16 | #include <asm/mach/arch.h> | ||
17 | #include <asm/mach/time.h> | ||
18 | #include <mach/common.h> | ||
19 | #include <mach/mx27.h> | ||
20 | |||
21 | static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = { | ||
22 | OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART1_BASE_ADDR, "imx21-uart.0", NULL), | ||
23 | OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART2_BASE_ADDR, "imx21-uart.1", NULL), | ||
24 | OF_DEV_AUXDATA("fsl,imx27-uart", MX27_UART3_BASE_ADDR, "imx21-uart.2", NULL), | ||
25 | OF_DEV_AUXDATA("fsl,imx27-fec", MX27_FEC_BASE_ADDR, "imx27-fec.0", NULL), | ||
26 | OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C1_BASE_ADDR, "imx-i2c.0", NULL), | ||
27 | OF_DEV_AUXDATA("fsl,imx27-i2c", MX27_I2C2_BASE_ADDR, "imx-i2c.1", NULL), | ||
28 | OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI1_BASE_ADDR, "imx27-cspi.0", NULL), | ||
29 | OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI2_BASE_ADDR, "imx27-cspi.1", NULL), | ||
30 | OF_DEV_AUXDATA("fsl,imx27-cspi", MX27_CSPI3_BASE_ADDR, "imx27-cspi.2", NULL), | ||
31 | OF_DEV_AUXDATA("fsl,imx27-wdt", MX27_WDOG_BASE_ADDR, "imx2-wdt.0", NULL), | ||
32 | { /* sentinel */ } | ||
33 | }; | ||
34 | |||
35 | static int __init imx27_avic_add_irq_domain(struct device_node *np, | ||
36 | struct device_node *interrupt_parent) | ||
37 | { | ||
38 | irq_domain_add_simple(np, 0); | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | static int __init imx27_gpio_add_irq_domain(struct device_node *np, | ||
43 | struct device_node *interrupt_parent) | ||
44 | { | ||
45 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; | ||
46 | |||
47 | irq_domain_add_simple(np, gpio_irq_base); | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static const struct of_device_id imx27_irq_match[] __initconst = { | ||
53 | { .compatible = "fsl,imx27-avic", .data = imx27_avic_add_irq_domain, }, | ||
54 | { .compatible = "fsl,imx27-gpio", .data = imx27_gpio_add_irq_domain, }, | ||
55 | { /* sentinel */ } | ||
56 | }; | ||
57 | |||
58 | static void __init imx27_dt_init(void) | ||
59 | { | ||
60 | of_irq_init(imx27_irq_match); | ||
61 | |||
62 | of_platform_populate(NULL, of_default_bus_match_table, | ||
63 | imx27_auxdata_lookup, NULL); | ||
64 | } | ||
65 | |||
66 | static void __init imx27_timer_init(void) | ||
67 | { | ||
68 | mx27_clocks_init_dt(); | ||
69 | } | ||
70 | |||
71 | static struct sys_timer imx27_timer = { | ||
72 | .init = imx27_timer_init, | ||
73 | }; | ||
74 | |||
75 | static const char *imx27_dt_board_compat[] __initdata = { | ||
76 | "fsl,imx27", | ||
77 | NULL | ||
78 | }; | ||
79 | |||
80 | DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)") | ||
81 | .map_io = mx27_map_io, | ||
82 | .init_early = imx27_init_early, | ||
83 | .init_irq = mx27_init_irq, | ||
84 | .handle_irq = imx27_handle_irq, | ||
85 | .timer = &imx27_timer, | ||
86 | .init_machine = imx27_dt_init, | ||
87 | .dt_compat = imx27_dt_board_compat, | ||
88 | .restart = mxc_restart, | ||
89 | MACHINE_END | ||