mbox series

[GIT,PULL] clk: ti: updates for v4.20

Message ID ee107173-b39c-5dc0-4aef-9848639b1b38@ti.com (mailing list archive)
State Accepted
Headers show
Series [GIT,PULL] clk: ti: updates for v4.20 | expand

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/kristo/linux

Message

Tero Kristo Oct. 3, 2018, 1:12 p.m. UTC
Hi Mike, Stephen,

Here are the late changes for TI clock driver for 4.20 merge window. 
Sorry about the late pull request, but this was waiting for resolution 
on one of the dependencies (patch "clk: ti: fix OF child-node 
lookup..."). Thanks for setting up the immutable branch for it.

Please especially note the core clock changes in this series for adding 
support of clk save/restore mechanism (two patches from Russ Dill.) I 
decided to go ahead by adding them to this pull as there has been no 
comments on the patches and they have been pending on the lists already 
for a while. They aren't touching anything existing either, so they 
should be safe to apply also.

Thanks, Tero.

----------------

The following changes since commit 00a461cc32ec27fa7bd9c874a7b36b0c6c542c12:

   clk: ti: fix OF child-node lookup (2018-08-30 14:44:01 -0700)

are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/kristo/linux 
tags/clk-ti-for-4.20

for you to fetch changes up to d6e7bbc148f9fbec8a0117b0d0f420c9710e6d81:

   clk: ti: Add functions to save/restore clk context (2018-10-03 
15:29:19 +0300)

----------------------------------------------------------------
TI clock driver changes for v4.20 merge window.

This tag adds changes for the Texas Instruments clock driver. Included
changes are:
- clkctrl driver changes switching the layout from CM based to clockdomain
   based. Needed for ongoing hwmod transition towards sysc driver. Changed
   SoCs for this include am3,am4,am5,dra7.
- RTC+DDR sleep mode support code for clock save/restore. The deep sleep
   states will wipe the clock register space on the SoC, requiring save/
   restore support so that the state can be retained over the sleep state.

----------------------------------------------------------------
Keerthy (1):
       clk: clk: Add clk_gate_restore_context function

Russ Dill (2):
       clk: Add functions to save/restore clock context en-masse
       clk: ti: Add functions to save/restore clk context

Tero Kristo (11):
       dt-bindings: clock: am33xx: add clkctrl indices for new data layout
       dt-bindings: clock: am43xx: add clkctrl indices for new data layout
       dt-bindings: clock: dra7xx: add clkctrl indices for new data layout
       clk: ti: clkctrl: support multiple clkctrl nodes under a cm node
       clk: ti: clkctrl: replace dashes from clkdm name with underscore
       clk: ti: am33xx: rename existing clkctrl data as compat data
       clk: ti: am33xx: add new clkctrl data for am33xx
       clk: ti: am43xx: rename existing clkctrl data as compat data
       clk: ti: am43xx: add new clkctrl data for am43xx
       clk: ti: dra7xx: rename existing clkctrl data as compat data
       clk: ti: dra7: add new clkctrl data

  drivers/clk/clk.c                |  93 +++++
  drivers/clk/ti/Makefile          |   9 +-
  drivers/clk/ti/clk-33xx-compat.c | 218 +++++++++++
  drivers/clk/ti/clk-33xx.c        | 232 ++++++-----
  drivers/clk/ti/clk-43xx-compat.c | 225 +++++++++++
  drivers/clk/ti/clk-43xx.c        | 249 +++++++-----
  drivers/clk/ti/clk-7xx-compat.c  | 823 
+++++++++++++++++++++++++++++++++++++++
  drivers/clk/ti/clk-7xx.c         | 590 +++++++++++++++-------------
  drivers/clk/ti/clk.c             |   7 +-
  drivers/clk/ti/clkctrl.c         | 104 +++--
  drivers/clk/ti/clock.h           |  11 +
  drivers/clk/ti/divider.c         |  36 ++
  drivers/clk/ti/dpll.c            |   6 +
  drivers/clk/ti/dpll3xxx.c        | 124 ++++++
  drivers/clk/ti/gate.c            |   3 +
  drivers/clk/ti/mux.c             |  29 ++
  include/dt-bindings/clock/am3.h  | 119 ++++++
  include/dt-bindings/clock/am4.h  | 132 +++++++
  include/dt-bindings/clock/dra7.h | 326 ++++++++++++----
  include/linux/clk-provider.h     |   9 +
  include/linux/clk.h              |  25 ++
  include/linux/clk/ti.h           |   7 +
  22 files changed, 2827 insertions(+), 550 deletions(-)
  create mode 100644 drivers/clk/ti/clk-33xx-compat.c
  create mode 100644 drivers/clk/ti/clk-43xx-compat.c
  create mode 100644 drivers/clk/ti/clk-7xx-compat.c
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Comments

Stephen Boyd Oct. 11, 2018, 4:28 p.m. UTC | #1
Quoting Tero Kristo (2018-10-03 06:12:39)
> Hi Mike, Stephen,
> 
> Here are the late changes for TI clock driver for 4.20 merge window. 
> Sorry about the late pull request, but this was waiting for resolution 
> on one of the dependencies (patch "clk: ti: fix OF child-node 
> lookup..."). Thanks for setting up the immutable branch for it.
> 
> Please especially note the core clock changes in this series for adding 
> support of clk save/restore mechanism (two patches from Russ Dill.) I 
> decided to go ahead by adding them to this pull as there has been no 
> comments on the patches and they have been pending on the lists already 
> for a while. They aren't touching anything existing either, so they 
> should be safe to apply also.

Thanks for calling it out and pushing me to react. I have been avoiding
the suspend/resume patches unsuccessfully and now after looking at them
I see a few nitpicks that I can resolve after merging this PR. It's also
a sort of one-off solution for TI where all clks need to run through
save/restore in a depth-first tree order and just blast in
enable/disable bits, so we'll need to improve on it in the future. But
I'm fine to go with it for now and do _something_ instead of just sit
around and do nothing.

----8<----

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index dd775771a7cc..af011974d4ec 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -935,39 +935,41 @@ static int clk_core_enable_lock(struct clk_core *core)
  */
 void clk_gate_restore_context(struct clk_hw *hw)
 {
-	if (hw->clk->core->enable_count)
-		hw->clk->core->ops->enable(hw);
+	struct clk_core *core = hw->core;
+
+	if (core->enable_count)
+		core->ops->enable(hw);
 	else
-		hw->clk->core->ops->disable(hw);
+		core->ops->disable(hw);
 }
 EXPORT_SYMBOL_GPL(clk_gate_restore_context);
 
-static int _clk_save_context(struct clk_core *clk)
+static int clk_core_save_context(struct clk_core *core)
 {
 	struct clk_core *child;
 	int ret = 0;
 
-	hlist_for_each_entry(child, &clk->children, child_node) {
-		ret = _clk_save_context(child);
+	hlist_for_each_entry(child, &core->children, child_node) {
+		ret = clk_core_save_context(child);
 		if (ret < 0)
 			return ret;
 	}
 
-	if (clk->ops && clk->ops->save_context)
-		ret = clk->ops->save_context(clk->hw);
+	if (core->ops && core->ops->save_context)
+		ret = core->ops->save_context(core->hw);
 
 	return ret;
 }
 
-static void _clk_restore_context(struct clk_core *clk)
+static void clk_core_restore_context(struct clk_core *core)
 {
 	struct clk_core *child;
 
-	if (clk->ops && clk->ops->restore_context)
-		clk->ops->restore_context(clk->hw);
+	if (core->ops && core->ops->restore_context)
+		core->ops->restore_context(core->hw);
 
-	hlist_for_each_entry(child, &clk->children, child_node)
-		_clk_restore_context(child);
+	hlist_for_each_entry(child, &core->children, child_node)
+		clk_core_restore_context(child);
 }
 
 /**
@@ -983,13 +985,13 @@ int clk_save_context(void)
 	int ret;
 
 	hlist_for_each_entry(clk, &clk_root_list, child_node) {
-		ret = _clk_save_context(clk);
+		ret = clk_core_save_context(clk);
 		if (ret < 0)
 			return ret;
 	}
 
 	hlist_for_each_entry(clk, &clk_orphan_list, child_node) {
-		ret = _clk_save_context(clk);
+		ret = clk_core_save_context(clk);
 		if (ret < 0)
 			return ret;
 	}
@@ -1006,13 +1008,13 @@ EXPORT_SYMBOL_GPL(clk_save_context);
  */
 void clk_restore_context(void)
 {
-	struct clk_core *clk;
+	struct clk_core *core;
 
-	hlist_for_each_entry(clk, &clk_root_list, child_node)
-		_clk_restore_context(clk);
+	hlist_for_each_entry(core, &clk_root_list, child_node)
+		clk_core_restore_context(core);
 
-	hlist_for_each_entry(clk, &clk_orphan_list, child_node)
-		_clk_restore_context(clk);
+	hlist_for_each_entry(core, &clk_orphan_list, child_node)
+		clk_core_restore_context(core);
 }
 EXPORT_SYMBOL_GPL(clk_restore_context);
Geert Uytterhoeven Oct. 12, 2018, 6:50 a.m. UTC | #2
On Thu, Oct 11, 2018 at 6:28 PM Stephen Boyd <sboyd@kernel.org> wrote:
> Quoting Tero Kristo (2018-10-03 06:12:39)
> > Here are the late changes for TI clock driver for 4.20 merge window.
> > Sorry about the late pull request, but this was waiting for resolution
> > on one of the dependencies (patch "clk: ti: fix OF child-node
> > lookup..."). Thanks for setting up the immutable branch for it.
> >
> > Please especially note the core clock changes in this series for adding
> > support of clk save/restore mechanism (two patches from Russ Dill.) I
> > decided to go ahead by adding them to this pull as there has been no
> > comments on the patches and they have been pending on the lists already
> > for a while. They aren't touching anything existing either, so they
> > should be safe to apply also.
>
> Thanks for calling it out and pushing me to react. I have been avoiding
> the suspend/resume patches unsuccessfully and now after looking at them
> I see a few nitpicks that I can resolve after merging this PR. It's also
> a sort of one-off solution for TI where all clks need to run through
> save/restore in a depth-first tree order and just blast in
> enable/disable bits, so we'll need to improve on it in the future. But
> I'm fine to go with it for now and do _something_ instead of just sit
> around and do nothing.

For the record, drivers/clk/renesas/renesas-cpg-mssr.c uses a notifier chain
for save/restore, where individual clock type drivers can register with.

Gr{oetje,eeting}s,

                        Geert