aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-03-28 21:33:09 -0400
committerShawn Guo <shawn.guo@linaro.org>2013-04-01 08:42:13 -0400
commit8f7cf8815f7d87534dda3657f03e925e58c1f5e1 (patch)
tree02c73d48dcb2d821029c10af1294d4a12a21a223 /arch/arm/mach-mxs
parentc226221359f3edf2f53c802dd60f69b7295a3f5c (diff)
ARM: mxs: get reset address from device tree
Instead of using static address definition, get reset address from device tree with mapping, so that core_initcall mxs_arch_reset_init() can be killed. The "rtc" clock code in mxs_arch_reset_init() seems to be zombie, since there is no clk lookup defined in clock driver at all. Remove it together. Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-mxs')
-rw-r--r--arch/arm/mach-mxs/system.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 30042e23bfa7..2d64ee9bbd3f 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -23,6 +23,8 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/of.h>
27#include <linux/of_address.h>
26 28
27#include <asm/proc-fns.h> 29#include <asm/proc-fns.h>
28#include <asm/system_misc.h> 30#include <asm/system_misc.h>
@@ -37,41 +39,37 @@
37#define MXS_MODULE_CLKGATE (1 << 30) 39#define MXS_MODULE_CLKGATE (1 << 30)
38#define MXS_MODULE_SFTRST (1 << 31) 40#define MXS_MODULE_SFTRST (1 << 31)
39 41
40static void __iomem *mxs_clkctrl_reset_addr;
41
42/* 42/*
43 * Reset the system. It is called by machine_restart(). 43 * Reset the system. It is called by machine_restart().
44 */ 44 */
45void mxs_restart(char mode, const char *cmd) 45void mxs_restart(char mode, const char *cmd)
46{ 46{
47 struct device_node *np;
48 void __iomem *reset_addr;
49
50 np = of_find_compatible_node(NULL, NULL, "fsl,clkctrl");
51 reset_addr = of_iomap(np, 0);
52 if (!reset_addr)
53 goto soft;
54
55 if (of_device_is_compatible(np, "fsl,imx23-clkctrl"))
56 reset_addr += MX23_CLKCTRL_RESET_OFFSET;
57 else
58 reset_addr += MX28_CLKCTRL_RESET_OFFSET;
59
47 /* reset the chip */ 60 /* reset the chip */
48 __mxs_setl(MXS_CLKCTRL_RESET_CHIP, mxs_clkctrl_reset_addr); 61 __mxs_setl(MXS_CLKCTRL_RESET_CHIP, reset_addr);
49 62
50 pr_err("Failed to assert the chip reset\n"); 63 pr_err("Failed to assert the chip reset\n");
51 64
52 /* Delay to allow the serial port to show the message */ 65 /* Delay to allow the serial port to show the message */
53 mdelay(50); 66 mdelay(50);
54 67
68soft:
55 /* We'll take a jump through zero as a poor second */ 69 /* We'll take a jump through zero as a poor second */
56 soft_restart(0); 70 soft_restart(0);
57} 71}
58 72
59static int __init mxs_arch_reset_init(void)
60{
61 struct clk *clk;
62
63 mxs_clkctrl_reset_addr = MXS_IO_ADDRESS(MXS_CLKCTRL_BASE_ADDR) +
64 (cpu_is_mx23() ? MX23_CLKCTRL_RESET_OFFSET :
65 MX28_CLKCTRL_RESET_OFFSET);
66
67 clk = clk_get_sys("rtc", NULL);
68 if (!IS_ERR(clk))
69 clk_prepare_enable(clk);
70
71 return 0;
72}
73core_initcall(mxs_arch_reset_init);
74
75/* 73/*
76 * Clear the bit and poll it cleared. This is usually called with 74 * Clear the bit and poll it cleared. This is usually called with
77 * a reset address and mask being either SFTRST(bit 31) or CLKGATE 75 * a reset address and mask being either SFTRST(bit 31) or CLKGATE