aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@no-log.org>2012-07-09 15:39:12 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2012-07-10 13:23:03 -0400
commitd2a37b3d91f46da25e7ff34f582e914a4cc0bfee (patch)
treeb26ef7571c8c56df62f3cf25931063d7e8af6b8c
parent5349f2a89e6a31c8d39c4ec2618b9dd6e421c415 (diff)
ARM i.MX31: Add devicetree support
This patch adds basic devicetree support for i.MX31 based SoCs. Only the UART and interrupts bindings are added. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boot/dts/imx31.dtsi88
-rw-r--r--arch/arm/mach-imx/Kconfig8
-rw-r--r--arch/arm/mach-imx/Makefile1
-rw-r--r--arch/arm/mach-imx/clk-imx31.c19
-rw-r--r--arch/arm/mach-imx/imx31-dt.c63
-rw-r--r--arch/arm/plat-mxc/include/mach/common.h1
6 files changed, 180 insertions, 0 deletions
diff --git a/arch/arm/boot/dts/imx31.dtsi b/arch/arm/boot/dts/imx31.dtsi
new file mode 100644
index 000000000000..eef7099f3e3c
--- /dev/null
+++ b/arch/arm/boot/dts/imx31.dtsi
@@ -0,0 +1,88 @@
1/*
2 * Copyright 2012 Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
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/ "skeleton.dtsi"
13
14/ {
15 aliases {
16 serial0 = &uart1;
17 serial1 = &uart2;
18 serial2 = &uart3;
19 serial3 = &uart4;
20 serial4 = &uart5;
21 };
22
23 avic: avic-interrupt-controller@60000000 {
24 compatible = "fsl,imx31-avic", "fsl,avic";
25 interrupt-controller;
26 #interrupt-cells = <1>;
27 reg = <0x60000000 0x100000>;
28 };
29
30 soc {
31 #address-cells = <1>;
32 #size-cells = <1>;
33 compatible = "simple-bus";
34 interrupt-parent = <&avic>;
35 ranges;
36
37 aips@43f00000 { /* AIPS1 */
38 compatible = "fsl,aips-bus", "simple-bus";
39 #address-cells = <1>;
40 #size-cells = <1>;
41 reg = <0x43f00000 0x100000>;
42 ranges;
43
44 uart1: serial@43f90000 {
45 compatible = "fsl,imx31-uart", "fsl,imx21-uart";
46 reg = <0x43f90000 0x4000>;
47 interrupts = <45>;
48 status = "disabled";
49 };
50
51 uart2: serial@43f94000 {
52 compatible = "fsl,imx31-uart", "fsl,imx21-uart";
53 reg = <0x43f94000 0x4000>;
54 interrupts = <32>;
55 status = "disabled";
56 };
57
58 uart4: serial@43fb0000 {
59 compatible = "fsl,imx31-uart", "fsl,imx21-uart";
60 reg = <0x43fb0000 0x4000>;
61 interrupts = <46>;
62 status = "disabled";
63 };
64
65 uart5: serial@43fb4000 {
66 compatible = "fsl,imx31-uart", "fsl,imx21-uart";
67 reg = <0x43fb4000 0x4000>;
68 interrupts = <47>;
69 status = "disabled";
70 };
71 };
72
73 spba@50000000 {
74 compatible = "fsl,spba-bus", "simple-bus";
75 #address-cells = <1>;
76 #size-cells = <1>;
77 reg = <0x50000000 0x100000>;
78 ranges;
79
80 uart3: serial@5000c000 {
81 compatible = "fsl,imx31-uart", "fsl,imx21-uart";
82 reg = <0x5000c000 0x4000>;
83 interrupts = <18>;
84 status = "disabled";
85 };
86 };
87 };
88};
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index eff4db5de0dd..46f5c3fc9276 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -557,6 +557,14 @@ config MACH_BUG
557 Include support for BUGBase 1.3 platform. This includes specific 557 Include support for BUGBase 1.3 platform. This includes specific
558 configurations for the board and its peripherals. 558 configurations for the board and its peripherals.
559 559
560config MACH_IMX31_DT
561 bool "Support i.MX31 platforms from device tree"
562 select SOC_IMX31
563 select USE_OF
564 help
565 Include support for Freescale i.MX31 based platforms
566 using the device tree for discovery.
567
560comment "MX35 platforms:" 568comment "MX35 platforms:"
561 569
562config MACH_PCM043 570config MACH_PCM043
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index ff29421414f2..07f7c226e4cf 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -57,6 +57,7 @@ obj-$(CONFIG_MACH_QONG) += mach-qong.o
57obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o 57obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o
58obj-$(CONFIG_MACH_KZM_ARM11_01) += mach-kzm_arm11_01.o 58obj-$(CONFIG_MACH_KZM_ARM11_01) += mach-kzm_arm11_01.o
59obj-$(CONFIG_MACH_BUG) += mach-bug.o 59obj-$(CONFIG_MACH_BUG) += mach-bug.o
60obj-$(CONFIG_MACH_IMX31_DT) += imx31-dt.o
60 61
61# i.MX35 based machines 62# i.MX35 based machines
62obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o 63obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index c9a06d800f8e..f87a48fc74e1 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -20,6 +20,7 @@
20#include <linux/clkdev.h> 20#include <linux/clkdev.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/of.h>
23 24
24#include <mach/hardware.h> 25#include <mach/hardware.h>
25#include <mach/mx31.h> 26#include <mach/mx31.h>
@@ -179,3 +180,21 @@ int __init mx31_clocks_init(unsigned long fref)
179 180
180 return 0; 181 return 0;
181} 182}
183
184#ifdef CONFIG_OF
185int __init mx31_clocks_init_dt(void)
186{
187 struct device_node *np;
188 u32 fref = 26000000; /* default */
189
190 for_each_compatible_node(np, NULL, "fixed-clock") {
191 if (!of_device_is_compatible(np, "fsl,imx-osc26m"))
192 continue;
193
194 if (!of_property_read_u32(np, "clock-frequency", &fref))
195 break;
196 }
197
198 return mx31_clocks_init(fref);
199}
200#endif
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
new file mode 100644
index 000000000000..a68ba207b2b7
--- /dev/null
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -0,0 +1,63 @@
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/of_irq.h>
14#include <linux/of_platform.h>
15#include <asm/mach/arch.h>
16#include <asm/mach/time.h>
17#include <mach/common.h>
18#include <mach/mx31.h>
19
20static const struct of_dev_auxdata imx31_auxdata_lookup[] __initconst = {
21 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART1_BASE_ADDR,
22 "imx21-uart.0", NULL),
23 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART2_BASE_ADDR,
24 "imx21-uart.1", NULL),
25 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART3_BASE_ADDR,
26 "imx21-uart.2", NULL),
27 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART4_BASE_ADDR,
28 "imx21-uart.3", NULL),
29 OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART5_BASE_ADDR,
30 "imx21-uart.4", NULL),
31 { /* sentinel */ }
32};
33
34static void __init imx31_dt_init(void)
35{
36 of_platform_populate(NULL, of_default_bus_match_table,
37 imx31_auxdata_lookup, NULL);
38}
39
40static void __init imx31_timer_init(void)
41{
42 mx31_clocks_init_dt();
43}
44
45static struct sys_timer imx31_timer = {
46 .init = imx31_timer_init,
47};
48
49static const char *imx31_dt_board_compat[] __initdata = {
50 "fsl,imx31",
51 NULL
52};
53
54DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)")
55 .map_io = mx31_map_io,
56 .init_early = imx31_init_early,
57 .init_irq = mx31_init_irq,
58 .handle_irq = imx31_handle_irq,
59 .timer = &imx31_timer,
60 .init_machine = imx31_dt_init,
61 .dt_compat = imx31_dt_board_compat,
62 .restart = mxc_restart,
63MACHINE_END
diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index e429ca1b814a..7cfcc44537f0 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -67,6 +67,7 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
67extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, 67extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
68 unsigned long ckih1, unsigned long ckih2); 68 unsigned long ckih1, unsigned long ckih2);
69extern int mx27_clocks_init_dt(void); 69extern int mx27_clocks_init_dt(void);
70extern int mx31_clocks_init_dt(void);
70extern int mx51_clocks_init_dt(void); 71extern int mx51_clocks_init_dt(void);
71extern int mx53_clocks_init_dt(void); 72extern int mx53_clocks_init_dt(void);
72extern int mx6q_clocks_init(void); 73extern int mx6q_clocks_init(void);