From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] ARM: imx: clk-gate2: Use post decrement for share_count
Date: Thu, 3 Jul 2014 15:46:00 +0800 [thread overview]
Message-ID: <20140703074553.GA30239@dragon> (raw)
In-Reply-To: <CAOMZO5B=Jwodc+2hVhjXrCvERxuyKKviM+zYgH=ynvOSHLWBTw@mail.gmail.com>
On Wed, Jul 02, 2014 at 01:52:56PM -0300, Fabio Estevam wrote:
> Hi Mike,
>
> On Wed, Jul 2, 2014 at 12:29 PM, Mike Turquette <mturquette@linaro.org> wrote:
>
> >> If share_count is 1 it means that someone else is using the clock and
> >> we can't disable it.
> >
> > Why do you keep track of share_count at all? Is the enable_count
> > bookkeeping within the clock framework insufficient for your needs?
>
> What we are trying to handle here is the case when two clocks share
> the same clock gating bit.
>
> Let's say clocks clk1 and clk2 share the same clock gating bit.
>
> What we want to achieve are:
>
> Scenario 1:
>
> clk2 is disabled
> clk1 is enabled --> clock gate bit is set to 1
> clk1 is disabled --> clock gate bit is set to 0. As clk2 is disabled,
> it is OK to gate off the clock here
>
> Scenario 2:
>
> clk1 is enabled -> clock gate bit is set to 1
> clk2 is disabled -> clock gate bit cannot be set to 0 because clk1 is enabled
This never happens. If clk2 is disabled by clk_disable() without being
enabled by clk_enable() beforehand, it returns from __clk_disable()
immediately due to hitting of the WARN below.
if (WARN_ON(clk->enable_count == 0))
return;
Shawn
>
> We currently have arch/arm/mach-imx/clk-gate2.c and we are trying to
> fix it because the scenario 2 is not working.
>
> I am wondering if we should just extend drivers/clk/clk-gate.c to
> handle shared clock instead of doing this in arch/arm/mach-imx?
>
> What do you think?
>
> Thanks,
>
> Fabio Estevam
next prev parent reply other threads:[~2014-07-03 7:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 5:55 [PATCH 1/5] ARM: dts: imx6sx: Fix sdma node Fabio Estevam
2014-07-01 5:55 ` [PATCH 2/5] ARM: dts: imx6sx: Fix SSI nodes Fabio Estevam
2014-07-01 7:45 ` Markus Pargmann
2014-07-01 7:49 ` Markus Pargmann
2014-07-01 5:55 ` [PATCH 3/5] ARM: imx: clk-imx6sx: Remove SSI IPG clocks Fabio Estevam
2014-07-01 6:23 ` Nicolin Chen
2014-07-01 5:55 ` [PATCH 4/5] ARM: imx: clk-gate2: Use post decrement for share_count Fabio Estevam
2014-07-01 11:52 ` Shawn Guo
2014-07-01 17:44 ` Fabio Estevam
2014-07-02 4:35 ` Shawn Guo
2014-07-02 14:27 ` Fabio Estevam
2014-07-03 3:26 ` Shawn Guo
2014-07-02 15:29 ` Mike Turquette
2014-07-02 16:52 ` Fabio Estevam
2014-07-02 17:17 ` Mike Turquette
2014-07-03 7:46 ` Shawn Guo [this message]
2014-07-03 7:56 ` Shawn Guo
2014-07-01 5:55 ` [PATCH 5/5] ARM: dts: imx6sx-sdb: Add audio support Fabio Estevam
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=20140703074553.GA30239@dragon \
--to=shawn.guo@freescale.com \
--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 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.