linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 10/11] ARM: hi3xxx: add clk-hi3716
Date: Wed, 21 Aug 2013 22:59:31 -0700	[thread overview]
Message-ID: <20130822055931.8231.48936@quantum> (raw)
In-Reply-To: <CAMj5BkhCVALJO=OHJ6WSr_Jsi+9DPQ_1_PGs3PgWfQxx-W-neg@mail.gmail.com>

Quoting zhangfei gao (2013-08-21 18:19:33)
> On Thu, Aug 22, 2013 at 5:43 AM, Mike Turquette <mturquette@linaro.org> wrote:
> > Quoting Haojian Zhuang (2013-08-19 19:31:12)
> >> From: Zhangfei Gao <zhangfei.gao@linaro.org>
> >>
> >> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> >> Signed-off-by: Zhang Mingjun <zhang.mingjun@linaro.org>
> >> ---
> 
> >> +static int hi3716_clkgate_prepare(struct clk_hw *hw)
> >> +{
> >> +       struct hi3716_clk *clk = to_clk_hi3716(hw);
> >> +       unsigned long flags = 0;
> >> +       u32 reg;
> >> +
> >> +       spin_lock_irqsave(&_lock, flags);
> >> +
> >> +       reg = readl_relaxed(clk->reg);
> >> +       reg &= ~BIT(clk->reset_bit);
> >> +       writel_relaxed(reg, clk->reg);
> >> +
> >> +       spin_unlock_irqrestore(&_lock, flags);
> >> +
> >> +       return 0;
> >> +}
> >> +
> >> +static void hi3716_clkgate_unprepare(struct clk_hw *hw)
> >> +{
> >> +       struct hi3716_clk *clk = to_clk_hi3716(hw);
> >> +       unsigned long flags = 0;
> >> +       u32 reg;
> >> +
> >> +       spin_lock_irqsave(&_lock, flags);
> >> +
> >> +       reg = readl_relaxed(clk->reg);
> >> +       reg |= BIT(clk->reset_bit);
> >> +       writel_relaxed(reg, clk->reg);
> >> +
> >> +       spin_unlock_irqrestore(&_lock, flags);
> >> +}
> >> +
> >> +static struct clk_ops hi3716_clkgate_ops = {
> >> +       .prepare        = hi3716_clkgate_prepare,
> >> +       .unprepare      = hi3716_clkgate_unprepare,
> >> +};
> >
> > Why .prepare & .unprepare instead of .enable & .disable?
> >
> > Regards,
> > Mike
> 
> Thanks  Mike for the review
> 
> the .enable & .disable is directly use clk_gate_ops.
> 
> +       hi3716_clkgate_ops.enable = clk_gate_ops.enable;
> +       hi3716_clkgate_ops.disable = clk_gate_ops.disable;
> +       hi3716_clkgate_ops.is_enabled = clk_gate_ops.is_enabled;
> +       p_clk->gate.bit_idx = array[1];
> 
> prepare & unprepare is handle reset bit, while enable & disable is
> handle enable bit.
> We have to extend since clk_gate_ops does not consider prepare &
> unprepare, otherwise it would be simpler.

I understand why you made this choice from the perspective of re-using
the existing gate-clock implementation. What I meant in my question is
whether or not handling the reset bit in the .prepare/.unprepare is the
right thing.

For instance if you called clk_enable or clk_disable from within an
interrupt handler would you want to toggle the reset bit in that
instance?

Regards,
Mike

> 
> Thanks

  reply	other threads:[~2013-08-22  5:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-20  2:31 [PATCH v7 00/11] Enable Hisilicon Hi3620 SoC Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 01/11] ARM: debug: support debug ll on hisilicon soc Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 02/11] clk: hi3xxx: add clock support Haojian Zhuang
2013-08-21 21:29   ` Mike Turquette
2013-08-24  4:13     ` Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 03/11] clk: gate: add CLK_GATE_SEPERATED_REG flag Haojian Zhuang
2013-08-21 21:18   ` Mike Turquette
2013-08-20  2:31 ` [PATCH v7 04/11] ARM: hi3xxx: add board support with device tree Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 05/11] ARM: dts: enable hi4511 " Haojian Zhuang
2013-08-22 18:07   ` Kevin Hilman
2013-08-22 18:50     ` Stephen Warren
2013-08-24  3:52       ` Haojian Zhuang
2013-08-26 16:48         ` Stephen Warren
2013-08-28  2:17           ` Haojian Zhuang
2013-08-28 14:20             ` Stephen Warren
2013-08-28 15:15               ` Haojian Zhuang
2013-08-28 15:45                 ` Stephen Warren
2013-08-24  3:59     ` Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 06/11] ARM: config: enable hi3xxx in multi_v7_defconfig Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 07/11] ARM: config: add defconfig for Hi3xxx Haojian Zhuang
2013-08-20  2:31 ` [PATCH v7 08/11] ARM: hi3xxx: add smp support Haojian Zhuang
2013-08-28  2:12   ` Olof Johansson
2013-08-28 11:53     ` zhangfei gao
2013-08-28 17:19       ` Olof Johansson
2013-08-29  1:54         ` zhangfei
2013-08-20  2:31 ` [PATCH v7 09/11] ARM: hi3xxx: add hotplug support Haojian Zhuang
2013-08-28  2:21   ` Olof Johansson
2013-08-28 11:45     ` zhangfei gao
2013-08-20  2:31 ` [PATCH v7 10/11] ARM: hi3xxx: add clk-hi3716 Haojian Zhuang
2013-08-21 21:43   ` Mike Turquette
2013-08-22  1:19     ` zhangfei gao
2013-08-22  5:59       ` Mike Turquette [this message]
2013-08-22  7:50         ` Haojian Zhuang
2013-08-22  8:16           ` Mike Turquette
2013-08-20  2:31 ` [PATCH v7 11/11] ARM: hi3xxx: support hi3716-dkb board 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=20130822055931.8231.48936@quantum \
    --to=mturquette@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).