diff options
Diffstat (limited to 'arch/arm/mach-omap2/cm4xxx.c')
-rw-r--r-- | arch/arm/mach-omap2/cm4xxx.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/arch/arm/mach-omap2/cm4xxx.c b/arch/arm/mach-omap2/cm4xxx.c index 4af76bb1003a..b101091e95d6 100644 --- a/arch/arm/mach-omap2/cm4xxx.c +++ b/arch/arm/mach-omap2/cm4xxx.c | |||
@@ -21,35 +21,41 @@ | |||
21 | 21 | ||
22 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
23 | 23 | ||
24 | #include "cm.h" | 24 | #include <plat/common.h> |
25 | |||
26 | /* XXX move this to cm.h */ | ||
27 | /* MAX_MODULE_READY_TIME: max milliseconds for module to leave idle */ | ||
28 | #define MAX_MODULE_READY_TIME 20000 | ||
29 | 25 | ||
30 | /* | 26 | #include "cm.h" |
31 | * OMAP4_PRCM_CM_CLKCTRL_IDLEST_MASK: isolates the IDLEST field in the | 27 | #include "cm-regbits-44xx.h" |
32 | * CM_CLKCTRL register. | ||
33 | */ | ||
34 | #define OMAP4_PRCM_CM_CLKCTRL_IDLEST_MASK (0x2 << 16) | ||
35 | |||
36 | /* | ||
37 | * OMAP4 prcm_mod u32 fields contain packed data: the CM ID in bit 16 and | ||
38 | * the PRCM module offset address (from the CM module base) in bits 15-0. | ||
39 | */ | ||
40 | #define OMAP4_PRCM_MOD_CM_ID_SHIFT 16 | ||
41 | #define OMAP4_PRCM_MOD_OFFS_MASK 0xffff | ||
42 | 28 | ||
43 | /** | 29 | /** |
44 | * omap4_cm_wait_idlest_ready - wait for a module to leave idle or standby | 30 | * omap4_cm_wait_module_ready - wait for a module to be in 'func' state |
45 | * @prcm_mod: PRCM module offset (XXX example) | 31 | * @clkctrl_reg: CLKCTRL module address |
46 | * @prcm_dev_offs: PRCM device offset (e.g. MCASP XXX example) | 32 | * |
33 | * Wait for the module IDLEST to be functional. If the idle state is in any | ||
34 | * the non functional state (trans, idle or disabled), module and thus the | ||
35 | * sysconfig cannot be accessed and will probably lead to an "imprecise | ||
36 | * external abort" | ||
37 | * | ||
38 | * Module idle state: | ||
39 | * 0x0 func: Module is fully functional, including OCP | ||
40 | * 0x1 trans: Module is performing transition: wakeup, or sleep, or sleep | ||
41 | * abortion | ||
42 | * 0x2 idle: Module is in Idle mode (only OCP part). It is functional if | ||
43 | * using separate functional clock | ||
44 | * 0x3 disabled: Module is disabled and cannot be accessed | ||
47 | * | 45 | * |
48 | * XXX document | 46 | * TODO: Need to handle module accessible in idle state |
49 | */ | 47 | */ |
50 | int omap4_cm_wait_idlest_ready(u32 prcm_mod, u8 prcm_dev_offs) | 48 | int omap4_cm_wait_module_ready(void __iomem *clkctrl_reg) |
51 | { | 49 | { |
52 | /* FIXME: Add clock manager related code */ | 50 | int i = 0; |
53 | return 0; | 51 | |
52 | if (!clkctrl_reg) | ||
53 | return 0; | ||
54 | |||
55 | omap_test_timeout(((__raw_readl(clkctrl_reg) & | ||
56 | OMAP4430_IDLEST_MASK) == 0), | ||
57 | MAX_MODULE_READY_TIME, i); | ||
58 | |||
59 | return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; | ||
54 | } | 60 | } |
55 | 61 | ||