Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 313752
b: refs/heads/master
c: 75f5f8a
h: refs/heads/master
v: v3
  • Loading branch information
Paul Mundt committed May 25, 2012
1 parent 7a1edd6 commit fec1f90
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 37 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1111cc1e8080b5ff46f5b945acb2f99d6176b2d1
refs/heads/master: 75f5f8a56e0fdf6d32b3ae9c44c10bc0acd3857c
62 changes: 26 additions & 36 deletions trunk/drivers/sh/clk/cpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ int __init sh_clk_mstp_register(struct clk *clks, int nr)
return ret;
}

static long sh_clk_div_round_rate(struct clk *clk, unsigned long rate)
{
return clk_rate_table_round(clk, clk->freq_table, rate);
}

/*
* Div/mult table lookup helpers
*/
Expand All @@ -84,6 +79,27 @@ static inline struct clk_div_mult_table *clk_to_div_mult_table(struct clk *clk)
return clk_to_div_table(clk)->div_mult_table;
}

/*
* Common div ops
*/
static long sh_clk_div_round_rate(struct clk *clk, unsigned long rate)
{
return clk_rate_table_round(clk, clk->freq_table, rate);
}

static unsigned long sh_clk_div_recalc(struct clk *clk)
{
struct clk_div_mult_table *table = clk_to_div_mult_table(clk);
unsigned int idx;

clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
table, clk->arch_flags ? &clk->arch_flags : NULL);

idx = (sh_clk_read(clk) >> clk->enable_bit) & clk->div_mask;

return clk->freq_table[idx].frequency;
}

/*
* div6 support
*/
Expand All @@ -103,19 +119,6 @@ static struct clk_div_table sh_clk_div6_table = {
.div_mult_table = &div6_div_mult_table,
};

static unsigned long sh_clk_div6_recalc(struct clk *clk)
{
struct clk_div_mult_table *table = clk_to_div_mult_table(clk);
unsigned int idx;

clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
table, NULL);

idx = sh_clk_read(clk) & clk->div_mask;

return clk->freq_table[idx].frequency;
}

static int sh_clk_div6_set_parent(struct clk *clk, struct clk *parent)
{
struct clk_div_mult_table *table = clk_to_div_mult_table(clk);
Expand Down Expand Up @@ -190,15 +193,15 @@ static void sh_clk_div6_disable(struct clk *clk)
}

static struct sh_clk_ops sh_clk_div6_clk_ops = {
.recalc = sh_clk_div6_recalc,
.recalc = sh_clk_div_recalc,
.round_rate = sh_clk_div_round_rate,
.set_rate = sh_clk_div6_set_rate,
.enable = sh_clk_div6_enable,
.disable = sh_clk_div6_disable,
};

static struct sh_clk_ops sh_clk_div6_reparent_clk_ops = {
.recalc = sh_clk_div6_recalc,
.recalc = sh_clk_div_recalc,
.round_rate = sh_clk_div_round_rate,
.set_rate = sh_clk_div6_set_rate,
.enable = sh_clk_div6_enable,
Expand Down Expand Up @@ -287,19 +290,6 @@ int __init sh_clk_div6_reparent_register(struct clk *clks, int nr)
/*
* div4 support
*/
static unsigned long sh_clk_div4_recalc(struct clk *clk)
{
struct clk_div_mult_table *table = clk_to_div_mult_table(clk);
unsigned int idx;

clk_rate_table_build(clk, clk->freq_table, table->nr_divisors,
table, &clk->arch_flags);

idx = (sh_clk_read(clk) >> clk->enable_bit) & clk->div_mask;

return clk->freq_table[idx].frequency;
}

static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent)
{
struct clk_div_mult_table *table = clk_to_div_mult_table(clk);
Expand Down Expand Up @@ -361,21 +351,21 @@ static void sh_clk_div4_disable(struct clk *clk)
}

static struct sh_clk_ops sh_clk_div4_clk_ops = {
.recalc = sh_clk_div4_recalc,
.recalc = sh_clk_div_recalc,
.set_rate = sh_clk_div4_set_rate,
.round_rate = sh_clk_div_round_rate,
};

static struct sh_clk_ops sh_clk_div4_enable_clk_ops = {
.recalc = sh_clk_div4_recalc,
.recalc = sh_clk_div_recalc,
.set_rate = sh_clk_div4_set_rate,
.round_rate = sh_clk_div_round_rate,
.enable = sh_clk_div4_enable,
.disable = sh_clk_div4_disable,
};

static struct sh_clk_ops sh_clk_div4_reparent_clk_ops = {
.recalc = sh_clk_div4_recalc,
.recalc = sh_clk_div_recalc,
.set_rate = sh_clk_div4_set_rate,
.round_rate = sh_clk_div_round_rate,
.enable = sh_clk_div4_enable,
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/sh_clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
_num_parents, _src_shift, _src_width) \
{ \
.enable_reg = (void __iomem *)_reg, \
.enable_bit = 0, /* unused */ \
.flags = _flags, \
.div_mask = SH_CLK_DIV6_MSK, \
.parent_table = _parents, \
Expand All @@ -184,6 +185,7 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
{ \
.parent = _parent, \
.enable_reg = (void __iomem *)_reg, \
.enable_bit = 0, /* unused */ \
.div_mask = SH_CLK_DIV6_MSK, \
.flags = _flags, \
}
Expand Down

0 comments on commit fec1f90

Please sign in to comment.