mach-omap2: handle autoidle denial
Subsystems (6)
Andreas Kemnade
maintainerv2 cover mach-omap2: handle autoidle denial
On the gta04 with a dm3730 omap_hdq does not work properly when the device enters lower power states. Idling uart1 and 2 is enough to show up that problem, if there are no other things enabled. Further research reveals that hdq iclk must not be turned off during transfers, also according to the TRM. That fact is also correctly described in the flags but the code to handle that is incomplete.
To handle multiple users of a single ick, autoidle is disabled when a user of that ick requires that (has the OCPIF_SWSUP_IDLE))
Changes since v1:
- uses spinlocks instead of mutexes
- invert counter logic
- check whether clock type is basic
Andreas Kemnade (3):
clk: ti: add a usecount for autoidle
clk: ti: check clock type before doing autoidle ops
arm: omap_hwmod disable ick autoidling when a hwmod requires that
arch/arm/mach-omap2/omap_hwmod.c | 16 ++++++++++---- drivers/clk/ti/autoidle.c | 48 +++++++++++++++++++++++++++++++--------- include/linux/clk/ti.h | 1 + 3 files changed, 51 insertions(+), 14 deletions(-)
Signature · 1 line
2.11.0
Andreas Kemnade
maintainerPATCH v2 1/3 clk: ti: add a usecount for autoidle
Multiple users might deny autoidle on a clock. So we should have some counting here, also according to the comment in _setup_iclk_autoidle(). Also setting autoidle regs is not atomic, so there is another reason for locking.
---
Changes since v1:
- use spinlocks instead of mutexes
- invert logic
--- drivers/clk/ti/autoidle.c | 36 ++++++++++++++++++++++++++++-------- include/linux/clk/ti.h | 1 + 2 files changed, 29 insertions(+), 8 deletions(-)
drivers/clk/ti/autoidle.c +28 -8
@@ -37,6 +37,14 @@ struct clk_ti_autoidle {static LIST_HEAD (autoidle_clks);static LIST_HEAD (clk_hw_omap_clocks); +/* +* we have some non-atomic read/write +* operations behind it, so lets +* take one lock for handling autoidle +* of all clocks +*/ +static DEFINE_SPINLOCK (autoidle_spinlock); +/** * omap2_clk_deny_idle - disable autoidle on an OMAP clock * @clk: struct clk * to disable autoidle for
@@ -48,8 +56,15 @@ int omap2_clk_deny_idle(struct clk *clk)struct clk_hw_omap *c; c =to_clk_hw_omap (__clk_get_hw (clk)); -if (c->ops && c->ops->deny_idle) - c->ops->deny_idle (c); +if (c->ops && c->ops->deny_idle) { +unsigned long irqflags; + +spin_lock_irqsave (&autoidle_spinlock, irqflags); + c->autoidle_count++; +if (c->autoidle_count ==1 ) + c->ops->deny_idle (c); +spin_unlock_irqrestore (&autoidle_spinlock, irqflags); + }return 0 ; }
@@ -64,8 +79,15 @@ int omap2_clk_allow_idle(struct clk *clk)struct clk_hw_omap *c; c =to_clk_hw_omap (__clk_get_hw (clk)); -if (c->ops && c->ops->allow_idle) - c->ops->allow_idle (c); +if (c->ops && c->ops->allow_idle) { +unsigned long irqflags; + +spin_lock_irqsave (&autoidle_spinlock, irqflags); + c->autoidle_count--; +if (c->autoidle_count ==0 ) + c->ops->allow_idle (c); +spin_unlock_irqrestore (&autoidle_spinlock, irqflags); + }return 0 ; }
@@ -201,8 +223,7 @@ int omap2_clk_enable_autoidle_all(void)struct clk_hw_omap *c;list_for_each_entry (c, &clk_hw_omap_clocks, node) -if (c->ops && c->ops->allow_idle) - c->ops->allow_idle (c); +omap2_clk_allow_idle (c->hw.clk);_clk_generic_allow_autoidle_all ();
@@ -223,8 +244,7 @@ int omap2_clk_disable_autoidle_all(void)struct clk_hw_omap *c;list_for_each_entry (c, &clk_hw_omap_clocks, node) -if (c->ops && c->ops->deny_idle) - c->ops->deny_idle (c); +omap2_clk_deny_idle (c->hw.clk);_clk_generic_deny_autoidle_all ();
include/linux/clk/ti.h +1 -0
@@ -160,6 +160,7 @@ struct clk_hw_omap {struct clockdomain *clkdm;const struct clk_hw_omap_ops *ops;u32 context; +int autoidle_count; };/*
Signature · 1 line
2.11.0
Andreas Kemnade
maintainerPATCH v2 2/3 clk: ti: check clock type before doing autoidle ops
In reply to Andreas KemnadeCode might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
---
New in v2
--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/clk/ti/autoidle.c +10 -2
@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC ) +return -EINVAL ; + + c =to_clk_hw_omap (hw);if (c->ops && c->ops->deny_idle) {unsigned long irqflags;
@@ -77,8 +81,12 @@ int omap2_clk_deny_idle(struct clk *clk)int omap2_clk_allow_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC ) +return -EINVAL ; + + c =to_clk_hw_omap (hw);if (c->ops && c->ops->allow_idle) {unsigned long irqflags;
Signature · 1 line
2.11.0
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 15 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +0
-0
drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 7 lines
drivers/clk/ti/autoidle.c +2
-1@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )
Please try to avoid using CLK_IS_BASIC if at all possible. Can you? Maybe add some flag in clk_hw_omap() instead?
Andreas Kemnade
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Hi Stephen,
Quoted 21 lines · On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <[email protected]> wrote:
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 20 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +1
-0@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk);
Quoted 6 lines
drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 2 lines
drivers/clk/ti/autoidle.c +1
-1- c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )Please try to avoid using
CLK_IS_BASICif at all possible. Can you? Maybe add some flag inclk_hw_omap()instead?
hmm, Tero suggested that.
But to check flags in clk_hw_omap I first need to know that there is a clk_hw_omap behind clk_hw. And for that I either need to check flags in clk_hw or do more changes in the omap_hwmod code.
Regards,
Andreas
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoting Andreas Kemnade (2018-11-29 22:15:34)
Quoted 32 lines
Hi Stephen,
Quoted 21 lines · On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <[email protected]> wrote:
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 20 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +1
-0@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk);Quoted 6 lines
drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 2 lines
drivers/clk/ti/autoidle.c +1
-1- c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )Please try to avoid using
CLK_IS_BASICif at all possible. Can you? Maybe add some flag inclk_hw_omap()instead?
Quoted 4 lines
hmm, Tero suggested that.
But to check flags inclk_hw_omapI first need to know that there is aclk_hw_omapbehindclk_hw. And for that I either need to check flags inclk_hwor do more changes in theomap_hwmodcode.
Can you do it? The omap code is the only user of CLK_IS_BASIC. All the other users are marking clks with this but there is no reason to do so. I'll go make another pass over the tree and nuke those ones from orbit.
Re: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 33 lines · Stephen Boyd
Quoting Andreas Kemnade (2018-11-29 22:15:34)
Quoted 32 lines
Hi Stephen,
Quoted 27 lines · On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <[email protected]> wrote:
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 15 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +0
-0drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 7 lines
drivers/clk/ti/autoidle.c +2
-1@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )Please try to avoid using
CLK_IS_BASICif at all possible. Can you? Maybe add some flag inclk_hw_omap()instead?
Quoted 8 lines
Quoted 4 lines
hmm, Tero suggested that.
But to check flags inclk_hw_omapI first need to know that there is aclk_hw_omapbehindclk_hw. And for that I either need to check flags inclk_hwor do more changes in theomap_hwmodcode.Can you do it? The omap code is the only user of
CLK_IS_BASIC. All the other users are marking clks with this but there is no reason to do so. I'll go make another pass over the tree and nuke those ones from orbit.
The reason for using this flag is because OMAP uses two clock types around, the basic clocks like fixed-factor-clock/fixed-clock, and then all the omap derivatives, which can be cast to clk_hw_omap. If we want to avoid usage of CLK_IS_BASIC, we need to copy paste the remaining basic code under drivers/clk/ti/ and convert them to use clk_hw_omap as internal datatype. Is this preferred?
-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoting Tero Kristo (2018-11-29 23:35:35)
Quoted 43 lines · Stephen Boyd
Quoted 33 lines
Quoting Andreas Kemnade (2018-11-29 22:15:34)
Quoted 32 lines
Hi Stephen,
Quoted 27 lines · On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <[email protected]> wrote:
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 15 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +0
-0drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 7 lines
drivers/clk/ti/autoidle.c +2
-1@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )Please try to avoid using
CLK_IS_BASICif at all possible. Can you? Maybe add some flag inclk_hw_omap()instead?Quoted 8 lines
Quoted 4 lines
hmm, Tero suggested that.
But to check flags inclk_hw_omapI first need to know that there is aclk_hw_omapbehindclk_hw. And for that I either need to check flags inclk_hwor do more changes in theomap_hwmodcode.Can you do it? The omap code is the only user of
CLK_IS_BASIC. All the other users are marking clks with this but there is no reason to do so. I'll go make another pass over the tree and nuke those ones from orbit.
Quoted 7 lines
The reason for using this flag is because OMAP uses two clock types around, the basic clocks like fixed-factor-clock/fixed-clock, and then all the omap derivatives, which can be cast to
clk_hw_omap. If we want to avoid usage ofCLK_IS_BASIC, we need to copy paste the remaining basic code underdrivers/clk/ti/and convert them to useclk_hw_omapas internal datatype. Is this preferred?
No that is not preferred. Can the omap2_clk_deny_idle() function be integrated closer into the clk framework in some way that allows it to be part of the clk_ops structure? And then have that take a clk_hw structure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.
Re: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 52 lines · Stephen Boyd
Quoting Tero Kristo (2018-11-29 23:35:35)
Quoted 43 lines · Stephen Boyd
Quoted 33 lines
Quoting Andreas Kemnade (2018-11-29 22:15:34)
Quoted 32 lines
Hi Stephen,
Quoted 27 lines · On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <[email protected]> wrote:
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 15 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +0
-0drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 7 lines
drivers/clk/ti/autoidle.c +2
-1@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )Please try to avoid using
CLK_IS_BASICif at all possible. Can you? Maybe add some flag inclk_hw_omap()instead?Quoted 8 lines
Quoted 4 lines
hmm, Tero suggested that.
But to check flags inclk_hw_omapI first need to know that there is aclk_hw_omapbehindclk_hw. And for that I either need to check flags inclk_hwor do more changes in theomap_hwmodcode.Can you do it? The omap code is the only user of
CLK_IS_BASIC. All the other users are marking clks with this but there is no reason to do so. I'll go make another pass over the tree and nuke those ones from orbit.Quoted 7 lines
The reason for using this flag is because OMAP uses two clock types around, the basic clocks like fixed-factor-clock/fixed-clock, and then all the omap derivatives, which can be cast to
clk_hw_omap. If we want to avoid usage ofCLK_IS_BASIC, we need to copy paste the remaining basic code underdrivers/clk/ti/and convert them to useclk_hw_omapas internal datatype. Is this preferred?
Quoted 5 lines
No that is not preferred. Can the
omap2_clk_deny_idle()function be integrated closer into the clk framework in some way that allows it to be part of theclk_opsstructure? And then have that take aclk_hwstructure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.
It could be added under the main clk_ops struct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature?
-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Andreas Kemnade
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Hi Tero,
Quoted 59 lines · On Fri, 30 Nov 2018 11:20:49 +0200 Tero Kristo <[email protected]> wrote:
Quoted 52 lines · Stephen Boyd
Quoting Tero Kristo (2018-11-29 23:35:35)
Quoted 43 lines · Stephen Boyd
Quoted 33 lines
Quoting Andreas Kemnade (2018-11-29 22:15:34)
Quoted 32 lines
Hi Stephen,
Quoted 27 lines · On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <[email protected]> wrote:
Quoting Andreas Kemnade (2018-11-10 12:31:14)
Quoted 15 lines
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic
Signed-off-by Andreas Kemnade <[email protected]>---
New in v2--- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/clk/ti/autoidle.c +0
-0drivers/clk/ti/autoidle.c static DEFINE_SPINLOCK(autoidle_spinlock); · line 59
Quoted 7 lines
drivers/clk/ti/autoidle.c +2
-1@@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock);int omap2_clk_deny_idle (struct clk *clk) {struct clk_hw_omap *c; +struct clk_hw *hw =__clk_get_hw (clk); - c =to_clk_hw_omap (__clk_get_hw (clk)); +if (clk_hw_get_flags (hw) &CLK_IS_BASIC )Please try to avoid using
CLK_IS_BASICif at all possible. Can you? Maybe add some flag inclk_hw_omap()instead?Quoted 8 lines
Quoted 4 lines
hmm, Tero suggested that.
But to check flags inclk_hw_omapI first need to know that there is aclk_hw_omapbehindclk_hw. And for that I either need to check flags inclk_hwor do more changes in theomap_hwmodcode.Can you do it? The omap code is the only user of
CLK_IS_BASIC. All the other users are marking clks with this but there is no reason to do so. I'll go make another pass over the tree and nuke those ones from orbit.Quoted 7 lines
The reason for using this flag is because OMAP uses two clock types around, the basic clocks like fixed-factor-clock/fixed-clock, and then all the omap derivatives, which can be cast to
clk_hw_omap. If we want to avoid usage ofCLK_IS_BASIC, we need to copy paste the remaining basic code underdrivers/clk/ti/and convert them to useclk_hw_omapas internal datatype. Is this preferred?Quoted 5 lines
No that is not preferred. Can the
omap2_clk_deny_idle()function be integrated closer into the clk framework in some way that allows it to be part of theclk_opsstructure? And then have that take aclk_hwstructure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.
Quoted 4 lines
It could be added under the main
clk_opsstruct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature?
The question here is also how we organize the procedure here. One patchset fixing nasty problems and another mainly reorganize things? Where do we draw the line between these two? If we have the autoidle code in main clk_ops, we could also think whether other autoidle code should go into main code.
Regards,
Andreas
Tony Lindgren
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
In reply to Tero KristoHi,
Quoted 7 lines · Tero Kristo
Quoted 5 lines · Stephen Boyd
No that is not preferred. Can the
omap2_clk_deny_idle()function be integrated closer into the clk framework in some way that allows it to be part of theclk_opsstructure? And then have that take aclk_hwstructure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.
Quoted 5 lines
It could be added under the main
clk_opsstruct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature?From consumer usage point of view, I'm still wondering about
the relationship of clk_deny_idle() and clkdm_deny_idle().
It seems that we need to allow reset control drivers call clk_deny_idle() for the duration of reset. And it seems the clk_deny_idle() should propagate to also up to the related clock domain driver to do clkdm_deny_idle().
So maybe clk_deny_idle() is could just be something like:
dev = clk_get_device(clk);
...
error = pm_runtime_get(dev);
...pm_runtime_put(dev);
...
And that way it would just propagate to the parent clock domain driver and the clock framework does not need to know about clockdomains. A clockdomain could be just a genpd domain.
Or do you guys have better ideas?
Regards,
Tony
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoting Tony Lindgren (2018-11-30 07:37:29)
Quoted 31 lines
Hi,
Quoted 10 lines · Tero Kristo
Quoted 5 lines · Stephen Boyd
No that is not preferred. Can the
omap2_clk_deny_idle()function be integrated closer into the clk framework in some way that allows it to be part of theclk_opsstructure? And then have that take aclk_hwstructure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.It could be added under the main
clk_opsstruct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature?From consumer usage point of view, I'm still wondering about the relationship of
clk_deny_idle()andclkdm_deny_idle().It seems that we need to allow reset control drivers call
clk_deny_idle()for the duration of reset. And it seems theclk_deny_idle()should propagate to also up to the related clock domain driver to doclkdm_deny_idle().So maybe
clk_deny_idle()is could just be something like:dev =
clk_get_device(clk);
...
error =pm_runtime_get(dev);
...pm_runtime_put(dev);
...
Quoted 7 lines
And that way it would just propagate to the parent clock domain driver and the clock framework does not need to know about clockdomains. A clockdomain could be just a genpd domain.
Or do you guys have better ideas?
Wouldn't the device link in clk framework patches do this for you if we had the RUNTIME_PM flag passed in. If this is about keeping the clock controller active when a consumer device is using it then I think it may work.
Tony Lindgren
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 37 lines · Stephen Boyd
Quoting Tony Lindgren (2018-11-30 07:37:29)
Quoted 36 lines
Hi,
Quoted 10 lines · Tero Kristo
Quoted 5 lines · Stephen Boyd
No that is not preferred. Can the
omap2_clk_deny_idle()function be integrated closer into the clk framework in some way that allows it to be part of theclk_opsstructure? And then have that take aclk_hwstructure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.It could be added under the main
clk_opsstruct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature?From consumer usage point of view, I'm still wondering about the relationship of
clk_deny_idle()andclkdm_deny_idle().It seems that we need to allow reset control drivers call
clk_deny_idle()for the duration of reset. And it seems theclk_deny_idle()should propagate to also up to the related clock domain driver to doclkdm_deny_idle().So maybe
clk_deny_idle()is could just be something like:dev =
clk_get_device(clk);
...
error =pm_runtime_get(dev);
...pm_runtime_put(dev);
...And that way it would just propagate to the parent clock domain driver and the clock framework does not need to know about clockdomains. A clockdomain could be just a genpd domain.
Quoted 7 lines
Quoted 2 lines
Or do you guys have better ideas?
Wouldn't the device link in clk framework patches do this for you if we had the
RUNTIME_PMflag passed in. If this is about keeping the clock controller active when a consumer device is using it then I think it may work.
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Below is a clarified suggested example usage if we wanted to use PM runtime on a clock controller device from a consumer device reset driver:
error = pm_runtime_get_dev()
...
cdev = clk_get_device(clk);
...
error = pm_runtime_get(cdev);
...
/* Do the consumer device reset here */
...pm_runtime_put(cdev);pm_runtime_put(dev);
Regards,
Tony
Andreas Kemnade
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 46 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 37 lines · Stephen Boyd
Quoting Tony Lindgren (2018-11-30 07:37:29)
Quoted 36 lines
Hi,
Quoted 10 lines · Tero Kristo
Quoted 5 lines · Stephen Boyd
No that is not preferred. Can the
omap2_clk_deny_idle()function be integrated closer into the clk framework in some way that allows it to be part of theclk_opsstructure? And then have that take aclk_hwstructure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.It could be added under the main
clk_opsstruct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature?From consumer usage point of view, I'm still wondering about the relationship of
clk_deny_idle()andclkdm_deny_idle().It seems that we need to allow reset control drivers call
clk_deny_idle()for the duration of reset. And it seems theclk_deny_idle()should propagate to also up to the related clock domain driver to doclkdm_deny_idle().So maybe
clk_deny_idle()is could just be something like:dev =
clk_get_device(clk);
...
error =pm_runtime_get(dev);
...pm_runtime_put(dev);
...And that way it would just propagate to the parent clock domain driver and the clock framework does not need to know about clockdomains. A clockdomain could be just a genpd domain.
Quoted 7 lines
Quoted 2 lines
Or do you guys have better ideas?
Wouldn't the device link in clk framework patches do this for you if we had the
RUNTIME_PMflag passed in. If this is about keeping the clock controller active when a consumer device is using it then I think it may work.
Quoted 5 lines
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?
Regards,
Andreas
Tony Lindgren
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 7 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Quoted 7 lines
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Regards,
Tony
Andreas Kemnade
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Quoted 7 lines
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
What are currently visible symptoms for the driver not blocking autoidle for reset? Maybe I can at least test something there. I have also omap5 here.
Regards,
Andreas
Tony Lindgren
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 21 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 14 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?
Quoted 5 lines
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Well I think we're still waiting on Tero to comment on this.
Quoted 3 lines
What are currently visible symptoms for the driver not blocking autoidle for reset? Maybe I can at least test something there. I have also omap5 here.
Oh that's just for making drivers/reset drivers to work in the long run. Let's keep that separate from these fixes..
Regards,
Tony
Re: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 14 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Well I think we're still waiting on Tero to comment on this.
The only item requiring immediate fixing is the point Stephen made out, removing the usage of CLK_IS_BASIC from this patch.
Afaics, the reset related concerns Tony has can be handled later.
-Tero
Quoted 5 lines
Quoted 4 lines
What are currently visible symptoms for the driver not blocking autoidle for reset? Maybe I can at least test something there. I have also omap5 here.
Quoted 8 lines
Oh that's just for making
drivers/resetdrivers to work in the long run. Let's keep that separate from these fixes..Regards,
Tony
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Andreas Kemnade
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 29 lines · On Mon, 31 Dec 2018 09:23:01 +0200 Tero Kristo <[email protected]> wrote:
Quoted 28 lines · Tony Lindgren
Quoted 26 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 7 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Quoted 7 lines
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Quoted 7 lines
Quoted 1 line
Well I think we're still waiting on Tero to comment on this.
The only item requiring immediate fixing is the point Stephen made out, removing the usage of
CLK_IS_BASICfrom this patch.Afaics, the reset related concerns Tony has can be handled later.
hmm, and there we need Stephen's opinion about having the allow/deny autoidle functions in the main clk_ops struct.
Regards,
Andreas
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoting Andreas Kemnade (2018-12-31 00:30:21)
Quoted 34 lines
Quoted 31 lines · On Mon, 31 Dec 2018 09:23:01 +0200 Tero Kristo <[email protected]> wrote:
Quoted 29 lines · Tony Lindgren
Quoted 21 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 14 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?Quoted 5 lines
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Well I think we're still waiting on Tero to comment on this.
Quoted 8 lines
Quoted 5 lines
The only item requiring immediate fixing is the point Stephen made out, removing the usage of
CLK_IS_BASICfrom this patch.Afaics, the reset related concerns Tony has can be handled later.
hmm, and there we need Stephen's opinion about having the allow/deny autoidle functions in the main
clk_opsstruct.
I have unanswered questions on the list for this thread[1]. I'm not sure what allow/deny autoidle functions mean to clk drivers. It looks like an OMAP specific addition to the clk_ops struct, which sounds wrong to put it plainly. Hopefully it can be done outside of the clk framework by having the provider driver know more things about all the frameworks it's hooking into.
[1] https://lkml.kernel.org/r/154385676593.88331.5239924154783168815@swboyd.mtv.corp.google.com
Re: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 38 lines · Stephen Boyd
Quoting Andreas Kemnade (2018-12-31 00:30:21)
Quoted 37 lines
Quoted 34 lines · On Mon, 31 Dec 2018 09:23:01 +0200 Tero Kristo <[email protected]> wrote:
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 14 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Well I think we're still waiting on Tero to comment on this.
The only item requiring immediate fixing is the point Stephen made out, removing the usage of
CLK_IS_BASICfrom this patch.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Afaics, the reset related concerns Tony has can be handled later.
hmm, and there we need Stephen's opinion about having the allow/deny autoidle functions in the main
clk_opsstruct.I have unanswered questions on the list for this thread[1].
The reset portion we can't answer with the current knowledge I fear, we need to prototype this a bit first and see which way to go.
Quoted 4 lines
I'm not sure
what allow/deny autoidle functions mean to clk drivers. It looks like an OMAP specific addition to theclk_opsstruct, which sounds wrong to put it plainly.
Yeah, I don't think other SoCs implement the same functionality, at least not in the same way. The autoidle bits are available in omap2/omap3 only, where they control the HW autoidle functionality of these clocks. If the bit is enabled, the HW can autonomously disable the clock once it is not needed anymore by HW.
Quoted 3 lines
Hopefully it can be done outside of the clk framework by having the provider driver know more things about all the frameworks it's hooking into.
This is how it has been done so far, however Andreas wants to expand the functionality a bit where it breaks... unless we can use the CLK_IS_BASIC flag to detect if we accessing an OMAP specific clock or not. If we are passing in a clk pointer from a consumer level API, I don't know if there is any other way to go with this if we can't modify the generic clk_ops struct.
The same flag check is used across TI clock driver already btw.
-Tero
Quoted 3 lines
[1] https://lkml.kernel.org/r/154385676593.88331.5239924154783168815@swboyd.mtv.corp.google.com
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoting Tero Kristo (2019-01-03 23:28:58)
Quoted 55 lines · Stephen Boyd
Quoted 38 lines
Quoting Andreas Kemnade (2018-12-31 00:30:21)
Quoted 37 lines
Quoted 34 lines · On Mon, 31 Dec 2018 09:23:01 +0200 Tero Kristo <[email protected]> wrote:
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 14 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Well I think we're still waiting on Tero to comment on this.
The only item requiring immediate fixing is the point Stephen made out, removing the usage of
CLK_IS_BASICfrom this patch.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Afaics, the reset related concerns Tony has can be handled later.
hmm, and there we need Stephen's opinion about having the allow/deny autoidle functions in the main
clk_opsstruct.I have unanswered questions on the list for this thread[1].
The reset portion we can't answer with the current knowledge I fear, we need to prototype this a bit first and see which way to go.
Quoted 4 lines
I'm not sure
what allow/deny autoidle functions mean to clk drivers. It looks like an OMAP specific addition to theclk_opsstruct, which sounds wrong to put it plainly.
Quoted 5 lines
Yeah, I don't think other SoCs implement the same functionality, at least not in the same way. The autoidle bits are available in omap2/omap3 only, where they control the HW autoidle functionality of these clocks. If the bit is enabled, the HW can autonomously disable the clock once it is not needed anymore by HW.
Some qcom chips have automatic clock gating (basically hw clk gating) but they don't really need to involve that with the reset asserting or deasserting anymore. It used to be that they had to turn off the automatic mode, assert the reset, deassert the reset, and then reenable the automatic mode. So there is some precedence for this. But again, I think that the reset controller and the clk controller are the same device in both vendor instances so in theory the driver can be one driver for both clk and reset and do the proper things on the backend. So just use reset controller framework and register that from the clk controller driver?
Quoted 5 lines
Quoted 4 lines
Hopefully it can be done outside of the clk framework by having the provider driver know more things about all the frameworks it's hooking into.
Quoted 9 lines
This is how it has been done so far, however Andreas wants to expand the functionality a bit where it breaks... unless we can use the
CLK_IS_BASICflag to detect if we accessing an OMAP specific clock or not. If we are passing in a clk pointer from a consumer level API, I don't know if there is any other way to go with this if we can't modify the genericclk_opsstruct.The same flag check is used across TI clock driver already btw.
Sure, it's not like this is a new problem. I'd just like to see if we can solve it now and get rid of the CLK_IS_BASIC flag now. It would be great if some extra effort could be put into it vs. punting the problem until 2020 or something.
Re: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
Quoted 85 lines · Stephen Boyd
Quoting Tero Kristo (2019-01-03 23:28:58)
Quoted 55 lines · Stephen Boyd
Quoted 38 lines
Quoting Andreas Kemnade (2018-12-31 00:30:21)
Quoted 37 lines
Quoted 34 lines · On Mon, 31 Dec 2018 09:23:01 +0200 Tero Kristo <[email protected]> wrote:
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Andreas Kemnade
Hi,
Quoted 16 lines · On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 14 lines · Andreas Kemnade
Quoted 5 lines · On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <[email protected]> wrote:
The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Are we still talking about the same problem? Maybe I am losing track here. Just to make sure.
The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that.
Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas?Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset.
Hmm, is this set now waiting for the famous "somebody" fixing all the stuff?
Well I think we're still waiting on Tero to comment on this.
The only item requiring immediate fixing is the point Stephen made out, removing the usage of
CLK_IS_BASICfrom this patch.Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Afaics, the reset related concerns Tony has can be handled later.
hmm, and there we need Stephen's opinion about having the allow/deny autoidle functions in the main
clk_opsstruct.I have unanswered questions on the list for this thread[1].
The reset portion we can't answer with the current knowledge I fear, we need to prototype this a bit first and see which way to go.
Quoted 4 lines
I'm not sure
what allow/deny autoidle functions mean to clk drivers. It looks like an OMAP specific addition to theclk_opsstruct, which sounds wrong to put it plainly.Quoted 5 lines
Yeah, I don't think other SoCs implement the same functionality, at least not in the same way. The autoidle bits are available in omap2/omap3 only, where they control the HW autoidle functionality of these clocks. If the bit is enabled, the HW can autonomously disable the clock once it is not needed anymore by HW.
Some qcom chips have automatic clock gating (basically hw clk gating) but they don't really need to involve that with the reset asserting or deasserting anymore. It used to be that they had to turn off the automatic mode, assert the reset, deassert the reset, and then reenable the automatic mode. So there is some precedence for this. But again, I think that the reset controller and the clk controller are the same device in both vendor instances so in theory the driver can be one driver for both clk and reset and do the proper things on the backend. So just use reset controller framework and register that from the clk controller driver?
Quoted 12 lines
Quoted 4 lines
Hopefully it can be done outside of the clk framework by having the provider driver know more things about all the frameworks it's hooking into.
This is how it has been done so far, however Andreas wants to expand the functionality a bit where it breaks... unless we can use the
CLK_IS_BASICflag to detect if we accessing an OMAP specific clock or not. If we are passing in a clk pointer from a consumer level API, I don't know if there is any other way to go with this if we can't modify the genericclk_opsstruct.
Quoted 7 lines
Quoted 2 lines
The same flag check is used across TI clock driver already btw.
Sure, it's not like this is a new problem. I'd just like to see if we can solve it now and get rid of the
CLK_IS_BASICflag now. It would be great if some extra effort could be put into it vs. punting the problem until 2020 or something.
Ok, let me see if I can figure out something for this...
-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Stephen Boyd
maintainerRe: [PATCH v2 2/3] clk: ti: check clock type before doing autoidle ops
In reply to Tony LindgrenQuoting Tony Lindgren (2018-12-03 07:39:10)
Quoted 28 lines · Stephen Boyd
Quoted 10 lines
Quoting Tony Lindgren (2018-11-30 07:37:29)
Quoted 9 lines · Tero Kristo
Quoted 1 line · Stephen Boyd
...
And that way it would just propagate to the parent clock domain driver and the clock framework does not need to know about clockdomains. A clockdomain could be just a genpd domain.
Quoted 7 lines
Quoted 2 lines
Or do you guys have better ideas?
Wouldn't the device link in clk framework patches do this for you if we had the
RUNTIME_PMflag passed in. If this is about keeping the clock controller active when a consumer device is using it then I think it may work.The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled.
Below is a clarified suggested example usage if we wanted to use PM runtime on a clock controller device from a consumer device reset driver:
Quoted 11 lines
error =
pm_runtime_get_dev()
...
cdev =clk_get_device(clk);
...
error =pm_runtime_get(cdev);
...
/* Do the consumer device reset here */
...pm_runtime_put(cdev);pm_runtime_put(dev);
Does the consumer reset use the reset framework or something else? If the driver is using the reset framework, I would expect the reset framework to _also_ have device links and keep the clock controller, i.e. reset provider, active while the reset is being toggled. And this assumes the reset controller and clock controller code is all rolled up together in a single driver that can tell itself to deny idle for certain clks that are associated with whatever resets they affect.
Andreas Kemnade
maintainerPATCH v2 3/3 arm: omap_hwmod disable ick autoidling when a hwmod requires that
In reply to Andreas KemnadeDeny autoidle for hwmods with the OCPIF_SWSUP_IDLE flag, that makes hwmods working properly which cannot handle autoidle properly in lower power states.
Affected is e. g. the omap_hdq.
Since an ick might have mulitple users, autoidle is disabled when an individual user requires that rather than in _setup_iclk_autoidle. dss_ick is an example for that.
---
Comments to v1 to this patch were worked into a new 2/3
--- arch/arm/mach-omap2/omap_hwmod.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +12 -4
@@ -1002,8 +1002,10 @@ static int _enable_clocks(struct omap_hwmod *oh)clk_enable (oh->_clk);list_for_each_entry (os, &oh->slave_ports, node) { -if (os->_clk && (os->flags &OCPIF_SWSUP_IDLE )) +if (os->_clk && (os->flags &OCPIF_SWSUP_IDLE )) { +omap2_clk_deny_idle (os->_clk);clk_enable (os->_clk); + } }/* The opt clocks are controlled by the device driver. */
@@ -1055,8 +1057,10 @@ static int _disable_clocks(struct omap_hwmod *oh)clk_disable (oh->_clk);list_for_each_entry (os, &oh->slave_ports, node) { -if (os->_clk && (os->flags &OCPIF_SWSUP_IDLE )) +if (os->_clk && (os->flags &OCPIF_SWSUP_IDLE )) {clk_disable (os->_clk); +omap2_clk_allow_idle (os->_clk); + } }if (oh->flags &HWMOD_OPT_CLKS_NEEDED )
@@ -2425,9 +2429,13 @@ static void __init _setup_iclk_autoidle(struct omap_hwmod *oh)continue ;if (os->flags &OCPIF_SWSUP_IDLE ) { -/* XXX omap_iclk_deny_idle(c); */ +/* +* we might have multiple users of one iclk with +* different requirements, disable autoidle when +* the module is enabled, e.g. dss iclk +*/ }else { -/* XXX omap_iclk_allow_idle(c); */ +/* we are enabling autoidle afterwards anyways */ clk_enable (os->_clk); } }
Signature · 1 line
2.11.0
Stephen Boyd
maintainerQuoting Andreas Kemnade (2018-11-10 12:31:12)
Quoted 7 lines
On the gta04 with a dm3730
omap_hdqdoes not work properly when the device enters lower power states. Idling uart1 and 2 is enough to show up that problem, if there are no other things enabled. Further research reveals that hdq iclk must not be turned off during transfers, also according to the TRM. That fact is also correctly described in the flags but the code to handle that is incomplete.
Quoted 8 lines
To handle multiple users of a single ick, autoidle is disabled when a user of that ick requires that (has the
OCPIF_SWSUP_IDLE))Changes since v1:
- uses spinlocks instead of mutexes
- invert counter logic
- check whether clock type is basic
I'm expecting someone like Tero or Tony to review this.
Quoted 11 lines · Stephen Boyd
Quoting Andreas Kemnade (2018-11-10 12:31:12)
Quoted 10 lines
On the gta04 with a dm3730
omap_hdqdoes not work properly when the device enters lower power states. Idling uart1 and 2 is enough to show up that problem, if there are no other things enabled. Further research reveals that hdq iclk must not be turned off during transfers, also according to the TRM. That fact is also correctly described in the flags but the code to handle that is incomplete.To handle multiple users of a single ick, autoidle is disabled when a user of that ick requires that (has the
OCPIF_SWSUP_IDLE))
Quoted 8 lines
Quoted 5 lines
Changes since v1:
- uses spinlocks instead of mutexes
- invert counter logic
- check whether clock type is basicI'm expecting someone like Tero or Tony to review this.
Rest of it looks fine to me, except for the discussion under the CLK_IS_BASIC flag, which might trigger a bigger rework of the code.
-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Stephen Boyd
maintainerQuoting Tero Kristo (2018-11-29 23:37:35)
Quoted 18 lines · Stephen Boyd
Quoted 17 lines
Quoting Andreas Kemnade (2018-11-10 12:31:12)
Quoted 15 lines
On the gta04 with a dm3730
omap_hdqdoes not work properly when the device enters lower power states. Idling uart1 and 2 is enough to show up that problem, if there are no other things enabled. Further research reveals that hdq iclk must not be turned off during transfers, also according to the TRM. That fact is also correctly described in the flags but the code to handle that is incomplete.To handle multiple users of a single ick, autoidle is disabled when a user of that ick requires that (has the
OCPIF_SWSUP_IDLE))Changes since v1:
- uses spinlocks instead of mutexes
- invert counter logic
- check whether clock type is basic
Quoted 6 lines
Quoted 2 lines
I'm expecting someone like Tero or Tony to review this.
Rest of it looks fine to me, except for the discussion under the
CLK_IS_BASICflag, which might trigger a bigger rework of the code.
Is that a Reviewed-by tag?
Quoted 19 lines · Stephen Boyd
Quoting Tero Kristo (2018-11-29 23:37:35)
Quoted 18 lines · Stephen Boyd
Quoted 17 lines
Quoting Andreas Kemnade (2018-11-10 12:31:12)
Quoted 15 lines
On the gta04 with a dm3730
omap_hdqdoes not work properly when the device enters lower power states. Idling uart1 and 2 is enough to show up that problem, if there are no other things enabled. Further research reveals that hdq iclk must not be turned off during transfers, also according to the TRM. That fact is also correctly described in the flags but the code to handle that is incomplete.To handle multiple users of a single ick, autoidle is disabled when a user of that ick requires that (has the
OCPIF_SWSUP_IDLE))Changes since v1:
- uses spinlocks instead of mutexes
- invert counter logic
- check whether clock type is basic
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
I'm expecting someone like Tero or Tony to review this.
Rest of it looks fine to me, except for the discussion under the
CLK_IS_BASICflag, which might trigger a bigger rework of the code.Is that a Reviewed-by tag?
Not yet, lets see where discussion ends up with patch #2. :)
-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki