Re: [PATCH 2/6] sh: add a reparent function to DIV6 clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 30, 2010 at 6:55 PM, Guennadi Liakhovetski
<g.liakhovetski@xxxxxx> wrote:
> Add support for reparenting of div6 clocks on SuperH and SH-Mobile SoCs.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
> ---
>  drivers/sh/clk-cpg.c   |   58 ++++++++++++++++++++++++++++++++++++++++++++++-
>  include/linux/sh_clk.h |   19 +++++++++++----
>  2 files changed, 70 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/sh/clk-cpg.c b/drivers/sh/clk-cpg.c
> index f5c80ba..7e247ae 100644
> --- a/drivers/sh/clk-cpg.c
> +++ b/drivers/sh/clk-cpg.c
> @@ -68,6 +68,39 @@ static unsigned long sh_clk_div6_recalc(struct clk *clk)
>        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 = &sh_clk_div6_table;
> +       u32 value;
> +       int ret, i;
> +
> +       if (!clk->parent_table || !clk->parent_num)
> +               return -EINVAL;
> +
> +       /* Search the parent */
> +       for (i = 0; i < clk->parent_num; i++)
> +               if (clk->parent_table[i] == parent)
> +                       break;
> +
> +       if (i == clk->parent_num)
> +               return -ENODEV;
> +
> +       ret = clk_reparent(clk, parent);
> +       if (ret < 0)
> +               return ret;
> +
> +       value = __raw_readl(clk->enable_reg) &
> +               ~(((1 << clk->src_width) - 1) << clk->src_shift);
> +
> +       __raw_writel(value | (i << clk->src_shift), clk->enable_reg);
> +
> +       /* Rebiuld the frequency table */

Nit: Typo in the comment above.

Looks ok apart from that.

Cheers,

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Tourism]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux