]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: imx: create mxc_arch_reset_init_dt() for DT boot
authorShawn Guo <shawn.guo@linaro.org>
Fri, 10 May 2013 02:19:01 +0000 (10:19 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Mon, 17 Jun 2013 07:45:10 +0000 (15:45 +0800)
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>
arch/arm/mach-imx/common.h
arch/arm/mach-imx/imx25-dt.c
arch/arm/mach-imx/imx27-dt.c
arch/arm/mach-imx/imx31-dt.c
arch/arm/mach-imx/imx51-dt.c
arch/arm/mach-imx/mach-imx53.c
arch/arm/mach-imx/system.c

index c08ae3f99cee0e98f0025a0840a430407406e1b1..963971e11f6aaa9a9eac6a43d200a6b6858af35e 100644 (file)
@@ -74,6 +74,7 @@ extern struct platform_device *mxc_register_gpio(char *name, int id,
 extern void mxc_set_cpu_type(unsigned int type);
 extern void mxc_restart(char, const char *);
 extern void mxc_arch_reset_init(void __iomem *);
+extern void mxc_arch_reset_init_dt(void);
 extern int mx53_revision(void);
 extern int imx6q_revision(void);
 extern int mx53_display_revision(void);
index ec339917fbf42ec11dbbdc3d394b0d7ff24ec04c..3e1ec5ffe630f72976601339a7f32ac8f6c38584 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include "common.h"
-#include "hardware.h"
 #include "mx25.h"
 
 static void __init imx25_dt_init(void)
 {
-       mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
+       mxc_arch_reset_init_dt();
 
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
index 93aef1aa0a8e5e4806a34c2f07dd35b5650674b3..4e235ecb402191fb5b248b49804d160dab6b2a06 100644 (file)
 #include <asm/mach/time.h>
 
 #include "common.h"
-#include "hardware.h"
 #include "mx27.h"
 
 static void __init imx27_dt_init(void)
 {
        struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
 
-       mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR));
+       mxc_arch_reset_init_dt();
 
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
index d8b3b22aeba7c3115f8ab24558d0e4e593d70c0d..818a1cc2fe45e4ead8c2f4cd367ba24148d2aa30 100644 (file)
 #include <asm/mach/time.h>
 
 #include "common.h"
-#include "hardware.h"
 #include "mx31.h"
 
 static void __init imx31_dt_init(void)
 {
-       mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
+       mxc_arch_reset_init_dt();
 
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
index 55f47a0f98c0b853b8dc5ff5239e6f1550a947e6..53e43e579dd79afbb755360d7ff8f8936dcc4d86 100644 (file)
 #include <asm/mach/time.h>
 
 #include "common.h"
-#include "hardware.h"
 #include "mx51.h"
 
 static void __init imx51_dt_init(void)
 {
        struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
 
-       mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
+       mxc_arch_reset_init_dt();
 
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
        platform_device_register_full(&devinfo);
index 7a5656128b60c3bd624bdfafd871eb4e33e991e6..74e7b94c22e7237755ce2995f4539c4de123d7ac 100644 (file)
@@ -39,7 +39,7 @@ static void __init imx53_qsb_init(void)
 
 static void __init imx53_dt_init(void)
 {
-       mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
+       mxc_arch_reset_init_dt();
 
        if (of_machine_is_compatible("fsl,imx53-qsb"))
                imx53_qsb_init();
index 02cf449094f104033c27de938f03b5a30418a82d..7cdc79a9657c64bc7bbdab1236ab1f78736732dc 100644 (file)
@@ -21,6 +21,8 @@
 #include <linux/io.h>
 #include <linux/err.h>
 #include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 
 #include <asm/system_misc.h>
 #include <asm/proc-fns.h>
@@ -75,3 +77,21 @@ void __init mxc_arch_reset_init(void __iomem *base)
 
        clk_prepare(wdog_clk);
 }
+
+void __init mxc_arch_reset_init_dt(void)
+{
+       struct device_node *np;
+
+       np = of_find_compatible_node(NULL, NULL, "fsl,imx21-wdt");
+       wdog_base = of_iomap(np, 0);
+       WARN_ON(!wdog_base);
+
+       wdog_clk = of_clk_get(np, 0);
+       if (IS_ERR(wdog_clk)) {
+               pr_warn("%s: failed to get wdog clock\n", __func__);
+               wdog_clk = NULL;
+               return;
+       }
+
+       clk_prepare(wdog_clk);
+}