1. 17 8月, 2019 1 次提交
  2. 26 6月, 2019 4 次提交
  3. 18 6月, 2019 1 次提交
    • C
      clk: Fix debugfs clk_possible_parents for clks without parent string names · 2d156b78
      Chen-Yu Tsai 提交于
      Following the commit fc0c209c ("clk: Allow parents to be specified
      without string names"), the parent name string is not always populated.
      
      Instead, fetch the parents clk_core struct using the appropriate helper,
      and read its name directly. If that fails, go through the possible
      sources of parent names. The order in which they are used is different
      from how parents are looked up, with the global name having precedence
      over local fw_name and indices. This makes more sense as a) the
      parent_maps structure does not differentiate between legacy global names
      and fallback global names, and b) global names likely provide more
      information than local fw_names.
      
      Fixes: fc0c209c ("clk: Allow parents to be specified without string names")
      Signed-off-by: NChen-Yu Tsai <wens@csie.org>
      2d156b78
  4. 17 6月, 2019 1 次提交
  5. 24 5月, 2019 1 次提交
    • S
      clk: Unexport __clk_of_table · 30d5a945
      Stephen Boyd 提交于
      This symbol doesn't need to be exported to clk providers anymore.
      Originally, it was hidden inside clk.c, but then OMAP needed to get
      access to it in commit 819b4861 ("CLK: ti: add init support for
      clock IP blocks"), but eventually that code also changed in commit
      c08ee14c ("clk: ti: change clock init to use generic of_clk_init")
      and we were left with this exported. Move this back into clk.c so that
      it isn't exposed anymore.
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      30d5a945
  6. 04 5月, 2019 1 次提交
    • S
      clk: Cache core in clk_fetch_parent_index() without names · 1a079560
      Stephen Boyd 提交于
      If a clk has specified parents via clk_hw pointers it won't specify the
      globally unique names for the parents. Without the unique names, we
      can't fallback to comparing them against the name of the 'parent'
      pointer here. Therefore, do a pointer comparison against the clk_hw
      pointers too and cache the clk_core structure if they match. This fixes
      parent lookup code for clks that only specify clk_hw pointers and
      nothing else, like muxes that are purely inside a clk controller.
      
      Similarly, if the parent pointer isn't cached after trying to match
      clk_core or clk_hw pointers, lookup the pointer from DT or via clkdev
      lookups instead of relying purely on the globally unique clk name match.
      This should allow us to move away from having to specify global names
      for clk parents entirely.
      
      While we're in the area, add some comments so it's clearer what's going
      on. The if statements don't lend themselves to much clarity in their raw
      form.
      
      Fixes: fc0c209c ("clk: Allow parents to be specified without string names")
      Reported-by: NCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      1a079560
  7. 27 4月, 2019 1 次提交
    • S
      clk: Remove CLK_IS_BASIC clk flag · 90b6c5c7
      Stephen Boyd 提交于
      This flag was historically used to indicate that a clk is a "basic" type
      of clk like a mux, divider, gate, etc. This never turned out to be very
      useful though because it was hard to cleanly split "basic" clks from
      other clks in a system. This one flag was a way for type introspection
      and it just didn't scale. If anything, it was used by the TI clk driver
      to indicate that a clk_hw wasn't contained in the SoC specific clk
      structure. We can get rid of this define now that TI is finding those
      clks a different way.
      
      Cc: Tero Kristo <t-kristo@ti.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: <linux-mips@vger.kernel.org>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Kevin Hilman <khilman@baylibre.com>
      Cc: <linux-pwm@vger.kernel.org>
      Cc: <linux-amlogic@lists.infradead.org>
      Acked-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      90b6c5c7
  8. 20 4月, 2019 5 次提交
    • S
      clk: Allow parents to be specified via clkspec index · 601b6e93
      Stephen Boyd 提交于
      Some clk providers are simple DT nodes that only have a 'clocks'
      property without having an associated 'clock-names' property. In these
      cases, we want to let these clk providers point to their parent clks
      without having to dereference the 'clocks' property at probe time to
      figure out the parent's globally unique clk name. Let's add an 'index'
      property to the parent_data structure so that clk providers can indicate
      that their parent is a particular index in the 'clocks' DT property.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Tested-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      601b6e93
    • S
      clk: Look for parents with clkdev based clk_lookups · dde4eff4
      Stephen Boyd 提交于
      In addition to looking for DT based parents, support clkdev based
      clk_lookups. This should allow non-DT based clk drivers to participate
      in the parent lookup process.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Tested-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      dde4eff4
    • S
      clk: Allow parents to be specified without string names · fc0c209c
      Stephen Boyd 提交于
      The common clk framework is lacking in ability to describe the clk
      topology without specifying strings for every possible parent-child
      link. There are a few drawbacks to the current approach:
      
       1) String comparisons are used for everything, including describing
       topologies that are 'local' to a single clock controller.
      
       2) clk providers (e.g. i2c clk drivers) need to create globally unique
       clk names to avoid collisions in the clk namespace, leading to awkward
       name generation code in various clk drivers.
      
       3) DT bindings may not fully describe the clk topology and linkages
       between clk controllers because drivers can easily rely on globally unique
       strings to describe connections between clks.
      
      This leads to confusing DT bindings, complicated clk name generation
      code, and inefficient string comparisons during clk registration just so
      that the clk framework can detect the topology of the clk tree.
      Furthermore, some drivers call clk_get() and then __clk_get_name() to
      extract the globally unique clk name just so they can specify the parent
      of the clk they're registering. We have of_clk_parent_fill() but that
      mostly only works for single clks registered from a DT node, which isn't
      the norm. Let's simplify this all by introducing two new ways of
      specifying clk parents.
      
      The first method is an array of pointers to clk_hw structures
      corresponding to the parents at that index. This works for clks that are
      registered when we have access to all the clk_hw pointers for the
      parents.
      
      The second method is a mix of clk_hw pointers and strings of local and
      global parent clk names. If the .fw_name member of the map is set we'll
      look for that clk by performing a DT based lookup of the device the clk
      is registered with and the .name specified in the map. If that fails,
      we'll fallback to the .name member and perform a global clk name lookup
      like we've always done before.
      
      Using either one of these new methods is entirely optional. Existing
      drivers will continue to work, and they can migrate to this new approach
      as they see fit. Eventually, we'll want to get rid of the 'parent_names'
      array in struct clk_init_data and use one of these new methods instead.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Rob Herring <robh@kernel.org>
      Tested-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      fc0c209c
    • S
      clk: Add of_clk_hw_register() API for early clk drivers · 89a5ddcc
      Stephen Boyd 提交于
      In some circumstances drivers register clks early and don't have access
      to a struct device because the device model isn't initialized yet. Add
      an API to let drivers register clks associated with a struct device_node
      so that these drivers can participate in getting parent clks through DT.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Rob Herring <robh@kernel.org>
      Tested-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      89a5ddcc
    • S
      clk: Prepare for clk registration API that uses DT nodes · fceaa7d8
      Stephen Boyd 提交于
      Split out the body of the clk_register() function so it can be shared
      between the different types of registration APIs (DT, device).
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Rob Herring <robh@kernel.org>
      Tested-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      fceaa7d8
  9. 09 3月, 2019 1 次提交
  10. 02 3月, 2019 5 次提交
    • S
      clk: Move of_clk_*() APIs into clk.c from clkdev.c · cf13f289
      Stephen Boyd 提交于
      The API between clk.c and clkdev.c is purely getting the clk_hw
      structure (or the struct clk if it's not CCF) and then turning that
      struct clk_hw pointer into a struct clk pointer via clk_hw_create_clk().
      There's no need to complicate clkdev.c with these DT parsing details
      that are only relevant to the common clk framework. Move the DT parsing
      logic into the core framework and just expose the APIs to get a clk_hw
      pointer and convert it.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      cf13f289
    • S
      clk: Inform the core about consumer devices · efa85048
      Stephen Boyd 提交于
      We'd like to have a pointer to the device that's consuming a particular
      clk in the clk framework so we can link the consumer to the clk provider
      with a PM device link. Add a device argument to clk_hw_create_clk() for
      this so it can be used in subsequent patches to add and remove the link.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      efa85048
    • S
      clk: Introduce of_clk_get_hw_from_clkspec() · 4472287a
      Stephen Boyd 提交于
      We want to get struct clk_hw pointers from a DT clk specifier (i.e. a
      clocks property) so that we can find parent clks without searching for
      globally unique clk names. This should save time by avoiding the global
      string search for clks that are external to the clock controller
      providing the clk and let us move away from string comparisons in
      general.
      
      Introduce of_clk_get_hw_from_clkspec() which is largely the DT parsing
      part of finding clks implemented in clkdev.c and have that return a
      clk_hw pointer instead of converting that into a clk pointer. This lets
      us push up the clk pointer creation to the caller in clk_get() and
      avoids the need to push the dev_id and con_id throughout the DT parsing
      code.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      4472287a
    • M
      clk: core: clarify the check for runtime PM · 24478839
      Miquel Raynal 提交于
      Currently, the core->dev entry is populated only if runtime PM is
      enabled. Doing so prevents accessing the device structure in any
      case.
      
      Keep the same logic but instead of using the presence of core->dev as
      the only condition, also check the status of
      pm_runtime_enabled(). Then, we can set the core->dev pointer at any
      time as long as a device structure is available.
      
      This change will help supporting device links in the clock subsystem.
      Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      [sboyd@kernel.org: Change to a boolean flag]
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      24478839
    • S
      clk: Combine __clk_get() and __clk_create_clk() · 1df4046a
      Stephen Boyd 提交于
      The __clk_get() function is practically a private clk implementation
      detail now. No architecture defines it, and given that new code should
      be using the common clk framework there isn't a need for it to keep
      existing just to serve clkdev purposes. Let's fold it into the
      __clk_create_clk() function and make that a little more generic by
      renaming it to clk_hw_create_clk(). This will allow the framework to
      create a struct clk handle to a particular clk_hw pointer and link it up
      as a consumer wherever that's needed.
      
      Doing this also lets us get rid of the __clk_free_clk() API that had to
      be kept in sync with __clk_put(). Splitting that API up into the "link
      and unlink from consumer list" phase and "free the clk pointer" phase
      allows us to reuse that logic in a couple places, simplifying the code.
      
      Cc: Miquel Raynal <miquel.raynal@bootlin.com>
      Cc: Jerome Brunet <jbrunet@baylibre.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Jeffrey Hugo <jhugo@codeaurora.org>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      1df4046a
  11. 03 2月, 2019 1 次提交
  12. 02 2月, 2019 1 次提交
  13. 25 1月, 2019 3 次提交
    • S
      clk: Document __clk_mux_determine_rate() · 777c1a40
      Stephen Boyd 提交于
      It had some documentation, but not kerneldoc style so it wasn't getting
      picked up. Add some docs so scripts can pick this function out.
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      777c1a40
    • S
      clk: Document deprecated things · 9fe9b7ab
      Stephen Boyd 提交于
      We don't want driver authors to use the struct clk based registration
      and provider APIs. Instead, they should use the clk_hw based APIs. Add
      some notes in the kerneldoc to this effect.
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      9fe9b7ab
    • D
      clk: Remove global clk traversal on fetch parent index · ede77858
      Derek Basehore 提交于
      It's not required to traverse the entire clk tree when the parents array
      contains a NULL value. We already have the parent clk_core pointer, so
      we can just compare the parent->name and parent_names[i] pointers.
      
      This can be a substantial power improvement in cases where the parent
      clk isn't known and that clk is never registered, because a mux having
      an unregistered parent name may traverse the clk tree on every
      clk_set_rate() call in clk_mux_determine_rate_flags(). This can happen
      hundreds of times a second for CPU clks.
      
      This patch is the combination of reverting commit 470b5e2f ("clk:
      simplify clk_fetch_parent_index() function") and optimizing the
      resulting code to never call __clk_lookup() because we already have the
      clk_core pointer we're looking for. That optimization went unnoticed
      even after commit da0f0b2c ("clk: Correct lookup logic in
      clk_fetch_parent_index()") tried to optimize this path.
      Signed-off-by: NDerek Basehore <dbasehore@chromium.org>
      [sboyd@kernel.org: More description in commit text]
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      ede77858
  14. 10 1月, 2019 1 次提交
  15. 12 12月, 2018 1 次提交
  16. 06 12月, 2018 1 次提交
  17. 05 12月, 2018 1 次提交
  18. 12 10月, 2018 1 次提交
  19. 03 10月, 2018 2 次提交
  20. 26 7月, 2018 1 次提交
  21. 07 7月, 2018 1 次提交
  22. 20 6月, 2018 2 次提交
    • J
      clk: add duty cycle support · 9fba738a
      Jerome Brunet 提交于
      Add the possibility to apply and query the clock signal duty cycle ratio.
      
      This is useful when the duty cycle of the clock signal depends on some
      other parameters controlled by the clock framework.
      
      For example, the duty cycle of a divider may depends on the raw divider
      setting (ratio = N / div) , which is controlled by the CCF. In such case,
      going through the pwm framework to control the duty cycle ratio of this
      clock would be a burden.
      
      A clock provider is not required to implement the operation to set and get
      the duty cycle. If it does not implement .get_duty_cycle(), the ratio is
      assumed to be 50%.
      
      This change also adds a new flag, CLK_DUTY_CYCLE_PARENT. This flag should
      be used to indicate that a clock, such as gates and muxes, may inherit
      the duty cycle ratio of its parent clock. If a clock does not provide a
      get_duty_cycle() callback and has CLK_DUTY_CYCLE_PARENT, then the call
      will be directly forwarded to its parent clock, if any. For
      set_duty_cycle(), the clock should also have CLK_SET_RATE_PARENT for the
      call to be forwarded
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NMichael Turquette <mturquette@baylibre.com>
      Link: lkml.kernel.org/r/20180619144141.8506-1-jbrunet@baylibre.com
      9fba738a
    • J
      clk: fix CLK_SET_RATE_GATE with clock rate protection · 9461f7b3
      Jerome Brunet 提交于
      CLK_SET_RATE_GATE should prevent any operation which may result in a rate
      change or glitch while the clock is prepared/enabled.
      
      IOW, the following sequence is not allowed anymore with CLK_SET_RATE_GATE:
      * clk_get()
      * clk_prepare_enable()
      * clk_get_rate()
      * clk_set_rate()
      
      At the moment this is enforced on the leaf clock of the operation, not
      along the tree. This problematic because, if a PLL has the CLK_RATE_GATE,
      it won't be enforced if the clk_set_rate() is called on its child clocks.
      
      Using clock rate protection, we can now enforce CLK_SET_RATE_GATE along the
      clock tree
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Tested-by: NQuentin Schulz <quentin.schulz@free-electrons.com>
      Tested-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NMichael Turquette <mturquette@baylibre.com>
      Link: lkml.kernel.org/r/20180619134051.16726-3-jbrunet@baylibre.com
      9461f7b3
  23. 16 6月, 2018 1 次提交
  24. 02 6月, 2018 2 次提交