All of lore.kernel.org
 help / color / mirror / Atom feed
From: shengjiu.wang@freescale.com (Shengjiu Wang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 2/3] ARM: clk-gate2: Add API imx_clk_gate2_exclusive for clk_gate2
Date: Mon, 11 Aug 2014 10:56:42 +0800	[thread overview]
Message-ID: <20140811025640.GA13158@audiosh1> (raw)
In-Reply-To: <20140809133314.GA8849@dragon>

On Sat, Aug 09, 2014 at 09:33:17PM +0800, Shawn Guo wrote:
> On Fri, Aug 08, 2014 at 03:02:48PM +0800, Shengjiu Wang wrote:
> > As some clocks are mutually exlcusive, they can't be enabled simultaneously,
> > So add this new API for registering exclusive clock, the enable function will
> > check if there is exclusive clock and it is not enabled, then this clock can
> > be enabled, otherwise, it will return error.
> > 
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> > ---
> >  arch/arm/mach-imx/clk-gate2.c |   18 +++++++++++++++++-
> >  arch/arm/mach-imx/clk.h       |    2 ++
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
> > index 84acdfd..df64c4d 100644
> > --- a/arch/arm/mach-imx/clk-gate2.c
> > +++ b/arch/arm/mach-imx/clk-gate2.c
> > @@ -8,7 +8,7 @@
> >   *
> >   * Gated clock implementation
> >   */
> > -
> > +#include <linux/clk-private.h>
> 
> I do not see why this header is needed.
> 
> Shawn
> 
I add new function imx_clk_gate2_exclusive(), which need to access "struct clk_hw"
in "struct clk", So here need include clk-private.h

> >  #include <linux/clk-provider.h>
> >  #include <linux/module.h>
> >  #include <linux/slab.h>
> > @@ -34,6 +34,7 @@ struct clk_gate2 {
> >  	u8		flags;
> >  	spinlock_t	*lock;
> >  	unsigned int	*share_count;
> > +	struct clk	*clk_exclusive;
> >  };
> >  
> >  #define to_clk_gate2(_hw) container_of(_hw, struct clk_gate2, hw)
> > @@ -46,6 +47,11 @@ static int clk_gate2_enable(struct clk_hw *hw)
> >  
> >  	spin_lock_irqsave(gate->lock, flags);
> >  
> > +	if (gate->clk_exclusive && __clk_is_enabled(gate->clk_exclusive)) {
> > +		spin_unlock_irqrestore(gate->lock, flags);
> > +		return -EBUSY;
> > +	}
> > +
> >  	if (gate->share_count && (*gate->share_count)++ > 0)
> >  		goto out;
> >  
> > @@ -147,3 +153,13 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
> >  
> >  	return clk;
> >  }
> > +
> > +int imx_clk_gate2_exclusive(struct clk *clk1, struct clk *clk2)
> > +{
> > +	struct clk_gate2 *gate1 = to_clk_gate2(clk1->hw);
> > +	struct clk_gate2 *gate2 = to_clk_gate2(clk2->hw);
> > +
> > +	gate1->clk_exclusive = clk2;
> > +	gate2->clk_exclusive = clk1;
> > +	return 0;
> > +}
> > diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
> > index d5ba76f..2b07376 100644
> > --- a/arch/arm/mach-imx/clk.h
> > +++ b/arch/arm/mach-imx/clk.h
> > @@ -36,6 +36,8 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
> >  struct clk * imx_obtain_fixed_clock(
> >  			const char *name, unsigned long rate);
> >  
> > +int imx_clk_gate2_exclusive(struct clk *clk1, struct clk *clk2);
> > +
> >  static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
> >  		void __iomem *reg, u8 shift)
> >  {
> > -- 
> > 1.7.9.5
> > 

WARNING: multiple messages have this Message-ID (diff)
From: Shengjiu Wang <shengjiu.wang@freescale.com>
To: Shawn Guo <shawn.guo@freescale.com>
Cc: <kernel@pengutronix.de>, <linux@arm.linux.org.uk>,
	<robh+dt@kernel.org>, <pawel.moll@arm.com>,
	<mark.rutland@arm.com>, <ijc+devicetree@hellion.org.uk>,
	<galak@codeaurora.org>, <Guangyu.Chen@freescale.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3 2/3] ARM: clk-gate2: Add API imx_clk_gate2_exclusive for clk_gate2
Date: Mon, 11 Aug 2014 10:56:42 +0800	[thread overview]
Message-ID: <20140811025640.GA13158@audiosh1> (raw)
In-Reply-To: <20140809133314.GA8849@dragon>

