devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
@ 2014-01-09  3:04 Nicolin Chen
       [not found] ` <1389236699-10387-1-git-send-email-Guangyu.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
  2014-01-09  7:55 ` Sascha Hauer
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolin Chen @ 2014-01-09  3:04 UTC (permalink / raw)
  To: shawn.guo, kernel
  Cc: mark.rutland, devicetree, linux, pawel.moll, ijc+devicetree,
	linux-kernel, rob.herring, rob, galak, linux-arm-kernel

esai_ahb clock is derived from ahb and used to provide ESAI the capability of
register accessing and FSYS clock source for I2S clocks dividing. Although the
gate of this esai_ahb is duplicated with esai clock -- the baud clock, yet
considering about the differences of their clock rates, it's quite essential
to patch this missing clock.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
---
 Documentation/devicetree/bindings/clock/imx6q-clock.txt | 1 +
 arch/arm/mach-imx/clk-imx6q.c                           | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/clock/imx6q-clock.txt b/Documentation/devicetree/bindings/clock/imx6q-clock.txt
index 6aab72b..90ec91f 100644
--- a/Documentation/devicetree/bindings/clock/imx6q-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx6q-clock.txt
@@ -220,6 +220,7 @@ clocks and IDs.
 	lvds2_sel		205
 	lvds1_gate		206
 	lvds2_gate		207
+	esai_ahb		208
 
 Examples:
 
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index af2e582..20215b9 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -107,7 +107,7 @@ enum mx6q_clks {
 	sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate,
 	usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow,
 	spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, pll4_audio_div,
-	lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, clk_max
+	lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, esai_ahb, clk_max
 };
 
 static struct clk *clk[clk_max];
@@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
 	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
 	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
 	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
+	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);
 	clk[gpt_ipg]      = imx_clk_gate2("gpt_ipg",       "ipg",               base + 0x6c, 20);
 	clk[gpt_ipg_per]  = imx_clk_gate2("gpt_ipg_per",   "ipg_per",           base + 0x6c, 22);
 	if (cpu_is_imx6dl())
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
       [not found]     ` <20140109035810.GB21717-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
@ 2014-01-09  3:49       ` Nicolin Chen
  2014-01-09  6:57         ` Shawn Guo
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolin Chen @ 2014-01-09  3:49 UTC (permalink / raw)
  To: Shawn Guo
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	rob-VoJi6FS/r0vR7s880joybQ

On Thu, Jan 09, 2014 at 11:58:12AM +0800, Shawn Guo wrote:
> >  static struct clk *clk[clk_max];
> > @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
> >  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
> >  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
> >  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> > +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);
> 
> Hmm, having two clocks operating on the same gate bit will get us
> problem in clock disabling.  Clock enabling is fine, since either
> one who calls clk_enable() first will just set the gate bit.  But in
> case that clk_enable() is called on both clocks, and then when either
> clock calls clk_disable(), the gate bit will be cleared and thus breaks
> the other one that might still be in use.

Understood. But how could we handle this situation? The only way I can figure
out is to make sure the driver open/close them at the same time, it's not a
perfect way though.

Nicolin



--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
       [not found] ` <1389236699-10387-1-git-send-email-Guangyu.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2014-01-09  3:58   ` Shawn Guo
       [not found]     ` <20140109035810.GB21717-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Shawn Guo @ 2014-01-09  3:58 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	rob-VoJi6FS/r0vR7s880joybQ

