diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2013-05-09 22:19:01 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:00:34 -0400 |
commit | 3dedabc3a18ae01821b58775acc0382ea4b677df (patch) | |
tree | 9b14e552fd565954d52464a5647f4a04a96c8baa | |
parent | e5e8409d3b7238334f7781f75773b50e46a57664 (diff) |
ARM: imx: create mxc_arch_reset_init_dt() for DT boot
Commit c1e31d126b4db6a3a8d96883fae40fe22d5eba65 upstream.
The mxc_arch_reset_init() uses static mapping and calls clk_get_sys() to
get clock. It's suitable for non-DT boot but not for DT boot where
dynamic mapping and of_clk_get() should be used instead. Create
mxc_arch_reset_init_dt() as the DT variant of mxc_arch_reset_init(),
and change DT platforms to use it.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
-rw-r--r-- | arch/arm/mach-imx/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx25-dt.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx27-dt.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx31-dt.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/imx51-dt.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-imx53.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/system.c | 20 |
7 files changed, 26 insertions, 9 deletions
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index c08ae3f99cee..963971e11f6a 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h | |||
@@ -74,6 +74,7 @@ extern struct platform_device *mxc_register_gpio(char *name, int id, | |||
74 | extern void mxc_set_cpu_type(unsigned int type); | 74 | extern void mxc_set_cpu_type(unsigned int type); |
75 | extern void mxc_restart(char, const char *); | 75 | extern void mxc_restart(char, const char *); |
76 | extern void mxc_arch_reset_init(void __iomem *); | 76 | extern void mxc_arch_reset_init(void __iomem *); |
77 | extern void mxc_arch_reset_init_dt(void); | ||
77 | extern int mx53_revision(void); | 78 | extern int mx53_revision(void); |
78 | extern int imx6q_revision(void); | 79 | extern int imx6q_revision(void); |
79 | extern int mx53_display_revision(void); | 80 | extern int mx53_display_revision(void); |
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c index ec339917fbf4..3e1ec5ffe630 100644 --- a/arch/arm/mach-imx/imx25-dt.c +++ b/arch/arm/mach-imx/imx25-dt.c | |||
@@ -15,12 +15,11 @@ | |||
15 | #include <asm/mach/arch.h> | 15 | #include <asm/mach/arch.h> |
16 | #include <asm/mach/time.h> | 16 | #include <asm/mach/time.h> |
17 | #include "common.h" | 17 | #include "common.h" |
18 | #include "hardware.h" | ||
19 | #include "mx25.h" | 18 | #include "mx25.h" |
20 | 19 | ||
21 | static void __init imx25_dt_init(void) | 20 | static void __init imx25_dt_init(void) |
22 | { | 21 | { |
23 | mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR)); | 22 | mxc_arch_reset_init_dt(); |
24 | 23 | ||
25 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 24 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
26 | } | 25 | } |
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c index 93aef1aa0a8e..4e235ecb4021 100644 --- a/arch/arm/mach-imx/imx27-dt.c +++ b/arch/arm/mach-imx/imx27-dt.c | |||
@@ -16,14 +16,13 @@ | |||
16 | #include <asm/mach/time.h> | 16 | #include <asm/mach/time.h> |
17 | 17 | ||
18 | #include "common.h" | 18 | #include "common.h" |
19 | #include "hardware.h" | ||
20 | #include "mx27.h" | 19 | #include "mx27.h" |
21 | 20 | ||
22 | static void __init imx27_dt_init(void) | 21 | static void __init imx27_dt_init(void) |
23 | { | 22 | { |
24 | struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; | 23 | struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; |
25 | 24 | ||
26 | mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR)); | 25 | mxc_arch_reset_init_dt(); |
27 | 26 | ||
28 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 27 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
29 | 28 | ||
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c index d8b3b22aeba7..818a1cc2fe45 100644 --- a/arch/arm/mach-imx/imx31-dt.c +++ b/arch/arm/mach-imx/imx31-dt.c | |||
@@ -16,12 +16,11 @@ | |||
16 | #include <asm/mach/time.h> | 16 | #include <asm/mach/time.h> |
17 | 17 | ||
18 | #include "common.h" | 18 | #include "common.h" |
19 | #include "hardware.h" | ||
20 | #include "mx31.h" | 19 | #include "mx31.h" |
21 | 20 | ||
22 | static void __init imx31_dt_init(void) | 21 | static void __init imx31_dt_init(void) |
23 | { | 22 | { |
24 | mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); | 23 | mxc_arch_reset_init_dt(); |
25 | 24 | ||
26 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 25 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
27 | } | 26 | } |
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c index 55f47a0f98c0..53e43e579dd7 100644 --- a/arch/arm/mach-imx/imx51-dt.c +++ b/arch/arm/mach-imx/imx51-dt.c | |||
@@ -17,14 +17,13 @@ | |||
17 | #include <asm/mach/time.h> | 17 | #include <asm/mach/time.h> |
18 | 18 | ||
19 | #include "common.h" | 19 | #include "common.h" |
20 | #include "hardware.h" | ||
21 | #include "mx51.h" | 20 | #include "mx51.h" |
22 | 21 | ||
23 | static void __init imx51_dt_init(void) | 22 | static void __init imx51_dt_init(void) |
24 | { | 23 | { |
25 | struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; | 24 | struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; |
26 | 25 | ||
27 | mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); | 26 | mxc_arch_reset_init_dt(); |
28 | 27 | ||
29 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 28 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
30 | platform_device_register_full(&devinfo); | 29 | platform_device_register_full(&devinfo); |
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c index 7a5656128b60..74e7b94c22e7 100644 --- a/arch/arm/mach-imx/mach-imx53.c +++ b/arch/arm/mach-imx/mach-imx53.c | |||
@@ -39,7 +39,7 @@ static void __init imx53_qsb_init(void) | |||
39 | 39 | ||
40 | static void __init imx53_dt_init(void) | 40 | static void __init imx53_dt_init(void) |
41 | { | 41 | { |
42 | mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR)); | 42 | mxc_arch_reset_init_dt(); |
43 | 43 | ||
44 | if (of_machine_is_compatible("fsl,imx53-qsb")) | 44 | if (of_machine_is_compatible("fsl,imx53-qsb")) |
45 | imx53_qsb_init(); | 45 | imx53_qsb_init(); |
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c index 02cf449094f1..7cdc79a9657c 100644 --- a/arch/arm/mach-imx/system.c +++ b/arch/arm/mach-imx/system.c | |||
@@ -21,6 +21,8 @@ | |||
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/of.h> | ||
25 | #include <linux/of_address.h> | ||
24 | 26 | ||
25 | #include <asm/system_misc.h> | 27 | #include <asm/system_misc.h> |
26 | #include <asm/proc-fns.h> | 28 | #include <asm/proc-fns.h> |
@@ -75,3 +77,21 @@ void __init mxc_arch_reset_init(void __iomem *base) | |||
75 | 77 | ||
76 | clk_prepare(wdog_clk); | 78 | clk_prepare(wdog_clk); |
77 | } | 79 | } |
80 | |||
81 | void __init mxc_arch_reset_init_dt(void) | ||
82 | { | ||
83 | struct device_node *np; | ||
84 | |||
85 | np = of_find_compatible_node(NULL, NULL, "fsl,imx21-wdt"); | ||
86 | wdog_base = of_iomap(np, 0); | ||
87 | WARN_ON(!wdog_base); | ||
88 | |||
89 | wdog_clk = of_clk_get(np, 0); | ||
90 | if (IS_ERR(wdog_clk)) { | ||
91 | pr_warn("%s: failed to get wdog clock\n", __func__); | ||
92 | wdog_clk = NULL; | ||
93 | return; | ||
94 | } | ||
95 | |||
96 | clk_prepare(wdog_clk); | ||
97 | } | ||