linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 2/6] sh: add a reparent function to DIV6 clocks
Date: Fri, 02 Jul 2010 08:17:09 +0000	[thread overview]
Message-ID: <AANLkTimOUjFadAxidYGQ2UyL6kewKXOdb1iX3jJHvh7K@mail.gmail.com> (raw)

On Wed, Jun 30, 2010 at 6:55 PM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Add support for reparenting of div6 clocks on SuperH and SH-Mobile SoCs.
>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  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

             reply	other threads:[~2010-07-02  8:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02  8:17 Magnus Damm [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-06-30  9:55 [PATCH 2/6] sh: add a reparent function to DIV6 clocks Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimOUjFadAxidYGQ2UyL6kewKXOdb1iX3jJHvh7K@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).