All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mike Turquette <mturquette@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Rob Herring <robh+dt@kernel.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2] clk-rcar-gen2: ADSP clock support
Date: Mon, 05 Jan 2015 14:00:01 +0000	[thread overview]
Message-ID: <54AA98E1.704@cogentembedded.com> (raw)
In-Reply-To: <CAMuHMdXW=_bYbdUGB2TBPFNfz9gBB+AyD1mWyoKD9eFxebma5w@mail.gmail.com>

Hello.

On 1/5/2015 4:13 PM, Geert Uytterhoeven wrote:

>> Add the ADSP clock support to the R-Car generation 2 CPG driver.  This clock
>> gets derived from  PLL1.  The layout of the ADSPCKCR register is  similar to
>> those of the clocks supported by the 'clk-div6' driver but the divider encoding
>> is non-linear, so can't be supported by that driver...

>> Based on the original patch by Konstantin Kozhevnikov
>> <konstantin.kozhevnikov@cogentembedded.com>.

>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

>> ---
>> The patch is against the 'clk-next' branch of Mike Turquette's 'linux.git' repo
>> plus the RCAN clock support patch posted last week.

>> Changes in version 2:
>> - swapped "adsp" and "rcan" in the binding document.

>> +++ linux/drivers/clk/shmobile/clk-rcar-gen2.c
>> @@ -33,6 +33,7 @@ struct rcar_gen2_cpg {
[...]
>> @@ -162,6 +163,51 @@ static struct clk * __init cpg_z_clk_reg
>>          return clk;
>>   }
>>
>> +/* ADSP divisors */
>> +static const struct clk_div_table cpg_adsp_div_table[] = {
>> +       {  1,  3 }, {  2,  4 }, {  3,  6 }, {  4,  8 },
>> +       {  5, 12 }, {  6, 16 }, {  7, 18 }, {  8, 24 },
>> +       { 10, 36 }, { 11, 48 }, {  0,  0 },
>> +};
>> +
>> +static struct clk * __init cpg_adsp_clk_register(struct rcar_gen2_cpg *cpg)
>> +{
>> +       const char *parent_name = "pll1";
>> +       struct clk_divider *div;
>> +       struct clk_gate *gate;
>> +       struct clk *clk;
>> +
>> +       div = kzalloc(sizeof(*div), GFP_KERNEL);
>> +       if (!div)
>> +               return ERR_PTR(-ENOMEM);
>> +
>> +       div->reg = cpg->reg + CPG_ADSPCKCR;
>> +       div->width = 4;
>> +       div->table = cpg_adsp_div_table;
>> +       div->lock = &cpg->lock;
>> +
>> +       gate = kzalloc(sizeof(*gate), GFP_KERNEL);
>> +       if (!gate) {
>> +               kfree(div);
>> +               return ERR_PTR(-ENOMEM);
>> +       }
>> +
>> +       gate->reg = cpg->reg + CPG_RCANCKCR;

> Shouldn't this be CPG_ADSPCKCR?

    Oops! At least I did it right for the divider component. :-)

>> +       gate->bit_idx = 8;
>> +       gate->flags = CLK_GATE_SET_TO_DISABLE;
>> +       gate->lock = &cpg->lock;
>> +
>> +       clk = clk_register_composite(NULL, "adsp", &parent_name, 1, NULL, NULL,
>> +                                    &div->hw, &clk_divider_ops,
>> +                                    &gate->hw, &clk_gate_ops, 0);
>> +       if (IS_ERR(clk)) {
>> +               kfree(gate);
>> +               kfree(div);
>> +       }
>> +
>> +       return clk;
>> +}

> Please insert the adsp code after the rcan code, to match the clock order
> in bindings and #defines.

    OK. I placed it basing on the register offset...

[...]
>> @@ -301,6 +347,8 @@ rcar_gen2_cpg_register_clock(struct devi
>>                  shift = 0;
>>          } else if (!strcmp(name, "z")) {
>>                  return cpg_z_clk_register(cpg);
>> +       } else if (!strcmp(name, "adsp")) {
>> +               return cpg_adsp_clk_register(cpg);

> Please insert the adsp code after the rcan code.

    OK.

WBR, Sergei


WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mike Turquette <mturquette@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Rob Herring <robh+dt@kernel.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2] clk-rcar-gen2: ADSP clock support
Date: Mon, 05 Jan 2015 17:00:01 +0300	[thread overview]
Message-ID: <54AA98E1.704@cogentembedded.com> (raw)
In-Reply-To: <CAMuHMdXW=_bYbdUGB2TBPFNfz9gBB+AyD1mWyoKD9eFxebma5w@mail.gmail.com>

