int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
{
- u32 field_mask, field_val, reg_val, validrate, new_div = 0;
+ u32 field_mask, field_val, validrate, new_div = 0;
void __iomem *div_addr;
validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
if (field_val == ~0)
return -EINVAL;
- reg_val = cm_read_reg(div_addr);
- reg_val &= ~field_mask;
- reg_val |= (field_val << __ffs(field_mask));
- cm_write_reg(reg_val, div_addr);
+ cm_rmw_reg_bits(field_mask, field_val << __ffs(field_mask), div_addr);
+
wmb();
clk->rate = clk->parent->rate / new_div;
static int omap2_enable_osc_ck(struct clk *clk)
{
- u32 pcc;
- pcc = prm_read_reg(OMAP24XX_PRCM_CLKSRC_CTRL);
-
- prm_write_reg(pcc & ~OMAP_AUTOEXTCLKMODE_MASK,
- OMAP24XX_PRCM_CLKSRC_CTRL);
+ prm_rmw_reg_bits(OMAP_AUTOEXTCLKMODE_MASK, ~OMAP_AUTOEXTCLKMODE_MASK,
+ OMAP24XX_PRCM_CLKSRC_CTRL);
return 0;
}
static void omap2_disable_osc_ck(struct clk *clk)
{
- u32 pcc;
-
- pcc = prm_read_reg(OMAP24XX_PRCM_CLKSRC_CTRL);
-
- prm_write_reg(pcc | OMAP_AUTOEXTCLKMODE_MASK,
- OMAP24XX_PRCM_CLKSRC_CTRL);
+ prm_rmw_reg_bits(OMAP_AUTOEXTCLKMODE_MASK, OMAP_AUTOEXTCLKMODE_MASK,
+ OMAP24XX_PRCM_CLKSRC_CTRL);
}
/* Enable an APLL if off */
{
const struct omap_serial_console_config *conf;
char name[16];
- u32 l;
conf = omap_get_config(OMAP_TAG_SERIAL_CONSOLE,
struct omap_serial_console_config);
}
switch (serial_console_uart) {
case 1:
- l = prm_read_mod_reg(CORE_MOD, PM_WKEN1);
- l |= OMAP24XX_ST_UART1;
- prm_write_mod_reg(l, CORE_MOD, PM_WKEN1);
+ prm_set_mod_reg_bits(OMAP24XX_ST_UART1, CORE_MOD, PM_WKEN1)
break;
case 2:
- l = prm_read_mod_reg(CORE_MOD, PM_WKEN1);
- l |= OMAP24XX_ST_UART2;
- prm_write_mod_reg(l, CORE_MOD, PM_WKEN1);
+ prm_set_mod_reg_bits(OMAP24XX_ST_UART2, CORE_MOD, PM_WKEN1)
break;
case 3:
- l = prm_read_mod_reg(CORE_MOD, OMAP24XX_PM_WKEN2);
- l |= OMAP24XX_ST_UART3;
- prm_write_mod_reg(l, CORE_MOD, OMAP24XX_PM_WKEN2);
+ prm_set_mod_reg_bits(OMAP24XX_ST_UART3, CORE_MOD, PM_WKEN2)
break;
}
}
prm_write_mod_reg(0xffffffff, CORE_MOD, PM_WKST1);
prm_write_mod_reg(0xffffffff, CORE_MOD, OMAP24XX_PM_WKST2);
- /* wakeup domain events */
- l = prm_read_mod_reg(WKUP_MOD, PM_WKST);
- l &= 0x5; /* bit 1: GPT1, bit5 GPIO */
- prm_write_mod_reg(l, WKUP_MOD, PM_WKST);
+ /* wakeup domain events - bit 1: GPT1, bit5 GPIO */
+ prm_clear_mod_reg_bits(0x4 | 0x1, WKUP_MOD, PM_WKST);
/* MPU domain wake events */
l = prm_read_reg(OMAP24XX_PRCM_IRQSTATUS_MPU);
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);
/* 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);
+ prcm_offs = WKUP_MOD;
} else if (cpu_is_omap34xx()) {
- wkup = prm_read_mod_reg(OMAP3430_GR_MOD, RM_RSTCTRL)
- | OMAP_RST_DPLL3;
- prm_write_mod_reg(wkup, OMAP3430_GR_MOD, RM_RSTCTRL);
+ prcm_offs = OMAP3430_GR_MOD;
+ } else {
+ WARN_ON(1);
}
+
+ prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
}
#elif defined(CONFIG_ARCH_OMAP2)
static inline void dsp_clk_enable(void)
{
- u32 r;
-
/*XXX should be handled in mach-omap[1,2] XXX*/
prm_write_mod_reg(OMAP24XX_FORCESTATE | (1 << OMAP_POWERSTATE_SHIFT),
OMAP24XX_DSP_MOD, PM_PWSTCTRL);
- r = cm_read_mod_reg(OMAP24XX_DSP_MOD, CM_AUTOIDLE);
- r |= OMAP2420_AUTO_DSP_IPI;
- cm_write_mod_reg(r, OMAP24XX_DSP_MOD, CM_AUTOIDLE);
+ cm_set_mod_reg_bits(OMAP2420_AUTO_DSP_IPI, OMAP24XX_DSP_MOD,
+ CM_AUTOIDLE);
- r = cm_read_mod_reg(OMAP24XX_DSP_MOD, CM_CLKSTCTRL);
- r |= OMAP24XX_AUTOSTATE_DSP;
- cm_write_mod_reg(r, OMAP24XX_DSP_MOD, CM_CLKSTCTRL);
+ cm_set_mod_reg_bits(OMAP24XX_AUTOSTATE_DSP, OMAP24XX_DSP_MOD,
+ CM_CLKSTCTRL);
clk_enable(dsp_fck_handle);
clk_enable(dsp_ick_handle);