This patch series adds support in clock framework for clocks which operations
requires its parent clock is on.
Such clock type is initially met on Freescale i.MX7D platform that all clocks
operations, including enable/disable, rate change and re-parent, requires its
parent clock on. No sure if any other SoC has the similar clock type.
Current clock core can not support such type of clock well.
This patch introduce a new flag CLK_SET_PARENT_ON to handle this special case
in clock core that enable its parent clock firstly for each operation and disable
it later after operation complete.
The most special case is for set_parent() operation which requires both parent,
old one and new one, to be enabled at the same time during the operation.
The patch series is based on for-next branch of Michael's git:
git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
Change Log v1->v2:
Mainly addressed Stephen Boyd's comments
* remove dupliciated code with __clk_set_parent_after
* introduce more clk_core_x APIs for core easily use
* move clk_disable_unused code position
* use clk_core_x API to make code more clean and easily read
Dong Aisheng (5):
clk: remove duplicated code with __clk_set_parent_after
clk: introduce clk_core_enable_lock and clk_core_disable_lock
functions
clk: move clk_disable_unused after clk_core_disable_unprepare function
clk: core: add CLK_OPS_PARENT_ON flags to support clocks require
parent on
clk: core: add CLK_OPS_PARENT_ON flags to support clocks require
parent on
drivers/clk/clk.c | 338 +++++++++++++++++++++++++------------------
include/linux/clk-provider.h | 5 +
2 files changed, 200 insertions(+), 143 deletions(-)
--
1.9.1
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
---
drivers/clk/clk.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
On Freescale i.MX7D platform, all clocks operations, including
enable/disable, rate change and re-parent, requires its parent
clock on. Current clock core can not support it well.
This patch introduce a new flag CLK_OPS_PARENT_ON to handle this
special case in clock core that enable its parent clock firstly for
each operation and disable it later after operation complete.
This patch fixes disaling clocks while its parent is off.
This is a special case that is caused by a state mis-align between
HW and SW in clock tree during booting.
Usually in uboot, we may enable all clocks in HW by default.
And during kernel booting time, the parent clock could be disabled in its
driver probe due to calling clk_prepare_enable and clk_disable_unprepare.
Because it's child clock is only enabled in HW while its SW usecount
in clock tree is still 0, so clk_disable of parent clock will gate
the parent clock in both HW and SW usecount ultimately.
Then there will be a clock is on in HW while its parent is disabled.
Later when clock core does clk_disable_unused, this clock disable
will cause system hang due to the limitation of operation requiring
its parent clock on.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
---
drivers/clk/clk.c | 5 +++++
include/linux/clk-provider.h | 5 +++++
2 files changed, 10 insertions(+)
@@ -31,6 +31,11 @@#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */#define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */+/*+*parentclockmustbeonacrossanyoperationincluding+*clockgate/ungate,ratechangeandre-parent+*/+#define CLK_OPS_PARENT_ON BIT(9)structclk_hw;structclk_core;
On Freescale i.MX7D platform, all clocks operations, including
enable/disable, rate change and re-parent, requires its parent clock on.
Current clock core can not support it well.
This patch adding flag CLK_OPS_PARENT_ON to handle this special case in
clock core that enable its parent clock firstly for each operation and
disable it later after operation complete.
This patch fixes changing clock rate and switch parent while its parent
is off. The most special case is for set_parent() operation which requires
both parent, including old one and new one, to be enabled at the same time
during the operation.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
---
drivers/clk/clk.c | 46 +++++++++++++++++++++++++++++-----------------
1 file changed, 29 insertions(+), 17 deletions(-)
No function level change, just moving code place.
clk_disable_unused function will need to call clk_core_prepare_enable/
clk_core_disable_unprepare when adding CLK_OPS_PARENT_ON features.
So move it after clk_core_disable_unprepare to avoid adding forward
declared functions.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
---
drivers/clk/clk.c | 196 +++++++++++++++++++++++++++---------------------------
1 file changed, 98 insertions(+), 98 deletions(-)
This can be useful when clock core wants to enable/disable clocks.
Then we don't have to convert the struct clk_core to struct clk to call
clk_enable/clk_disable which is a bit un-align with exist using.
And after introduce clk_core_{enable|disable}_lock, we can refine
clk_eanble and clk_disable a bit.
As well as clk_core_{enable|disable}_lock, we also added
clk_core_{prepare|unprepare}_lock and clk_core_prepare_enable/
clk_core_unprepare_disable for clock core to easily use.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
---
drivers/clk/clk.c | 85 +++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 63 insertions(+), 22 deletions(-)
Hi Stephen,
On Thu, May 14, 2015 at 09:28:58PM +0800, Dong Aisheng wrote:
This patch series adds support in clock framework for clocks which operations
requires its parent clock is on.
Such clock type is initially met on Freescale i.MX7D platform that all clocks
operations, including enable/disable, rate change and re-parent, requires its
parent clock on. No sure if any other SoC has the similar clock type.
Current clock core can not support such type of clock well.
This patch introduce a new flag CLK_SET_PARENT_ON to handle this special case
in clock core that enable its parent clock firstly for each operation and disable
it later after operation complete.
The most special case is for set_parent() operation which requires both parent,
old one and new one, to be enabled at the same time during the operation.
The patch series is based on for-next branch of Michael's git:
git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git
Change Log v1->v2:
Mainly addressed Stephen Boyd's comments
* remove dupliciated code with __clk_set_parent_after
* introduce more clk_core_x APIs for core easily use
* move clk_disable_unused code position
* use clk_core_x API to make code more clean and easily read
Dong Aisheng (5):
clk: remove duplicated code with __clk_set_parent_after
clk: introduce clk_core_enable_lock and clk_core_disable_lock
functions
clk: move clk_disable_unused after clk_core_disable_unprepare function
clk: core: add CLK_OPS_PARENT_ON flags to support clocks require
parent on
clk: core: add CLK_OPS_PARENT_ON flags to support clocks require
parent on
From: Michael Turquette <hidden> Date: 2015-05-28 04:09:36
Quoting Dong Aisheng (2015-05-14 06:28:59)
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Regards,
Mike
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
Quoting Dong Aisheng (2015-05-14 06:28:59)
quoted
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Thanks for the review.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Yes, before this patch series, it's never used. :)
Regards
Dong Aisheng
Hi Mike,
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
Quoting Dong Aisheng (2015-05-14 06:28:59)
quoted
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Ping...
I did not see this patch series in your tree for v4.2 rc.
Is this got missed?
Regards
Dong Aisheng
On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
Hi Mike,
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
quoted
Quoting Dong Aisheng (2015-05-14 06:28:59)
quoted
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Ping...
I did not see this patch series in your tree for v4.2 rc.
Is this got missed?
Ping...
On Wed, Jul 15, 2015 at 08:29:56PM +0800, Dong Aisheng wrote:
On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
quoted
Hi Mike,
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
quoted
Quoting Dong Aisheng (2015-05-14 06:28:59)
quoted
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Ping...
I did not see this patch series in your tree for v4.2 rc.
Is this got missed?
From: Michael Turquette <hidden> Date: 2015-07-24 00:11:35
Quoting Dong Aisheng (2015-07-22 07:08:10)
Ping...
On Wed, Jul 15, 2015 at 08:29:56PM +0800, Dong Aisheng wrote:
quoted
On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
quoted
Hi Mike,
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
quoted
Quoting Dong Aisheng (2015-05-14 06:28:59)
quoted
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Ping...
I did not see this patch series in your tree for v4.2 rc.
Is this got missed?
Dong Aisheng,
Yes it was missed. My apologies. Can you refresh it and re-send?
Thanks,
Mike
On Thu, Jul 23, 2015 at 05:11:35PM -0700, Michael Turquette wrote:
Quoting Dong Aisheng (2015-07-22 07:08:10)
quoted
Ping...
On Wed, Jul 15, 2015 at 08:29:56PM +0800, Dong Aisheng wrote:
quoted
On Wed, Jul 15, 2015 at 08:25:24PM +0800, Dong Aisheng wrote:
quoted
Hi Mike,
On Wed, May 27, 2015 at 09:09:19PM -0700, Michael Turquette wrote:
quoted
Quoting Dong Aisheng (2015-05-14 06:28:59)
quoted
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.
Cc: Mike Turquette <redacted>
Cc: Stephen Boyd <redacted>
Suggested-by: Stephen Boyd <redacted>
Signed-off-by: Dong Aisheng <redacted>
Patch looks good to me.
Also just noticed that the second argument to __clk_set_parent_after is
never used :-(
Ping...
I did not see this patch series in your tree for v4.2 rc.
Is this got missed?
Dong Aisheng,
Yes it was missed. My apologies. Can you refresh it and re-send?