Hello.

On 1/5/2015 4:13 PM, Geert Uytterhoeven wrote:

>> Add the ADSP clock support to the R-Car generation 2 CPG driver.  This clock
>> gets derived from  PLL1.  The layout of the ADSPCKCR register is  similar to
>> those of the clocks supported by the 'clk-div6' driver but the divider encoding
>> is non-linear, so can't be supported by that driver...

>> Based on the original patch by Konstantin Kozhevnikov
>> <konstantin.kozhevnikov@cogentembedded.com>.

>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

>> ---
>> The patch is against the 'clk-next' branch of Mike Turquette's 'linux.git' repo
>> plus the RCAN clock support patch posted last week.

>> Changes in version 2:
>> - swapped "adsp" and "rcan" in the binding document.

>> +++ linux/drivers/clk/shmobile/clk-rcar-gen2.c
>> @@ -33,6 +33,7 @@ struct rcar_gen2_cpg {
[...]
>> @@ -162,6 +163,51 @@ static struct clk * __init cpg_z_clk_reg
>>          return clk;
>>   }
>>
>> +/* ADSP divisors */
>> +static const struct clk_div_table cpg_adsp_div_table[] = {
>> +       {  1,  3 }, {  2,  4 }, {  3,  6 }, {  4,  8 },
>> +       {  5, 12 }, {  6, 16 }, {  7, 18 }, {  8, 24 },
>> +       { 10, 36 }, { 11, 48 }, {  0,  0 },
>> +};
>> +
>> +static struct clk * __init cpg_adsp_clk_register(struct rcar_gen2_cpg *cpg)
>> +{
>> +       const char *parent_name = "pll1";
>> +       struct clk_divider *div;
>> +       struct clk_gate *gate;
>> +       struct clk *clk;
>> +
>> +       div = kzalloc(sizeof(*div), GFP_KERNEL);
>> +       if (!div)
>> +               return ERR_PTR(-ENOMEM);
>> +
>> +       div->reg = cpg->reg + CPG_ADSPCKCR;
>> +       div->width = 4;
>> +       div->table = cpg_adsp_div_table;
>> +       div->lock = &cpg->lock;
>> +
>> +       gate = kzalloc(sizeof(*gate), GFP_KERNEL);
>> +       if (!gate) {
>> +               kfree(div);
>> +               return ERR_PTR(-ENOMEM);
>> +       }
>> +
>> +       gate->reg = cpg->reg + CPG_RCANCKCR;

> Shouldn't this be CPG_ADSPCKCR?

    Oops! At least I did it right for the divider component. :-)

>> +       gate->bit_idx = 8;
>> +       gate->flags = CLK_GATE_SET_TO_DISABLE;
>> +       gate->lock = &cpg->lock;
>> +
>> +       clk = clk_register_composite(NULL, "adsp", &parent_name, 1, NULL, NULL,
>> +                                    &div->hw, &clk_divider_ops,
>> +                                    &gate->hw, &clk_gate_ops, 0);
>> +       if (IS_ERR(clk)) {
>> +               kfree(gate);
>> +               kfree(div);
>> +       }
>> +
>> +       return clk;
>> +}

> Please insert the adsp code after the rcan code, to match the clock order
> in bindings and #defines.

    OK. I placed it basing on the register offset...

[...]
>> @@ -301,6 +347,8 @@ rcar_gen2_cpg_register_clock(struct devi
>>                  shift = 0;
>>          } else if (!strcmp(name, "z")) {
>>                  return cpg_z_clk_register(cpg);
>> +       } else if (!strcmp(name, "adsp")) {
>> +               return cpg_adsp_clk_register(cpg);

> Please insert the adsp code after the rcan code.

    OK.

WBR, Sergei

  reply	other threads:[~2015-01-05 14:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30 20:51 [PATCH v2] clk-rcar-gen2: ADSP clock support Sergei Shtylyov
2014-12-30 20:51 ` Sergei Shtylyov
2015-01-05 13:13 ` Geert Uytterhoeven
2015-01-05 13:13   ` Geert Uytterhoeven
2015-01-05 14:00   ` Sergei Shtylyov [this message]
2015-01-05 14:00     ` Sergei Shtylyov
2015-01-06 22:38 ` Sergei Shtylyov
2015-01-06 22:38   ` Sergei Shtylyov

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=54AA98E1.704@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=geert@linux-m68k.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.