1. 27 8月, 2016 1 次提交
  2. 16 8月, 2016 1 次提交
    • S
      clk: Return errors from clk providers in __of_clk_get_from_provider() · f155d15b
      Stephen Boyd 提交于
      Before commit 0861e5b8 (clk: Add clk_hw OF clk providers,
      2016-02-05) __of_clk_get_from_provider() would return an error
      pointer of the provider's choosing if there was a provider
      registered and EPROBE_DEFER otherwise. After that commit, it
      would return EPROBE_DEFER regardless of whether or not the
      provider returned an error. This is odd and can lead to behavior
      where clk consumers keep probe deferring when they should be
      seeing some other error.
      
      Let's restore the previous behavior where we only return
      EPROBE_DEFER when there isn't a provider in our of_clk_providers
      list. Otherwise, return the error from the last provider we find
      that matches the node.
      Reported-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Fixes: 0861e5b8 ("clk: Add clk_hw OF clk providers")
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      f155d15b
  3. 13 8月, 2016 2 次提交
  4. 12 8月, 2016 1 次提交
    • M
      clk: migrate ref counts when orphans are reunited · 904e6ead
      Michael Turquette 提交于
      It's always nice to see families reunited, and this is equally true when
      talking about parent clocks and their children. However, if the orphan
      clk had a positive prepare_count or enable_count, then we would not
      migrate those counts up the parent chain correctly.
      
      This has manifested with the recent critical clocks feature, which often
      enables clocks very early, before their parents have been registered.
      
      Fixed by replacing the call to clk_core_reparent with calls to
      __clk_set_parent_{before,after}.
      
      Cc: James Liao <jamesjj.liao@mediatek.com>
      Cc: Erin Lo <erin.lo@mediatek.com>
      Signed-off-by: NMichael Turquette <mturquette@baylibre.com>
      [sboyd@codeaurora.org: Recalc accuracies and rates too]
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      904e6ead
  5. 02 7月, 2016 4 次提交
    • D
      clk: core: support clocks which requires parents enable (part 2) · fc8726a2
      Dong Aisheng 提交于
      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_ENABLE 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 patch part 2 fixes set clock rate and set parent while its parent
      is off. The most special case is for set_parent() operation which requires
      all parents including both old and new one to be enabled at the same time
      during the operation.
      
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Signed-off-by: NDong Aisheng <aisheng.dong@nxp.com>
      [sboyd@codeaurora.org: Move set_rate tracepoint after prepare_enable]
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      fc8726a2
    • D
      clk: core: support clocks which requires parents enable (part 1) · a4b3518d
      Dong Aisheng 提交于
      On Freescale i.MX7D platform, all clocks operations, including
      enable/disable, rate change and re-parent, requires its parent
      clock enable. Current clock core can not support it well.
      This patch introduce a new flag CLK_OPS_PARENT_ENABLE 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 patch part 1 fixes the possible disabling clocks while its parent
      is off during kernel booting phase in clk_disable_unused_subtree().
      
      Before the completion of kernel booting, clock tree is still not built
      completely, there may be a case that the child clock is on but its
      parent is off which could be caused by either HW initial reset state
      or bootloader initialization.
      
      Taking bootloader as an example, 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 child clock is still on in HW but its parent is already off.
      
      Later in clk_disable_unused(), this clock disable accessing while its
      parent off will cause system hang due to the limitation of HW which
      must require its parent on.
      
      This patch simply enables the parent clock first before disabling
      if flag CLK_OPS_PARENT_ENABLE is set in clk_disable_unused_subtree().
      This is a simple solution and only affects booting time.
      
      After kernel booting up the clock tree is already created, there will
      be no case that child is off but its parent is off.
      So no need do this checking for normal clk_disable() later.
      
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Signed-off-by: NDong Aisheng <aisheng.dong@nxp.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      a4b3518d
    • D
      clk: move clk_disable_unused after clk_core_disable_unprepare function · 7ec986ef
      Dong Aisheng 提交于
      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_ENABLE features.
      So move it after clk_core_disable_unprepare to avoid adding forward
      declared functions later.
      
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Signed-off-by: NDong Aisheng <aisheng.dong@nxp.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      7ec986ef
    • D
      clk: introduce clk_core_enable_lock and clk_core_disable_lock functions · a6adc30b
      Dong Aisheng 提交于
      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_enable 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: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Signed-off-by: NDong Aisheng <aisheng.dong@nxp.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      a6adc30b
  6. 21 6月, 2016 2 次提交
  7. 16 6月, 2016 2 次提交
    • P
      clk: Use _rcuidle suffix to allow clk_core_enable() to used from idle · f17a0dd1
      Paul E. McKenney 提交于
      This commit fixes the RCU use-from-idle bug corresponding the following
      splat:
      
      > [ INFO: suspicious RCU usage. ]
      > 4.6.0-rc5-next-20160426+ #1127 Not tainted
      > -------------------------------
      > include/trace/events/clk.h:45 suspicious rcu_dereference_check() usage!
      >
      > other info that might help us debug this:
      >
      >
      > RCU used illegally from idle CPU!
      > rcu_scheduler_active = 1, debug_locks = 0
      > RCU used illegally from extended quiescent state!
      > 2 locks held by swapper/0/0:
      >  #0:  (&oh->hwmod_key#30){......}, at: [<c0121afc>] omap_hwmod_enable+0x18/0x44
      >  #1:  (enable_lock){......}, at: [<c0630684>] clk_enable_lock+0x18/0x124
      >
      > stack backtrace:
      > CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc5-next-20160426+ #1127
      > Hardware name: Generic OMAP36xx (Flattened Device Tree)
      > [<c0110290>] (unwind_backtrace) from [<c010c3a8>] (show_stack+0x10/0x14)
      > [<c010c3a8>] (show_stack) from [<c047fd68>] (dump_stack+0xb0/0xe4)
      > [<c047fd68>] (dump_stack) from [<c06315c0>] (clk_core_enable+0x1e0/0x36c)
      > [<c06315c0>] (clk_core_enable) from [<c0632298>] (clk_enable+0x1c/0x38)
      > [<c0632298>] (clk_enable) from [<c01204e0>] (_enable_clocks+0x18/0x7c)
      > [<c01204e0>] (_enable_clocks) from [<c012137c>] (_enable+0x114/0x2ec)
      > [<c012137c>] (_enable) from [<c0121b08>] (omap_hwmod_enable+0x24/0x44)
      > [<c0121b08>] (omap_hwmod_enable) from [<c0122ad0>] (omap_device_enable+0x3c/0x90)
      > [<c0122ad0>] (omap_device_enable) from [<c0122b34>] (_od_runtime_resume+0x10/0x38)
      > [<c0122b34>] (_od_runtime_resume) from [<c052cc00>] (__rpm_callback+0x2c/0x60)
      > [<c052cc00>] (__rpm_callback) from [<c052cc54>] (rpm_callback+0x20/0x80)
      > [<c052cc54>] (rpm_callback) from [<c052df7c>] (rpm_resume+0x3d0/0x6f0)
      > [<c052df7c>] (rpm_resume) from [<c052e2e8>] (__pm_runtime_resume+0x4c/0x64)
      > [<c052e2e8>] (__pm_runtime_resume) from [<c04bf2c4>] (omap2_gpio_resume_after_idle+0x54/0x68)
      > [<c04bf2c4>] (omap2_gpio_resume_after_idle) from [<c01269dc>] (omap3_enter_idle_bm+0xfc/0x1ec)
      > [<c01269dc>] (omap3_enter_idle_bm) from [<c0601888>] (cpuidle_enter_state+0x80/0x3d4)
      > [<c0601888>] (cpuidle_enter_state) from [<c0183b08>] (cpu_startup_entry+0x198/0x3a0)
      > [<c0183b08>] (cpu_startup_entry) from [<c0b00c0c>] (start_kernel+0x354/0x3c8)
      > [<c0b00c0c>] (start_kernel) from [<8000807c>] (0x8000807c)
      Reported-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: <linux-omap@vger.kernel.org>
      Cc: <linux-arm-kernel@lists.infradead.org>
      Cc: <linux-clk@vger.kernel.org>
      f17a0dd1
    • P
      clk: Add _rcuidle tracepoints to allow clk_core_disable() use from idle · 2f87a6ea
      Paul E. McKenney 提交于
      This commit adds an _rcuidle suffix to a pair of trace events to
      prevent the following splat:
      
      > ===============================
      > [ INFO: suspicious RCU usage. ]
      > 4.6.0-rc5-next-20160426+ #1114 Not tainted
      > -------------------------------
      > include/trace/events/clk.h:59 suspicious rcu_dereference_check() usage!
      >
      > other info that might help us debug this:
      >
      >
      > RCU used illegally from idle CPU!
      > rcu_scheduler_active = 1, debug_locks = 0
      > RCU used illegally from extended quiescent state!
      > 2 locks held by swapper/0/0:
      >  #0:  (&oh->hwmod_key#30){......}, at: [<c0121b40>] omap_hwmod_idle+0x18/0x44
      >  #1:  (enable_lock){......}, at: [<c0630998>] clk_enable_lock+0x18/0x124
      >
      > stack backtrace:
      > CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc5-next-20160426+ #1114
      > Hardware name: Generic OMAP36xx (Flattened Device Tree)
      > [<c0110290>] (unwind_backtrace) from [<c010c3a8>] (show_stack+0x10/0x14)
      > [<c010c3a8>] (show_stack) from [<c047fd68>] (dump_stack+0xb0/0xe4)
      > [<c047fd68>] (dump_stack) from [<c0631618>] (clk_core_disable+0x17c/0x348)
      > [<c0631618>] (clk_core_disable) from [<c0632774>] (clk_disable+0x24/0x30)
      > [<c0632774>] (clk_disable) from [<c0120590>] (_disable_clocks+0x18/0x7c)
      > [<c0120590>] (_disable_clocks) from [<c0121680>] (_idle+0x12c/0x230)
      > [<c0121680>] (_idle) from [<c0121b4c>] (omap_hwmod_idle+0x24/0x44)
      > [<c0121b4c>] (omap_hwmod_idle) from [<c0122c24>] (omap_device_idle+0x3c/0x90)
      > [<c0122c24>] (omap_device_idle) from [<c052cc00>] (__rpm_callback+0x2c/0x60)
      > [<c052cc00>] (__rpm_callback) from [<c052cc54>] (rpm_callback+0x20/0x80)
      > [<c052cc54>] (rpm_callback) from [<c052d150>] (rpm_suspend+0x100/0x768)
      > [<c052d150>] (rpm_suspend) from [<c052ec58>] (__pm_runtime_suspend+0x64/0x84)
      > [<c052ec58>] (__pm_runtime_suspend) from [<c04bf25c>] (omap2_gpio_prepare_for_idle+0x5c/0x70)
      > [<c04bf25c>] (omap2_gpio_prepare_for_idle) from [<c0125568>] (omap_sram_idle+0x140/0x244)
      > [<c0125568>] (omap_sram_idle) from [<c01269dc>] (omap3_enter_idle_bm+0xfc/0x1ec)
      > [<c01269dc>] (omap3_enter_idle_bm) from [<c0601bdc>] (cpuidle_enter_state+0x80/0x3d4)
      > [<c0601bdc>] (cpuidle_enter_state) from [<c0183b08>] (cpu_startup_entry+0x198/0x3a0)
      > [<c0183b08>] (cpu_startup_entry) from [<c0b00c0c>] (start_kernel+0x354/0x3c8)
      > [<c0b00c0c>] (start_kernel) from [<8000807c>] (0x8000807c)
      Reported-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: <linux-omap@vger.kernel.org>
      Cc: <linux-arm-kernel@lists.infradead.org>
      Cc: <linux-clk@vger.kernel.org>
      2f87a6ea
  8. 20 5月, 2016 1 次提交
  9. 03 5月, 2016 1 次提交
  10. 20 4月, 2016 2 次提交
    • S
      clk: Add clk_hw OF clk providers · 0861e5b8
      Stephen Boyd 提交于
      Now that we have a clk registration API that doesn't return
      struct clks, we need to have some way to hand out struct clks via
      the clk_get() APIs that doesn't involve associating struct clk
      pointers with an OF node. Currently we ask the OF provider to
      give us a struct clk pointer for some clkspec, turn that struct
      clk into a struct clk_hw and then allocate a new struct clk to
      return to the caller.
      
      Let's add a clk_hw based OF provider hook that returns a struct
      clk_hw directly, so that we skip the intermediate step of
      converting from struct clk to struct clk_hw. Eventually when
      we've converted all OF clk providers to struct clk_hw based APIs
      we can remove the struct clk based ones.
      
      It should also be noted that we change the onecell provider to
      have a flex array instead of a pointer for the array of clk_hw
      pointers. This allows providers to allocate one structure of the
      correct length in one step instead of two.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      0861e5b8
    • S
      clk: Add {devm_}clk_hw_{register,unregister}() APIs · 4143804c
      Stephen Boyd 提交于
      We've largely split the clk consumer and provider APIs along
      struct clk and struct clk_hw, but clk_register() still returns a
      struct clk pointer for each struct clk_hw that's registered.
      Eventually we'd like to only allocate struct clks when there's a
      user, because struct clk is per-user now, so clk_register() needs
      to change.
      
      Let's add new APIs to register struct clk_hws, but this time
      we'll hide the struct clk from the caller by returning an int
      error code. Also add an unregistration API that takes the clk_hw
      structure that was passed to the registration API. This way
      provider drivers never have to deal with a struct clk pointer
      unless they're using the clk consumer APIs.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      4143804c
  11. 10 4月, 2016 3 次提交
  12. 27 2月, 2016 2 次提交
    • S
      clk: Make of_clk_get_parent_count() return unsigned ints · 929e7f3b
      Stephen Boyd 提交于
      Russell King recently pointed out a bug in the clk-gpio code
      where it fails to register the clk if of_clk_get_parent_count()
      returns an error because the "clocks" property isn't present in
      the DT node. If we're trying to count parents from DT we'd like
      to know the count, not if there is a "clocks" property or not.
      Furthermore, some drivers are assigning the return value to their
      clk_init_data::num_parents member which is unsigned, leading to
      potentially large numbers of parents when the property isn't
      present.
      
      Let's change the API to return an unsigned int instead of an int.
      All the callers just want to know the count anyway, and this
      avoids the bug that was in the clk-gpio driver.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      929e7f3b
    • G
      clk: Ignore disabled DT clock providers · 3e5dd6f6
      Geert Uytterhoeven 提交于
      of_clk_init() uses for_each_matching_node_and_match() to find clock
      providers, which returns all matching device nodes, whether they are
      enabled or not. Hence clock providers that are disabled explicitly in DT
      using e.g.
      
      	"status = "disabled";
      
      are still activated.
      
      Add a check to ignore device nodes that are not enabled, like
      of_irq_init() does.
      Reported-by: NRamesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      3e5dd6f6
  13. 26 2月, 2016 1 次提交
  14. 23 2月, 2016 2 次提交
    • S
      clk: Update some outdated comments · 706d5c73
      Stephen Boyd 提交于
      __clk_init() was renamed to __clk_core_init() but these comments
      weren't updated.
      
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      706d5c73
    • S
      Revert "clk: avoid circular clock topology" · fa459711
      Stephen Boyd 提交于
      This reverts commit 858d5881.
      
      Joachim reports that this commit breaks lpc18xx boot. This is
      because the hardware has circular clk topology where PLLs can
      feed into dividers and the same dividers can feed into the PLLs.
      The hardware is designed this way so that you can choose to put
      the divider before the PLL or after the PLL depending on what you
      configure to be the parent of the divider and what you configure
      to be the parent of the PLL.
      
      So let's drop this patch for now because we have hardware that
      actually has loops. A future patch could check for circular
      parents when we change parents and fail the switch, but that's
      probably best left to some debugging Kconfig option so that we
      don't suffer the sanity checking cost all the time.
      Reported-by: NJoachim Eastwood <manabian@gmail.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      fa459711
  15. 18 2月, 2016 1 次提交
  16. 10 2月, 2016 1 次提交
  17. 07 2月, 2016 1 次提交
    • S
      clk: Deprecate CLK_IS_ROOT · 47b0eeb3
      Stephen Boyd 提交于
      We don't use CLK_IS_ROOT but in a few places in the common clk
      framework core. Let's replace those checks with a check for the
      number of parents a clk has instead of the flag, freeing up one
      flag for something else. We don't remove the flag yet so that
      things keep building, but we'll remove it once all drivers have
      removed their flag usage.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      47b0eeb3
  18. 03 2月, 2016 8 次提交
  19. 02 2月, 2016 4 次提交