Commit af0ea23f authored by Paul Walmsley's avatar Paul Walmsley Committed by Tony Lindgren

OMAP2/3 clock: remove omap2_get_clksel()

Remove omap2_get_clksel() and just use clk->clksel_reg and
clk->clksel_mask directly.
Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6f55ed7c
...@@ -726,23 +726,6 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div) ...@@ -726,23 +726,6 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
return clkr->val; return clkr->val;
} }
/**
* omap2_get_clksel - find clksel register addr & field mask for a clk
* @clk: struct clk to use
* @field_mask: ptr to u32 to store the register field mask
*
* Returns the address of the clksel register upon success or NULL on error.
*/
static void __iomem *omap2_get_clksel(struct clk *clk, u32 *field_mask)
{
if (unlikely((clk->clksel_reg == NULL) || (clk->clksel_mask == NULL)))
return NULL;
*field_mask = clk->clksel_mask;
return clk->clksel_reg;
}
/** /**
* omap2_clksel_get_divisor - get current divider applied to parent clock. * omap2_clksel_get_divisor - get current divider applied to parent clock.
* @clk: OMAP struct clk to use. * @clk: OMAP struct clk to use.
...@@ -751,41 +734,36 @@ static void __iomem *omap2_get_clksel(struct clk *clk, u32 *field_mask) ...@@ -751,41 +734,36 @@ static void __iomem *omap2_get_clksel(struct clk *clk, u32 *field_mask)
*/ */
u32 omap2_clksel_get_divisor(struct clk *clk) u32 omap2_clksel_get_divisor(struct clk *clk)
{ {
u32 field_mask, v; u32 v;
void __iomem *div_addr;
div_addr = omap2_get_clksel(clk, &field_mask); if (!clk->clksel_mask)
if (div_addr == NULL)
return 0; return 0;
v = __raw_readl(div_addr) & field_mask; v = __raw_readl(clk->clksel_reg) & clk->clksel_mask;
v >>= __ffs(field_mask); v >>= __ffs(clk->clksel_mask);
return omap2_clksel_to_divisor(clk, v); return omap2_clksel_to_divisor(clk, v);
} }
int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
{ {
u32 field_mask, field_val, validrate, new_div = 0; u32 v, field_val, validrate, new_div = 0;
void __iomem *div_addr;
u32 v;
validrate = omap2_clksel_round_rate_div(clk, rate, &new_div); if (!clk->clksel_mask)
if (validrate != rate)
return -EINVAL; return -EINVAL;
div_addr = omap2_get_clksel(clk, &field_mask); validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
if (div_addr == NULL) if (validrate != rate)
return -EINVAL; return -EINVAL;
field_val = omap2_divisor_to_clksel(clk, new_div); field_val = omap2_divisor_to_clksel(clk, new_div);
if (field_val == ~0) if (field_val == ~0)
return -EINVAL; return -EINVAL;
v = __raw_readl(div_addr); v = __raw_readl(clk->clksel_reg);
v &= ~field_mask; v &= ~clk->clksel_mask;
v |= field_val << __ffs(field_mask); v |= field_val << __ffs(clk->clksel_mask);
__raw_writel(v, div_addr); __raw_writel(v, clk->clksel_reg);
wmb(); wmb();
......
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