Commit 1bb9aa8f authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

omap2 clock: From: Paul Walmsley <paul@pwsan.com> Subject:

Clean up omap2_clk_set_parent() by bailing out early if the clock is not
parent-selectable.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent fc1c145e
...@@ -913,63 +913,56 @@ static u32 omap2_get_src_field(u32 *type_to_addr, u32 reg_offset, ...@@ -913,63 +913,56 @@ static u32 omap2_get_src_field(u32 *type_to_addr, u32 reg_offset,
static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
{ {
void __iomem * reg; void __iomem * reg;
u32 src_sel, src_off, field_val, field_mask, reg_val, rate; u32 src_sel, src_off, field_val, field_mask, reg_val;
int ret = -EINVAL; int ret = -EINVAL;
if (unlikely(clk->flags & CONFIG_PARTICIPANT)) if (unlikely(clk->flags & CONFIG_PARTICIPANT))
return ret; return ret;
if (clk->flags & SRC_SEL_MASK) { /* On-chip SEL collection */ if (unlikely(!(clk->flags & SRC_SEL_MASK)))
src_sel = (SRC_RATE_SEL_MASK & clk->flags); return ret;
src_off = clk->src_offset;
if (src_sel == 0) src_sel = (SRC_RATE_SEL_MASK & clk->flags);
goto set_parent_error; src_off = clk->src_offset;
field_val = omap2_get_src_field(&src_sel, src_off, new_parent, if (src_sel == 0)
&field_mask); return ret;
reg = (void __iomem *)src_sel; field_val = omap2_get_src_field(&src_sel, src_off, new_parent,
&field_mask);
if (clk->usecount > 0) reg = (void __iomem *)src_sel;
_omap2_clk_disable(clk);
/* Set new source value (previous dividers if any in effect) */ if (clk->usecount > 0)
reg_val = __raw_readl(reg) & ~(field_mask << src_off); _omap2_clk_disable(clk);
reg_val |= (field_val << src_off);
__raw_writel(reg_val, reg);
wmb();
if (clk->flags & DELAYED_APP) { /* Set new source value (previous dividers if any in effect) */
prm_write_reg(OMAP24XX_VALID_CONFIG, reg_val = __raw_readl(reg) & ~(field_mask << src_off);
OMAP24XX_PRCM_CLKCFG_CTRL); reg_val |= (field_val << src_off);
wmb(); __raw_writel(reg_val, reg);
} wmb();
if (clk->usecount > 0)
_omap2_clk_enable(clk);
clk->parent = new_parent; if (clk->flags & DELAYED_APP) {
prm_write_reg(OMAP24XX_VALID_CONFIG,
OMAP24XX_PRCM_CLKCFG_CTRL);
wmb();
}
if (clk->usecount > 0)
_omap2_clk_enable(clk);
/* SRC_RATE_SEL_MASK clocks follow their parents rates.*/ clk->parent = new_parent;
if ((new_parent == &core_ck) &&
(clk == &dss1_fck || clk == &vlynq_fck))
clk->rate = new_parent->rate / 0x10;
else
clk->rate = new_parent->rate;
if (unlikely(clk->flags & RATE_PROPAGATES)) /* SRC_RATE_SEL_MASK clocks follow their parents rates.*/
propagate_rate(clk); if ((new_parent == &core_ck) &&
(clk == &dss1_fck || clk == &vlynq_fck))
clk->rate = new_parent->rate / 0x10;
else
clk->rate = new_parent->rate;
return 0; if (unlikely(clk->flags & RATE_PROPAGATES))
} else { propagate_rate(clk);
clk->parent = new_parent;
rate = new_parent->rate;
omap2_clk_set_rate(clk, rate);
ret = 0;
}
set_parent_error: return 0;
return ret;
} }
/* Sets basic clocks based on the specified rate */ /* Sets basic clocks based on the specified 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