diff options
author | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:44 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-07-03 05:24:44 -0400 |
commit | ff00fcc9ca8f18facbc3fcd779e85887e5a0d247 (patch) | |
tree | b1270b8b3a748e3ff7a16551ba4831fff4a5d118 /arch/arm/mach-omap2/prcm.c | |
parent | a58caad11301a5bdc2d7b76596ab5477221f7a9b (diff) |
ARM: OMAP: Turn CM and PRM access into functions
Otherwise compiling in omap2 and omap3 will not work.
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/prcm.c')
-rw-r--r-- | arch/arm/mach-omap2/prcm.c | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c index 9584376d055a..fd92a80f38f2 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c | |||
@@ -28,10 +28,9 @@ | |||
28 | static void __iomem *prm_base; | 28 | static void __iomem *prm_base; |
29 | static void __iomem *cm_base; | 29 | static void __iomem *cm_base; |
30 | 30 | ||
31 | extern void omap2_clk_prepare_for_reboot(void); | ||
32 | |||
33 | u32 omap_prcm_get_reset_sources(void) | 31 | u32 omap_prcm_get_reset_sources(void) |
34 | { | 32 | { |
33 | /* XXX This presumably needs modification for 34XX */ | ||
35 | return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; | 34 | return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; |
36 | } | 35 | } |
37 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); | 36 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); |
@@ -39,13 +38,17 @@ EXPORT_SYMBOL(omap_prcm_get_reset_sources); | |||
39 | /* Resets clock rates and reboots the system. Only called from system.h */ | 38 | /* Resets clock rates and reboots the system. Only called from system.h */ |
40 | void omap_prcm_arch_reset(char mode) | 39 | void omap_prcm_arch_reset(char mode) |
41 | { | 40 | { |
42 | u32 wkup; | 41 | s16 prcm_offs; |
43 | omap2_clk_prepare_for_reboot(); | 42 | omap2_clk_prepare_for_reboot(); |
44 | 43 | ||
45 | if (cpu_is_omap24xx()) { | 44 | if (cpu_is_omap24xx()) |
46 | wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; | 45 | prcm_offs = WKUP_MOD; |
47 | prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); | 46 | else if (cpu_is_omap34xx()) |
48 | } | 47 | prcm_offs = OMAP3430_GR_MOD; |
48 | else | ||
49 | WARN_ON(1); | ||
50 | |||
51 | prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL); | ||
49 | } | 52 | } |
50 | 53 | ||
51 | static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg) | 54 | static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg) |
@@ -75,6 +78,20 @@ void prm_write_mod_reg(u32 val, s16 module, u16 idx) | |||
75 | } | 78 | } |
76 | EXPORT_SYMBOL(prm_write_mod_reg); | 79 | EXPORT_SYMBOL(prm_write_mod_reg); |
77 | 80 | ||
81 | /* Read-modify-write a register in a PRM module. Caller must lock */ | ||
82 | u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) | ||
83 | { | ||
84 | u32 v; | ||
85 | |||
86 | v = prm_read_mod_reg(module, idx); | ||
87 | v &= ~mask; | ||
88 | v |= bits; | ||
89 | prm_write_mod_reg(v, module, idx); | ||
90 | |||
91 | return v; | ||
92 | } | ||
93 | EXPORT_SYMBOL(prm_rmw_mod_reg_bits); | ||
94 | |||
78 | /* Read a register in a CM module */ | 95 | /* Read a register in a CM module */ |
79 | u32 cm_read_mod_reg(s16 module, u16 idx) | 96 | u32 cm_read_mod_reg(s16 module, u16 idx) |
80 | { | 97 | { |
@@ -89,6 +106,20 @@ void cm_write_mod_reg(u32 val, s16 module, u16 idx) | |||
89 | } | 106 | } |
90 | EXPORT_SYMBOL(cm_write_mod_reg); | 107 | EXPORT_SYMBOL(cm_write_mod_reg); |
91 | 108 | ||
109 | /* Read-modify-write a register in a CM module. Caller must lock */ | ||
110 | u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) | ||
111 | { | ||
112 | u32 v; | ||
113 | |||
114 | v = cm_read_mod_reg(module, idx); | ||
115 | v &= ~mask; | ||
116 | v |= bits; | ||
117 | cm_write_mod_reg(v, module, idx); | ||
118 | |||
119 | return v; | ||
120 | } | ||
121 | EXPORT_SYMBOL(cm_rmw_mod_reg_bits); | ||
122 | |||
92 | void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) | 123 | void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) |
93 | { | 124 | { |
94 | prm_base = omap2_globals->prm; | 125 | prm_base = omap2_globals->prm; |