On Thu, Jan 09, 2014 at 11:04:59AM +0800, Nicolin Chen wrote:
> esai_ahb clock is derived from ahb and used to provide ESAI the capability of
> register accessing and FSYS clock source for I2S clocks dividing. Although the
> gate of this esai_ahb is duplicated with esai clock -- the baud clock, yet
> considering about the differences of their clock rates, it's quite essential
> to patch this missing clock.
> 
> Signed-off-by: Nicolin Chen <Guangyu.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/clock/imx6q-clock.txt | 1 +
>  arch/arm/mach-imx/clk-imx6q.c                           | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/clock/imx6q-clock.txt b/Documentation/devicetree/bindings/clock/imx6q-clock.txt
> index 6aab72b..90ec91f 100644
> --- a/Documentation/devicetree/bindings/clock/imx6q-clock.txt
> +++ b/Documentation/devicetree/bindings/clock/imx6q-clock.txt
> @@ -220,6 +220,7 @@ clocks and IDs.
>  	lvds2_sel		205
>  	lvds1_gate		206
>  	lvds2_gate		207
> +	esai_ahb		208
>  
>  Examples:
>  
> diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
> index af2e582..20215b9 100644
> --- a/arch/arm/mach-imx/clk-imx6q.c
> +++ b/arch/arm/mach-imx/clk-imx6q.c
> @@ -107,7 +107,7 @@ enum mx6q_clks {
>  	sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate,
>  	usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow,
>  	spdif, cko2_sel, cko2_podf, cko2, cko, vdoa, pll4_audio_div,
> -	lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, clk_max
> +	lvds1_sel, lvds2_sel, lvds1_gate, lvds2_gate, esai_ahb, clk_max
>  };
>  
>  static struct clk *clk[clk_max];
> @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
>  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
>  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
>  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);

Hmm, having two clocks operating on the same gate bit will get us
problem in clock disabling.  Clock enabling is fine, since either
one who calls clk_enable() first will just set the gate bit.  But in
case that clk_enable() is called on both clocks, and then when either
clock calls clk_disable(), the gate bit will be cleared and thus breaks
the other one that might still be in use.

Shawn

>  	clk[gpt_ipg]      = imx_clk_gate2("gpt_ipg",       "ipg",               base + 0x6c, 20);
>  	clk[gpt_ipg_per]  = imx_clk_gate2("gpt_ipg_per",   "ipg_per",           base + 0x6c, 22);
>  	if (cpu_is_imx6dl())
> -- 
> 1.8.4
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
  2014-01-09  3:49       ` Nicolin Chen
@ 2014-01-09  6:57         ` Shawn Guo
       [not found]           ` <20140109065740.GD21717-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Shawn Guo @ 2014-01-09  6:57 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	rob-VoJi6FS/r0vR7s880joybQ

On Thu, Jan 09, 2014 at 11:49:41AM +0800, Nicolin Chen wrote:
> On Thu, Jan 09, 2014 at 11:58:12AM +0800, Shawn Guo wrote:
> > >  static struct clk *clk[clk_max];
> > > @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
> > >  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
> > >  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
> > >  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> > > +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);
> > 
> > Hmm, having two clocks operating on the same gate bit will get us
> > problem in clock disabling.  Clock enabling is fine, since either
> > one who calls clk_enable() first will just set the gate bit.  But in
> > case that clk_enable() is called on both clocks, and then when either
> > clock calls clk_disable(), the gate bit will be cleared and thus breaks
> > the other one that might still be in use.
> 
> Understood. But how could we handle this situation? The only way I can figure
> out is to make sure the driver open/close them at the same time, it's not a
> perfect way though.

Hmm, we generally leave the gate bit to the clock used to access
register, because usually it's the first one to be on and the last one
to be off.

Shawn

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
       [not found]           ` <20140109065740.GD21717-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
@ 2014-01-09  7:41             ` Nicolin Chen
  2014-01-09  7:58               ` Sascha Hauer
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolin Chen @ 2014-01-09  7:41 UTC (permalink / raw)
  To: Shawn Guo
  Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	rob-VoJi6FS/r0vR7s880joybQ

On Thu, Jan 09, 2014 at 02:57:42PM +0800, Shawn Guo wrote:
> On Thu, Jan 09, 2014 at 11:49:41AM +0800, Nicolin Chen wrote:
> > On Thu, Jan 09, 2014 at 11:58:12AM +0800, Shawn Guo wrote:
> > > >  static struct clk *clk[clk_max];
> > > > @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
> > > >  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
> > > >  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
> > > >  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> > > > +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);
> > > 
> > > Hmm, having two clocks operating on the same gate bit will get us
> > > problem in clock disabling.  Clock enabling is fine, since either
> > > one who calls clk_enable() first will just set the gate bit.  But in
> > > case that clk_enable() is called on both clocks, and then when either
> > > clock calls clk_disable(), the gate bit will be cleared and thus breaks
> > > the other one that might still be in use.
> > 
> > Understood. But how could we handle this situation? The only way I can figure
> > out is to make sure the driver open/close them at the same time, it's not a
> > perfect way though.
> 
> Hmm, we generally leave the gate bit to the clock used to access
> register, because usually it's the first one to be on and the last one
> to be off.

Then we should attach CLK_IGNORE_UNUSED to clk[esai] since clk[esai_ahb] is
the clock used to access memory, shouldn't we?

Thank you.
Nicolin



--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
  2014-01-09  7:58               ` Sascha Hauer
@ 2014-01-09  7:51                 ` Nicolin Chen
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolin Chen @ 2014-01-09  7:51 UTC (permalink / raw)
  To: Shawn Guo, kernel, linux, linux-arm-kernel, linux-kernel,
	rob.herring, pawel.moll, mark.rutland, ijc+devicetree, galak,
	devicetree, rob

On Thu, Jan 09, 2014 at 08:58:28AM +0100, Sascha Hauer wrote:
> On Thu, Jan 09, 2014 at 03:41:38PM +0800, Nicolin Chen wrote:
> > On Thu, Jan 09, 2014 at 02:57:42PM +0800, Shawn Guo wrote:
> > > On Thu, Jan 09, 2014 at 11:49:41AM +0800, Nicolin Chen wrote:
> > > > On Thu, Jan 09, 2014 at 11:58:12AM +0800, Shawn Guo wrote:
> > > > > >  static struct clk *clk[clk_max];
> > > > > > @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
> > > > > >  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
> > > > > >  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
> > > > > >  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> > > > > > +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);
> > > > > 
> > > > > Hmm, having two clocks operating on the same gate bit will get us
> > > > > problem in clock disabling.  Clock enabling is fine, since either
> > > > > one who calls clk_enable() first will just set the gate bit.  But in
> > > > > case that clk_enable() is called on both clocks, and then when either
> > > > > clock calls clk_disable(), the gate bit will be cleared and thus breaks
> > > > > the other one that might still be in use.
> > > > 
> > > > Understood. But how could we handle this situation? The only way I can figure
> > > > out is to make sure the driver open/close them at the same time, it's not a
> > > > perfect way though.
> > > 
> > > Hmm, we generally leave the gate bit to the clock used to access
> > > register, because usually it's the first one to be on and the last one
> > > to be off.
> > 
> > Then we should attach CLK_IGNORE_UNUSED to clk[esai] since clk[esai_ahb] is
> > the clock used to access memory, shouldn't we?
> 
> Please wait for Mikes input or let's look how a proper solution can look
> like. I've already seen the case that a single bit controls multiple
> clocks. Hacking around this issue each time is not a solution.

Okay.