On Sat, Aug 09, 2014 at 09:33:17PM +0800, Shawn Guo wrote:
> On Fri, Aug 08, 2014 at 03:02:48PM +0800, Shengjiu Wang wrote:
> > As some clocks are mutually exlcusive, they can't be enabled simultaneously,
> > So add this new API for registering exclusive clock, the enable function will
> > check if there is exclusive clock and it is not enabled, then this clock can
> > be enabled, otherwise, it will return error.
> > 
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> > ---
> >  arch/arm/mach-imx/clk-gate2.c |   18 +++++++++++++++++-
> >  arch/arm/mach-imx/clk.h       |    2 ++
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
> > index 84acdfd..df64c4d 100644
> > --- a/arch/arm/mach-imx/clk-gate2.c
> > +++ b/arch/arm/mach-imx/clk-gate2.c
> > @@ -8,7 +8,7 @@
> >   *
> >   * Gated clock implementation
> >   */
> > -
> > +#include <linux/clk-private.h>
> 
> I do not see why this header is needed.
> 
> Shawn
> 
I add new function imx_clk_gate2_exclusive(), which need to access "struct clk_hw"
in "struct clk", So here need include clk-private.h

> >  #include <linux/clk-provider.h>
> >  #include <linux/module.h>
> >  #include <linux/slab.h>
> > @@ -34,6 +34,7 @@ struct clk_gate2 {
> >  	u8		flags;
> >  	spinlock_t	*lock;
> >  	unsigned int	*share_count;
> > +	struct clk	*clk_exclusive;
> >  };
> >  
> >  #define to_clk_gate2(_hw) container_of(_hw, struct clk_gate2, hw)
> > @@ -46,6 +47,11 @@ static int clk_gate2_enable(struct clk_hw *hw)
> >  
> >  	spin_lock_irqsave(gate->lock, flags);
> >  
> > +	if (gate->clk_exclusive && __clk_is_enabled(gate->clk_exclusive)) {
> > +		spin_unlock_irqrestore(gate->lock, flags);
> > +		return -EBUSY;
> > +	}
> > +
> >  	if (gate->share_count && (*gate->share_count)++ > 0)
> >  		goto out;
> >  
> > @@ -147,3 +153,13 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
> >  
> >  	return clk;
> >  }
> > +
> > +int imx_clk_gate2_exclusive(struct clk *clk1, struct clk *clk2)
> > +{
> > +	struct clk_gate2 *gate1 = to_clk_gate2(clk1->hw);
> > +	struct clk_gate2 *gate2 = to_clk_gate2(clk2->hw);
> > +
> > +	gate1->clk_exclusive = clk2;
> > +	gate2->clk_exclusive = clk1;
> > +	return 0;
> > +}
> > diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
> > index d5ba76f..2b07376 100644
> > --- a/arch/arm/mach-imx/clk.h
> > +++ b/arch/arm/mach-imx/clk.h
> > @@ -36,6 +36,8 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
> >  struct clk * imx_obtain_fixed_clock(
> >  			const char *name, unsigned long rate);
> >  
> > +int imx_clk_gate2_exclusive(struct clk *clk1, struct clk *clk2);
> > +
> >  static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
> >  		void __iomem *reg, u8 shift)
> >  {
> > -- 
> > 1.7.9.5
> > 

  reply	other threads:[~2014-08-11  2:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08  7:02 [PATCH V3 0/3] refine clock tree for esai in imx6q Shengjiu Wang
2014-08-08  7:02 ` Shengjiu Wang
2014-08-08  7:02 ` [PATCH V3 1/3] ARM: clk-imx6q: refine clock tree for ESAI Shengjiu Wang
2014-08-08  7:02   ` Shengjiu Wang
2014-08-08  7:02 ` [PATCH V3 2/3] ARM: clk-gate2: Add API imx_clk_gate2_exclusive for clk_gate2 Shengjiu Wang
2014-08-08  7:02   ` Shengjiu Wang
2014-08-09 13:33   ` Shawn Guo
2014-08-09 13:33     ` Shawn Guo
2014-08-11  2:56     ` Shengjiu Wang [this message]
2014-08-11  2:56       ` Shengjiu Wang
2014-08-08  7:02 ` [PATCH V3 3/3] ARM: clk-imx6q: Add missing lvds and anaclk clock to the clock tree Shengjiu Wang
2014-08-08  7:02   ` Shengjiu Wang
2014-08-09 13:58   ` Shawn Guo
2014-08-09 13:58     ` Shawn Guo
2014-08-11  3:09     ` Shengjiu Wang
2014-08-11  3:09       ` Shengjiu Wang
2014-08-18  6:06       ` Shawn Guo
2014-08-18  6:06         ` Shawn Guo
2014-08-25  7:40         ` Shengjiu Wang
2014-08-25  7:40           ` Shengjiu Wang
2014-08-25 11:21           ` Shawn Guo
2014-08-25 11:21             ` Shawn Guo

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=20140811025640.GA13158@audiosh1 \
    --to=shengjiu.wang@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.