All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chao Xie" <xiechao_mail@163.com>
To: "Mike Turquette" <mturquette@linaro.org>
Cc: "Chao Xie" <chao.xie@marvell.com>,
	haojian.zhuang@gmail.com, haojian.zhuang@linaro.org,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH 06/12] clk: mmp: add mmp private gate clock
Date: Thu, 4 Sep 2014 12:02:11 +0800 (CST)	[thread overview]
Message-ID: <479e7ccf.16dee.1483ed3a882.Coremail.xiechao_mail@163.com> (raw)
In-Reply-To: <20140903175537.11368.98589@quantum>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GBK, Size: 2488 bytes --]



At 2014-09-04 01:55:37, "Mike Turquette" <mturquette@linaro.org> wrote:
>Quoting Chao Xie (2014-08-25 21:38:18)
>> From: Chao Xie <chao.xie@marvell.com>
>> 
>> Some SOCes have this kind of the gate clock
>> 1. There are some bits to control the gate not only one bit.
>> 2. Some clocks has operations of "out of reset" and "enable".
>>    To enable clock, we need do "out of reset" and "enable".
>>    To disable clock, we may not need "set to reset". It depends
>>    on the SOCes' design.
>
>Are there any other IP blocks affected by the "out of reset" and "set to
>reset" states? I wonder if you might benefit from the reset controller
>framework?  For example see,
>
>drivers/clk/qcom/gcc-apq8084.c
>
><snip>

>
Thanks to point it out.
To use the reset framework, there are some problem.
1. the reset bit is combined with the clocks disable/enable bits in same register. Seperating setting them means spinlock
protection and 2 operations for read-update the bits.


except that, i think reset framework can bring some benefits.


Even without the reset bit, we still need the gate clocks.
The enable/disable is not a bit operation, and it is bits operation for some devices.
In fact i want to use it to replace the old clk-apbc and clk-apmu clocks. 

