Commit 212f86f4 authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

omap2 clock: use custom osc_ck enable/disable routines

Now that we're paying attention to the .enable/.disable fields in struct
clk, convert the osc_ck enable and disable code to use this standard
mechanism.  (osc_ck enable/disable does not technically enable or disable
the osc_ck; it actually enables/disables autoidling.)
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent bde012e1
...@@ -163,18 +163,26 @@ static void omap2_fixed_divisor_recalc(struct clk *clk) ...@@ -163,18 +163,26 @@ static void omap2_fixed_divisor_recalc(struct clk *clk)
propagate_rate(clk); propagate_rate(clk);
} }
static void omap2_set_osc_ck(int enable) static int omap2_enable_osc_ck(struct clk *clk)
{ {
u32 pcc; u32 pcc;
pcc = prm_read_reg(OMAP24XX_PRCM_CLKSRC_CTRL); pcc = prm_read_reg(OMAP24XX_PRCM_CLKSRC_CTRL);
if (enable) prm_write_reg(pcc & ~OMAP_AUTOEXTCLKMODE_MASK,
prm_write_reg(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, OMAP24XX_PRCM_CLKSRC_CTRL);
OMAP24XX_PRCM_CLKSRC_CTRL);
else return 0;
prm_write_reg(pcc | OMAP_AUTOEXTCLKMODE_MASK, }
OMAP24XX_PRCM_CLKSRC_CTRL);
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);
} }
/* /*
...@@ -272,11 +280,6 @@ static int _omap2_clk_enable(struct clk * clk) ...@@ -272,11 +280,6 @@ static int _omap2_clk_enable(struct clk * clk)
if (clk->flags & (ALWAYS_ENABLED | PARENT_CONTROLS_CLOCK)) if (clk->flags & (ALWAYS_ENABLED | PARENT_CONTROLS_CLOCK))
return 0; return 0;
if (unlikely(clk == &osc_ck)) {
omap2_set_osc_ck(1);
return 0;
}
if (clk->enable) if (clk->enable)
return clk->enable(clk); return clk->enable(clk);
...@@ -324,11 +327,6 @@ static void _omap2_clk_disable(struct clk *clk) ...@@ -324,11 +327,6 @@ static void _omap2_clk_disable(struct clk *clk)
return; return;
} }
if (unlikely(clk == &osc_ck)) {
omap2_set_osc_ck(0);
return;
}
if (clk->enable_reg == 0) { if (clk->enable_reg == 0) {
/* /*
* 'Independent' here refers to a clock which is not * 'Independent' here refers to a clock which is not
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "prm_regbits_24xx.h" #include "prm_regbits_24xx.h"
#include "cm_regbits_24xx.h" #include "cm_regbits_24xx.h"
static void omap2_sys_clk_recalc(struct clk * clk);
static void omap2_clksel_recalc(struct clk * clk); static void omap2_clksel_recalc(struct clk * clk);
static void omap2_table_mpu_recalc(struct clk *clk); static void omap2_table_mpu_recalc(struct clk *clk);
static int omap2_select_table_rate(struct clk * clk, unsigned long rate); static int omap2_select_table_rate(struct clk * clk, unsigned long rate);
...@@ -42,6 +41,8 @@ static void omap2_fixed_divisor_recalc(struct clk *clk); ...@@ -42,6 +41,8 @@ static void omap2_fixed_divisor_recalc(struct clk *clk);
static long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); static long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
static int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); static int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate); static int omap2_reprogram_dpll(struct clk *clk, unsigned long rate);
static int omap2_enable_osc_ck(struct clk *clk);
static void omap2_disable_osc_ck(struct clk *clk);
/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated. /* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
* xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
...@@ -598,6 +599,8 @@ static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ ...@@ -598,6 +599,8 @@ static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
.rate = 26000000, /* fixed up in clock init */ .rate = 26000000, /* fixed up in clock init */
.flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
RATE_FIXED | RATE_PROPAGATES, RATE_FIXED | RATE_PROPAGATES,
.enable = &omap2_enable_osc_ck,
.disable = &omap2_disable_osc_ck,
.recalc = &propagate_rate, .recalc = &propagate_rate,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment