diff options
author | Tony Lindgren <tony@atomide.com> | 2008-07-03 12:24:44 +0300 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2008-07-03 12:24:44 +0300 |
commit | ff00fcc9ca8f18facbc3fcd779e85887e5a0d247 (patch) | |
tree | b1270b8b3a748e3ff7a16551ba4831fff4a5d118 /arch/arm/mach-omap2/prcm.c | |
parent | a58caad11301a5bdc2d7b76596ab5477221f7a9b (diff) | |
download | op-kernel-dev-ff00fcc9ca8f18facbc3fcd779e85887e5a0d247.zip op-kernel-dev-ff00fcc9ca8f18facbc3fcd779e85887e5a0d247.tar.gz |
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 9584376..fd92a80 100644 --- a/arch/arm/mach-omap2/prcm.c +++ b/arch/arm/mach-omap2/prcm.c @@ -28,10 +28,9 @@ static void __iomem *prm_base; static void __iomem *cm_base; -extern void omap2_clk_prepare_for_reboot(void); - u32 omap_prcm_get_reset_sources(void) { + /* XXX This presumably needs modification for 34XX */ return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; } EXPORT_SYMBOL(omap_prcm_get_reset_sources); @@ -39,13 +38,17 @@ EXPORT_SYMBOL(omap_prcm_get_reset_sources); /* Resets clock rates and reboots the system. Only called from system.h */ void omap_prcm_arch_reset(char mode) { - u32 wkup; + s16 prcm_offs; omap2_clk_prepare_for_reboot(); - if (cpu_is_omap24xx()) { - wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; - prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); - } + if (cpu_is_omap24xx()) + prcm_offs = WKUP_MOD; + else if (cpu_is_omap34xx()) + prcm_offs = OMAP3430_GR_MOD; + else + WARN_ON(1); + + prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL); } 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) } EXPORT_SYMBOL(prm_write_mod_reg); +/* Read-modify-write a register in a PRM module. Caller must lock */ +u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) +{ + u32 v; + + v = prm_read_mod_reg(module, idx); + v &= ~mask; + v |= bits; + prm_write_mod_reg(v, module, idx); + + return v; +} +EXPORT_SYMBOL(prm_rmw_mod_reg_bits); + /* Read a register in a CM module */ u32 cm_read_mod_reg(s16 module, u16 idx) { @@ -89,6 +106,20 @@ void cm_write_mod_reg(u32 val, s16 module, u16 idx) } EXPORT_SYMBOL(cm_write_mod_reg); +/* Read-modify-write a register in a CM module. Caller must lock */ +u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) +{ + u32 v; + + v = cm_read_mod_reg(module, idx); + v &= ~mask; + v |= bits; + cm_write_mod_reg(v, module, idx); + + return v; +} +EXPORT_SYMBOL(cm_rmw_mod_reg_bits); + void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) { prm_base = omap2_globals->prm; |