>> +static int mmp_clk_gate_enable(struct clk_hw *hw)
>> +{
>> +       struct mmp_clk_gate *gate = to_clk_mmp_gate(hw);
>> +       struct clk *clk = hw->clk;
>> +       unsigned long flags = 0;
>> +       unsigned long rate;
>> +       u32 tmp;
>> +
>> +       if (gate->lock)
>> +               spin_lock_irqsave(gate->lock, flags);
>> +
>> +       tmp = readl(gate->reg);
>> +       tmp &= ~gate->mask;
>> +       tmp |= gate->val_enable;
>> +       writel(tmp, gate->reg);
>> +
>> +       if (gate->lock)
>> +               spin_unlock_irqrestore(gate->lock, flags);
>> +
>> +       if (gate->flags & MMP_CLK_GATE_NEED_DELAY) {
>> +               rate = __clk_get_rate(clk);
>> +               /* Need delay 2 cycles. */
>> +               udelay(2000000/rate);
>
>How long are these delays? Long enough to warrant using clk_prepare
>instead of clk_enable? Are these clocks enabled from interrupt context?

>
For power optimization, some clocks need to be enabled/disable in interrupt context.
The worst delay is rate=32KHZ, so the delay is 62.5us.

>Regards,
>Mike


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

WARNING: multiple messages have this Message-ID (diff)
From: "Chao Xie" <xiechao_mail-9Onoh4P/yGk@public.gmane.org>
To: Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Chao Xie <chao.xie-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	haojian.zhuang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re:Re: [PATCH 06/12] clk: mmp: add mmp private gate clock
Date: Thu, 4 Sep 2014 12:02:11 +0800 (CST)	[thread overview]
Message-ID: <479e7ccf.16dee.1483ed3a882.Coremail.xiechao_mail@163.com> (raw)
In-Reply-To: <20140903175537.11368.98589@quantum>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GBK, Size: 2462 bytes --]



At 2014-09-04 01:55:37, "Mike Turquette" <mturquette@linaro.org> wrote:
>Quoting Chao Xie (2014-08-25 21:38:18)
>> From: Chao Xie <chao.xie@marvell.com>
>> 
>> Some SOCes have this kind of the gate clock
>> 1. There are some bits to control the gate not only one bit.
>> 2. Some clocks has operations of "out of reset" and "enable".
>>    To enable clock, we need do "out of reset" and "enable".
>>    To disable clock, we may not need "set to reset". It depends
>>    on the SOCes' design.
>
>Are there any other IP blocks affected by the "out of reset" and "set to
>reset" states? I wonder if you might benefit from the reset controller
>framework?  For example see,
>
>drivers/clk/qcom/gcc-apq8084.c
>
><snip>

>
Thanks to point it out.
To use the reset framework, there are some problem.
1. the reset bit is combined with the clocks disable/enable bits in same register. Seperating setting them means spinlock
protection and 2 operations for read-update the bits.


except that, i think reset framework can bring some benefits.


Even without the reset bit, we still need the gate clocks.
The enable/disable is not a bit operation, and it is bits operation for some devices.
In fact i want to use it to replace the old clk-apbc and clk-apmu clocks. 

>> +static int mmp_clk_gate_enable(struct clk_hw *hw)
>> +{
>> +       struct mmp_clk_gate *gate = to_clk_mmp_gate(hw);
>> +       struct clk *clk = hw->clk;
>> +       unsigned long flags = 0;
>> +       unsigned long rate;
>> +       u32 tmp;
>> +
>> +       if (gate->lock)
>> +               spin_lock_irqsave(gate->lock, flags);
>> +
>> +       tmp = readl(gate->reg);
>> +       tmp &= ~gate->mask;
>> +       tmp |= gate->val_enable;
>> +       writel(tmp, gate->reg);
>> +
>> +       if (gate->lock)
>> +               spin_unlock_irqrestore(gate->lock, flags);
>> +
>> +       if (gate->flags & MMP_CLK_GATE_NEED_DELAY) {
>> +               rate = __clk_get_rate(clk);
>> +               /* Need delay 2 cycles. */
>> +               udelay(2000000/rate);
>
>How long are these delays? Long enough to warrant using clk_prepare
>instead of clk_enable? Are these clocks enabled from interrupt context?

>
For power optimization, some clocks need to be enabled/disable in interrupt context.
The worst delay is rate=32KHZ, so the delay is 62.5us.

>Regards,
>Mike


N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·zøœzÚÞz)í…æèw*\x1fjg¬±¨\x1e¶‰šŽŠÝ¢j.ïÛ°\½½MŽúgjÌæa×\x02››–' ™©Þ¢¸\f¢·¦j:+v‰¨ŠwèjØm¶Ÿÿ¾\a«‘êçzZ+ƒùšŽŠÝ¢j"ú!¶i

WARNING: multiple messages have this Message-ID (diff)
From: xiechao_mail@163.com (Chao Xie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/12] clk: mmp: add mmp private gate clock
Date: Thu, 4 Sep 2014 12:02:11 +0800 (CST)	[thread overview]
Message-ID: <479e7ccf.16dee.1483ed3a882.Coremail.xiechao_mail@163.com> (raw)
In-Reply-To: <20140903175537.11368.98589@quantum>



At 2014-09-04 01:55:37, "Mike Turquette" <mturquette@linaro.org> wrote:
>Quoting Chao Xie (2014-08-25 21:38:18)
>> From: Chao Xie <chao.xie@marvell.com>
>> 
>> Some SOCes have this kind of the gate clock
>> 1. There are some bits to control the gate not only one bit.
>> 2. Some clocks has operations of "out of reset" and "enable".
>>    To enable clock, we need do "out of reset" and "enable".
>>    To disable clock, we may not need "set to reset". It depends
>>    on the SOCes' design.
>
>Are there any other IP blocks affected by the "out of reset" and "set to
>reset" states? I wonder if you might benefit from the reset controller
>framework?  For example see,
>
>drivers/clk/qcom/gcc-apq8084.c
>
><snip>

>
Thanks to point it out.
To use the reset framework, there are some problem.
1. the reset bit is combined with the clocks disable/enable bits in same register. Seperating setting them means spinlock
protection and 2 operations for read-update the bits.


except that, i think reset framework can bring some benefits.


Even without the reset bit, we still need the gate clocks.
The enable/disable is not a bit operation, and it is bits operation for some devices.
In fact i want to use it to replace the old clk-apbc and clk-apmu clocks. 

>> +static int mmp_clk_gate_enable(struct clk_hw *hw)
>> +{
>> +       struct mmp_clk_gate *gate = to_clk_mmp_gate(hw);
>> +       struct clk *clk = hw->clk;
>> +       unsigned long flags = 0;
>> +       unsigned long rate;
>> +       u32 tmp;
>> +
>> +       if (gate->lock)
>> +               spin_lock_irqsave(gate->lock, flags);
>> +
>> +       tmp = readl(gate->reg);
>> +       tmp &= ~gate->mask;
>> +       tmp |= gate->val_enable;
>> +       writel(tmp, gate->reg);
>> +
>> +       if (gate->lock)
>> +               spin_unlock_irqrestore(gate->lock, flags);
>> +
>> +       if (gate->flags & MMP_CLK_GATE_NEED_DELAY) {
>> +               rate = __clk_get_rate(clk);
>> +               /* Need delay 2 cycles. */
>> +               udelay(2000000/rate);
>
>How long are these delays? Long enough to warrant using clk_prepare
>instead of clk_enable? Are these clocks enabled from interrupt context?

>
For power optimization, some clocks need to be enabled/disable in interrupt context.
The worst delay is rate=32KHZ, so the delay is 62.5us.

>Regards,
>Mike

  reply	other threads:[~2014-09-04  4:03 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26  4:38 [PATCH 00/12] clk: mmp: clock device tree support Chao Xie
2014-08-26  4:38 ` Chao Xie
2014-08-26  4:38 ` Chao Xie
2014-08-26  4:38 ` [PATCH 01/12] clk: mmp: add prefix "mmp" for structures defined for clk-frac Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 02/12] clk: mmp: add spin lock " Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-09-03 18:04   ` Mike Turquette
2014-09-03 18:04     ` Mike Turquette
2014-09-03 18:04     ` Mike Turquette
2014-09-10  1:30     ` Chao Xie
2014-09-10  1:30       ` Chao Xie
2014-09-10  1:30       ` Chao Xie
2014-08-26  4:38 ` [PATCH 03/12] clk: mmp: add init callback " Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 04/12] clk: mmp: move definiton of mmp_clk_frac to clk.h Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 05/12] clk: mmp: add clock type mix Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 06/12] clk: mmp: add mmp private gate clock Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-09-03 17:55   ` Mike Turquette
2014-09-03 17:55     ` Mike Turquette
2014-09-03 17:55     ` Mike Turquette
2014-09-04  4:02     ` Chao Xie [this message]
2014-09-04  4:02       ` Chao Xie
2014-09-04  4:02       ` Chao Xie
2014-09-04  4:16       ` Chen-Yu Tsai
2014-09-04  4:16         ` Chen-Yu Tsai
2014-09-04  4:16         ` Chen-Yu Tsai
2014-08-26  4:38 ` [PATCH 07/12] clk: mmp: add basic support functions for DT support Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 08/12] clk: mmp: add pxa168 DT support for clock driver Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 09/12] clk: mmp: add pxa910 " Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 10/12] clk: mmp: add mmp2 " Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 11/12] arm: mmp: Make all the dts file to be compiled by Makefile Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38 ` [PATCH 12/12] arm: mmp: Make use of the DT supported clock Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:38   ` Chao Xie
2014-08-26  4:55 ` [PATCH 00/12] clk: mmp: clock device tree support Haojian Zhuang
2014-08-26  4:55   ` Haojian Zhuang
2014-08-26  4:55   ` Haojian Zhuang

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=479e7ccf.16dee.1483ed3a882.Coremail.xiechao_mail@163.com \
    --to=xiechao_mail@163.com \
    --cc=chao.xie@marvell.com \
    --cc=devicetree@vger.kernel.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=haojian.zhuang@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@linaro.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.