Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+62 -7
+1
arch/arm/mach-omap2/clock.h
··· 42 42 int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 43 43 u32 omap2_get_dpll_rate(struct clk *clk); 44 44 int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 45 + void omap2_clk_prepare_for_reboot(void); 45 46 46 47 extern u8 cpu_mask; 47 48
+11
arch/arm/mach-omap2/cm.h
··· 99 99 100 100 extern u32 cm_read_mod_reg(s16 module, u16 idx); 101 101 extern void cm_write_mod_reg(u32 val, s16 module, u16 idx); 102 + extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 103 + 104 + static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) 105 + { 106 + return cm_rmw_mod_reg_bits(bits, bits, module, idx); 107 + } 108 + 109 + static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) 110 + { 111 + return cm_rmw_mod_reg_bits(bits, 0x0, module, idx); 112 + } 102 113 103 114 #endif 104 115
+38 -7
arch/arm/mach-omap2/prcm.c
··· 28 28 static void __iomem *prm_base; 29 29 static void __iomem *cm_base; 30 30 31 - extern void omap2_clk_prepare_for_reboot(void); 32 - 33 31 u32 omap_prcm_get_reset_sources(void) 34 32 { 33 + /* XXX This presumably needs modification for 34XX */ 35 34 return prm_read_mod_reg(WKUP_MOD, RM_RSTST) & 0x7f; 36 35 } 37 36 EXPORT_SYMBOL(omap_prcm_get_reset_sources); ··· 38 39 /* Resets clock rates and reboots the system. Only called from system.h */ 39 40 void omap_prcm_arch_reset(char mode) 40 41 { 41 - u32 wkup; 42 + s16 prcm_offs; 42 43 omap2_clk_prepare_for_reboot(); 43 44 44 - if (cpu_is_omap24xx()) { 45 - wkup = prm_read_mod_reg(WKUP_MOD, RM_RSTCTRL) | OMAP_RST_DPLL3; 46 - prm_write_mod_reg(wkup, WKUP_MOD, RM_RSTCTRL); 47 - } 45 + if (cpu_is_omap24xx()) 46 + prcm_offs = WKUP_MOD; 47 + else if (cpu_is_omap34xx()) 48 + prcm_offs = OMAP3430_GR_MOD; 49 + else 50 + WARN_ON(1); 51 + 52 + prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL); 48 53 } 49 54 50 55 static inline u32 __omap_prcm_read(void __iomem *base, s16 module, u16 reg) ··· 78 75 } 79 76 EXPORT_SYMBOL(prm_write_mod_reg); 80 77 78 + /* Read-modify-write a register in a PRM module. Caller must lock */ 79 + u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) 80 + { 81 + u32 v; 82 + 83 + v = prm_read_mod_reg(module, idx); 84 + v &= ~mask; 85 + v |= bits; 86 + prm_write_mod_reg(v, module, idx); 87 + 88 + return v; 89 + } 90 + EXPORT_SYMBOL(prm_rmw_mod_reg_bits); 91 + 81 92 /* Read a register in a CM module */ 82 93 u32 cm_read_mod_reg(s16 module, u16 idx) 83 94 { ··· 105 88 __omap_prcm_write(val, cm_base, module, idx); 106 89 } 107 90 EXPORT_SYMBOL(cm_write_mod_reg); 91 + 92 + /* Read-modify-write a register in a CM module. Caller must lock */ 93 + u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) 94 + { 95 + u32 v; 96 + 97 + v = cm_read_mod_reg(module, idx); 98 + v &= ~mask; 99 + v |= bits; 100 + cm_write_mod_reg(v, module, idx); 101 + 102 + return v; 103 + } 104 + EXPORT_SYMBOL(cm_rmw_mod_reg_bits); 108 105 109 106 void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals) 110 107 {
+12
arch/arm/mach-omap2/prm.h
··· 168 168 /* Power/reset management domain register get/set */ 169 169 extern u32 prm_read_mod_reg(s16 module, u16 idx); 170 170 extern void prm_write_mod_reg(u32 val, s16 module, u16 idx); 171 + extern u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 172 + 173 + /* Read-modify-write bits in a PRM register (by domain) */ 174 + static inline u32 prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) 175 + { 176 + return prm_rmw_mod_reg_bits(bits, bits, module, idx); 177 + } 178 + 179 + static inline u32 prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) 180 + { 181 + return prm_rmw_mod_reg_bits(bits, 0x0, module, idx); 182 + } 171 183 172 184 #endif 173 185