Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: imx: create mxc_arch_reset_init_dt() for DT boot

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>

Shawn Guo c1e31d12 18cb680f

+26 -9
+1
arch/arm/mach-imx/common.h
··· 74 74 extern void mxc_set_cpu_type(unsigned int type); 75 75 extern void mxc_restart(char, const char *); 76 76 extern void mxc_arch_reset_init(void __iomem *); 77 + extern void mxc_arch_reset_init_dt(void); 77 78 extern int mx53_revision(void); 78 79 extern int imx6q_revision(void); 79 80 extern int mx53_display_revision(void);
+1 -2
arch/arm/mach-imx/imx25-dt.c
··· 15 15 #include <asm/mach/arch.h> 16 16 #include <asm/mach/time.h> 17 17 #include "common.h" 18 - #include "hardware.h" 19 18 #include "mx25.h" 20 19 21 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 24 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 26 25 }
+1 -2
arch/arm/mach-imx/imx27-dt.c
··· 16 16 #include <asm/mach/time.h> 17 17 18 18 #include "common.h" 19 - #include "hardware.h" 20 19 #include "mx27.h" 21 20 22 21 static void __init imx27_dt_init(void) 23 22 { 24 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 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 29 28
+1 -2
arch/arm/mach-imx/imx31-dt.c
··· 16 16 #include <asm/mach/time.h> 17 17 18 18 #include "common.h" 19 - #include "hardware.h" 20 19 #include "mx31.h" 21 20 22 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 25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 27 26 }
+1 -2
arch/arm/mach-imx/imx51-dt.c
··· 17 17 #include <asm/mach/time.h> 18 18 19 19 #include "common.h" 20 - #include "hardware.h" 21 20 #include "mx51.h" 22 21 23 22 static void __init imx51_dt_init(void) 24 23 { 25 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 28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 29 platform_device_register_full(&devinfo);
+1 -1
arch/arm/mach-imx/mach-imx53.c
··· 39 39 40 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 44 if (of_machine_is_compatible("fsl,imx53-qsb")) 45 45 imx53_qsb_init();
+20
arch/arm/mach-imx/system.c
··· 21 21 #include <linux/io.h> 22 22 #include <linux/err.h> 23 23 #include <linux/delay.h> 24 + #include <linux/of.h> 25 + #include <linux/of_address.h> 24 26 25 27 #include <asm/system_misc.h> 26 28 #include <asm/proc-fns.h> ··· 69 67 wdog_base = base; 70 68 71 69 wdog_clk = clk_get_sys("imx2-wdt.0", NULL); 70 + if (IS_ERR(wdog_clk)) { 71 + pr_warn("%s: failed to get wdog clock\n", __func__); 72 + wdog_clk = NULL; 73 + return; 74 + } 75 + 76 + clk_prepare(wdog_clk); 77 + } 78 + 79 + void __init mxc_arch_reset_init_dt(void) 80 + { 81 + struct device_node *np; 82 + 83 + np = of_find_compatible_node(NULL, NULL, "fsl,imx21-wdt"); 84 + wdog_base = of_iomap(np, 0); 85 + WARN_ON(!wdog_base); 86 + 87 + wdog_clk = of_clk_get(np, 0); 72 88 if (IS_ERR(wdog_clk)) { 73 89 pr_warn("%s: failed to get wdog clock\n", __func__); 74 90 wdog_clk = NULL;