Thank you, Sascha.
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
  2014-01-09  3:04 [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree Nicolin Chen
       [not found] ` <1389236699-10387-1-git-send-email-Guangyu.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
@ 2014-01-09  7:55 ` Sascha Hauer
       [not found]   ` <20140109075525.GO6750-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  1 sibling, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2014-01-09  7:55 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: mark.rutland, devicetree, linux, rob, pawel.moll, ijc+devicetree,
	linux-kernel, rob.herring, kernel, galak, mturquette, shawn.guo,
	linux-arm-kernel

[Added Mike Turquette to Cc]

On Thu, Jan 09, 2014 at 11:04:59AM +0800, Nicolin Chen wrote:
> esai_ahb clock is derived from ahb and used to provide ESAI the capability of
> register accessing and FSYS clock source for I2S clocks dividing. Although the
> gate of this esai_ahb is duplicated with esai clock -- the baud clock, yet
> considering about the differences of their clock rates, it's quite essential
> to patch this missing clock.
> 

[...]

>  static struct clk *clk[clk_max];
> @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
>  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
>  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
>  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);

We have the situation here that a single bit controls two clocks. As
Shawn mentioned just using two gates on the same bit doesn't work
properly. Do we need a new basic clock type or expand the common gate
code somehow?
This situation happens from time to time and I haven't seen a solution
for this.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
  2014-01-09  7:41             ` Nicolin Chen
@ 2014-01-09  7:58               ` Sascha Hauer
  2014-01-09  7:51                 ` Nicolin Chen
  0 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2014-01-09  7:58 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: mark.rutland, devicetree, linux, rob, pawel.moll, ijc+devicetree,
	linux-kernel, rob.herring, kernel, galak, Shawn Guo,
	linux-arm-kernel

On Thu, Jan 09, 2014 at 03:41:38PM +0800, Nicolin Chen wrote:
> On Thu, Jan 09, 2014 at 02:57:42PM +0800, Shawn Guo wrote:
> > On Thu, Jan 09, 2014 at 11:49:41AM +0800, Nicolin Chen wrote:
> > > On Thu, Jan 09, 2014 at 11:58:12AM +0800, Shawn Guo wrote:
> > > > >  static struct clk *clk[clk_max];
> > > > > @@ -355,6 +355,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
> > > > >  	clk[ecspi5]       = imx_clk_gate2("ecspi5",        "ecspi_root",        base + 0x6c, 8);
> > > > >  	clk[enet]         = imx_clk_gate2("enet",          "ipg",               base + 0x6c, 10);
> > > > >  	clk[esai]         = imx_clk_gate2("esai",          "esai_podf",         base + 0x6c, 16);
> > > > > +	clk[esai_ahb]     = imx_clk_gate2("esai_ahb",      "ahb",               base + 0x6c, 16);
> > > > 
> > > > Hmm, having two clocks operating on the same gate bit will get us
> > > > problem in clock disabling.  Clock enabling is fine, since either
> > > > one who calls clk_enable() first will just set the gate bit.  But in
> > > > case that clk_enable() is called on both clocks, and then when either
> > > > clock calls clk_disable(), the gate bit will be cleared and thus breaks
> > > > the other one that might still be in use.
> > > 
> > > Understood. But how could we handle this situation? The only way I can figure
> > > out is to make sure the driver open/close them at the same time, it's not a
> > > perfect way though.
> > 
> > Hmm, we generally leave the gate bit to the clock used to access
> > register, because usually it's the first one to be on and the last one
> > to be off.
> 
> Then we should attach CLK_IGNORE_UNUSED to clk[esai] since clk[esai_ahb] is
> the clock used to access memory, shouldn't we?

Please wait for Mikes input or let's look how a proper solution can look
like. I've already seen the case that a single bit controls multiple
clocks. Hacking around this issue each time is not a solution.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
       [not found]   ` <20140109075525.GO6750-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2014-01-09 14:57     ` Gerhard Sittig
  2014-01-09 15:01     ` Russell King - ARM Linux
  1 sibling, 0 replies; 11+ messages in thread
From: Gerhard Sittig @ 2014-01-09 14:57 UTC (permalink / raw)
  To: Nicolin Chen, shawn.guo-QSEj5FYQhm4dnm+yROfE0A,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	rob-VoJi6FS/r0vR7s880joybQ, mturquette-QSEj5FYQhm4dnm+yROfE0A

On Thu, Jan 09, 2014 at 08:55 +0100, Sascha Hauer wrote:
> 
> [ ... ]
> 
> We have the situation here that a single bit controls two clocks. As
> Shawn mentioned just using two gates on the same bit doesn't work
> properly. Do we need a new basic clock type or expand the common gate
> code somehow?
> This situation happens from time to time and I haven't seen a solution
> for this.

You may want to lookup the following message:

  Date: Tue, 23 Jul 2013 15:14:06 +0200
  From: Gerhard Sittig <gsi-ynQEQJNshbs@public.gmane.org>
  To: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Anatolij Gustschin <agust-ynQEQJNshbs@public.gmane.org>,
	  Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	  linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
  Cc: [ ... ]
  Subject: Re: [PATCH v3 17/31] clk: mpc512x: introduce COMMON_CLK for MPC512x

  http://lists.infradead.org/pipermail/linux-arm-kernel/2013-July/185687.html

The specific situation was for MS-CAN on PowerPC, but it inspired
my outlining an approach to "shared clock gates".  See an example
implementation towards the end of the message with both the
clk-gate.c extension, as well as rather generic example use.

My approach turned out to not be needed, but it might serve as a
starting point for you.  You'd have to add support for static
declaration though, but this should be straight forward.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office-ynQEQJNshbs@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
       [not found]   ` <20140109075525.GO6750-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2014-01-09 14:57     ` Gerhard Sittig
@ 2014-01-09 15:01     ` Russell King - ARM Linux
  2014-01-10 10:06       ` Sascha Hauer
  1 sibling, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2014-01-09 15:01 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Nicolin Chen, shawn.guo-QSEj5FYQhm4dnm+yROfE0A,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
	rob-VoJi6FS/r0vR7s880joybQ, mturquette-QSEj5FYQhm4dnm+yROfE0A

Sascha, your messages have the Mail-Followup-To: header...

Mail-Followup-To: Nicolin Chen <Guangyu.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,                    
        shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,    
        linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,     
        rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, pawel.moll-5wv7dgnIgG8@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org,      
        ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org, galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,                    
        devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org, mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org      

resulting in me (and others) getting mails marked as To: me where they're
not supposed to be To: me in the first place.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree
  2014-01-09 15:01     ` Russell King - ARM Linux
@ 2014-01-10 10:06       ` Sascha Hauer
  0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2014-01-10 10:06 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: mark.rutland, devicetree, mturquette, rob, pawel.moll,
	ijc+devicetree, galak, linux-kernel, rob.herring, kernel,
	Nicolin Chen, shawn.guo, linux-arm-kernel

Russell,

On Thu, Jan 09, 2014 at 03:01:41PM +0000, Russell King - ARM Linux wrote:
> Sascha, your messages have the Mail-Followup-To: header...
> 
> Mail-Followup-To: Nicolin Chen <Guangyu.Chen@freescale.com>,                    
>         shawn.guo@linaro.org, kernel@pengutronix.de, linux@arm.linux.org.uk,    
>         linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org,     
>         rob.herring@calxeda.com, pawel.moll@arm.com, mark.rutland@arm.com,      
>         ijc+devicetree@hellion.org.uk, galak@codeaurora.org,                    
>         devicetree@vger.kernel.org, rob@landley.net, mturquette@linaro.org      
> 
> resulting in me (and others) getting mails marked as To: me where they're
> not supposed to be To: me in the first place.

This should be fixed with this mail.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-10 10:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09  3:04 [PATCH] ARM: imx6q: Add missing esai_ahb clock to current clock tree Nicolin Chen
     [not found] ` <1389236699-10387-1-git-send-email-Guangyu.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2014-01-09  3:58   ` Shawn Guo
     [not found]     ` <20140109035810.GB21717-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2014-01-09  3:49       ` Nicolin Chen
2014-01-09  6:57         ` Shawn Guo
     [not found]           ` <20140109065740.GD21717-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2014-01-09  7:41             ` Nicolin Chen
2014-01-09  7:58               ` Sascha Hauer
2014-01-09  7:51                 ` Nicolin Chen
2014-01-09  7:55 ` Sascha Hauer
     [not found]   ` <20140109075525.GO6750-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-01-09 14:57     ` Gerhard Sittig
2014-01-09 15:01     ` Russell King - ARM Linux
2014-01-10 10:06       ` Sascha Hauer

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).