diff options
Diffstat (limited to 'arch/arm/mach-mxs/system.c')
-rw-r--r-- | arch/arm/mach-mxs/system.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c index 54f91ad1c965..7aa5ac5d78bf 100644 --- a/arch/arm/mach-mxs/system.c +++ b/arch/arm/mach-mxs/system.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #define MXS_MODULE_CLKGATE (1 << 30) | 37 | #define MXS_MODULE_CLKGATE (1 << 30) |
38 | #define MXS_MODULE_SFTRST (1 << 31) | 38 | #define MXS_MODULE_SFTRST (1 << 31) |
39 | 39 | ||
40 | #define CLKCTRL_TIMEOUT 10 /* 10 ms */ | ||
41 | |||
40 | static void __iomem *mxs_clkctrl_reset_addr; | 42 | static void __iomem *mxs_clkctrl_reset_addr; |
41 | 43 | ||
42 | /* | 44 | /* |
@@ -137,3 +139,17 @@ error: | |||
137 | return -ETIMEDOUT; | 139 | return -ETIMEDOUT; |
138 | } | 140 | } |
139 | EXPORT_SYMBOL(mxs_reset_block); | 141 | EXPORT_SYMBOL(mxs_reset_block); |
142 | |||
143 | int mxs_clkctrl_timeout(unsigned int reg_offset, unsigned int mask) | ||
144 | { | ||
145 | unsigned long timeout = jiffies + msecs_to_jiffies(CLKCTRL_TIMEOUT); | ||
146 | while (readl_relaxed(MXS_IO_ADDRESS(MXS_CLKCTRL_BASE_ADDR) | ||
147 | + reg_offset) & mask) { | ||
148 | if (time_after(jiffies, timeout)) { | ||
149 | pr_err("Timeout at CLKCTRL + 0x%x\n", reg_offset); | ||
150 | return -ETIMEDOUT; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | return 0; | ||
155 | } | ||