From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: imx: fix shared gate clock
Date: Mon, 7 Jul 2014 21:56:37 +0800 [thread overview]
Message-ID: <20140707135636.GS30239@dragon> (raw)
In-Reply-To: <CAOMZO5CMc6dqzh62cie=Ve_o9QHig=G4VqB11skCip+jXwV-9g@mail.gmail.com>
On Mon, Jul 07, 2014 at 09:49:00AM -0300, Fabio Estevam wrote:
> On Sun, Jul 6, 2014 at 11:53 PM, Shawn Guo <shawn.guo@freescale.com> wrote:
> > Let's say clock A and B are two gate clocks that share the same register
> > bit in hardware. Therefore they are registered as shared gate clocks
> > with imx_clk_gate2_shared().
> >
> > In a scenario that only clock A is enabled by clk_enable(A) while B is
> > not used, the shared gate will be unexpectedly disabled in hardware.
> > It happens because clk_enable(A) increments the share_count from 0 to 1,
> > while clock B is unused to clock core, and therefore the core function
> > will just disable B by calling clk->ops->disable() directly. The
> > consequence of that call is share_count is decremented to 0 and the gate
> > is disabled in hardware, even though clock A is still in use.
> >
> > The patch fixes the issue by initializing the share_count per hardware
> > state and returns enable state per share_count from .is_enabled() hook,
> > in case it's a shared gate.
> >
> > While at it, add a check in clk_gate2_disable() to ensure it's never
> > called with a zero share_count.
> >
> > Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
> > Fixes: f9f28cdf2167 ("ARM: imx: add shared gate clock support")
> > Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
> > ---
> > Fabio,
> >
> > Per my testing, it fixes the shared gate clock issue you reported.
> > But I'd like to get your confirmation before I ask arm-soc folks to
> > apply it for 3.16-rc.
>
> I can get audio working now and I have also inspected CCGR5 register
> and it looks correct now:
>
> Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Thanks, Fabio.
Arnd, Olof,
Can you please apply this patch for 3.16?
Shawn
next prev parent reply other threads:[~2014-07-07 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 2:53 [PATCH] ARM: imx: fix shared gate clock Shawn Guo
2014-07-07 12:49 ` Fabio Estevam
2014-07-07 13:56 ` Shawn Guo [this message]
2014-07-08 4:23 ` Olof Johansson
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=20140707135636.GS30239@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 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).