29 Jan, 2018

3 commits

  • Linux uses the properties 'assigned-clocks', 'assigned-clock-parents'
    and 'assigned-clock-rates' to configure the clock subsystem for use
    with various peripheral nodes.

    This implements clk_set_defaults() and hooks it up with the general
    device probibin in drivers/core/device.c: when a new device is probed,
    clk_set_defaults() will be called for it and will process the
    properties mentioned above.

    Note that this functionality is designed to fail gracefully (i.e. if a
    clock-driver does not implement set_parent(), we simply accept this
    and ignore the error) as not to break existing board-support.

    Signed-off-by: Philipp Tomsich
    Tested-by: David Wu

    Series-changes: 2
    - Fixed David's email address.

    Series-version: 2

    Cover-letter:
    clk: support assigned-clock, assigned-clock-parents, assigned-clock-rates

    For various peripherals on Rockchip SoCs (e.g. for the Ethernet GMAC),
    the parent-clock needs to be set via the DTS. This adds the required
    plumbing and implements the GMAC case for the RK3399.
    END

    Philipp Tomsich
     
  • The logic in clk_get_by_index() may be useful for other properties
    than 'clocks': e.g. 'assigned-clocks' and 'assigned-clock-parents'
    follows the same model.

    This commit refactors clk_get_by_index() by introducing an internal
    function clk_get_by_indexed_prop() that allows to specify the name
    of the property to process. The original clk_get_by_index() call
    is simply directed through this helper function with the property
    name fixed to "clocks".

    Signed-off-by: Philipp Tomsich
    Tested-by: David Wu

    Series-changes: 2
    - Fixed David's email address.

    Philipp Tomsich
     
  • Clocks may support multiple parents: this change introduces an
    optional operation on the clk-uclass to set a clock's parent.

    Signed-off-by: Philipp Tomsich
    Tested-by: David Wu

    Series-changes: 2
    - Fixed David's email address.

    Philipp Tomsich
     

22 Jan, 2018

2 commits


15 Sep, 2017

2 commits

  • We want to support more than one phandle argument. It makes sense to use
    an array for this rather than discrete struct members. Adjust the code to
    support this. Rename the member to 'arg' instead of 'id'.

    Signed-off-by: Simon Glass
    Tested-by: Kever Yang

    Simon Glass
     
  • Rather than naming the phandle struct according to the number of cells it
    uses (e.g. struct phandle_2_cell) name it according to the number of
    arguments it has (e.g. struct phandle_1_arg). This is a more intuitive
    naming.

    Signed-off-by: Simon Glass
    Tested-by: Kever Yang

    Simon Glass
     

29 Jul, 2017

2 commits

  • Move clk_release_all() prototype and definition inside
    OF_CONTROL flag to avoid following compilation error for
    poplar platform:

    aarch64: + poplar
    +drivers/usb/host/built-in.o: In function `ehci_usb_remove':
    +drivers/usb/host/ehci-generic.c:159: undefined reference to `clk_release_all'
    +drivers/usb/host/built-in.o: In function `ehci_usb_probe':
    +drivers/usb/host/ehci-generic.c:133: undefined reference to `clk_release_all'
    +make[1]: *** [u-boot] Error 139
    +make: *** [sub-make] Error 2

    Introduced by 4e542c4 clk: add clk_release_all()

    Signed-off-by: Patrice Chotard

    Patrice Chotard
     
  • Add clk_release_all() method which Disable/Free an
    array of clocks that has been previously requested by
    clk_request/get_by_*()

    Signed-off-by: Patrice Chotard
    Reviewed-by: Simon Glass

    Patrice Chotard
     

01 Jun, 2017

2 commits


08 Feb, 2017

1 commit

  • At present devices use a simple integer offset to record the device tree
    node associated with the device. In preparation for supporting a live
    device tree, which uses a node pointer instead, refactor existing code to
    access this field through an inline function.

    Signed-off-by: Simon Glass

    Simon Glass
     

29 Oct, 2016

1 commit


14 Oct, 2016

1 commit

  • These have now landed upstream. The naming is different and in one case the
    function signature has changed. Update the code to match.

    This applies the following upstream commits by
    Thierry Reding :

    604e61e fdt: Add functions to retrieve strings
    8702bd1 fdt: Add a function to get the index of a string
    2218387 fdt: Add a function to count strings

    Signed-off-by: Simon Glass

    Simon Glass
     

22 Jul, 2016

1 commit

  • Simple version of clk_get_by_index() added by:
    "dm: clk: Add a simple version of clk_get_by_index()"
    (sha1: a4b10c088c4f6ef2e2bba33e8cfea369bcbbce44)
    is only working for #clock-cells= but not for
    any other values. Fixed clocks is using #clock-cells=
    which requires full implementation.

    Remove simplified versions of clk_get_by_index() and use full version.
    Also remove empty clk_get_by_name() which is failing when it is called
    which is useless.

    Signed-off-by: Michal Simek
    Acked-by: Stephen Warren

    Michal Simek
     

15 Jul, 2016

1 commit


20 Jun, 2016

1 commit

  • The following changes are made to the clock API:
    * The concept of "clocks" and "peripheral clocks" are unified; each clock
    provider now implements a single set of clocks. This provides a simpler
    conceptual interface to clients, and better aligns with device tree
    clock bindings.
    * Clocks are now identified with a single "struct clk", rather than
    requiring clients to store the clock provider device and clock identity
    values separately. For simple clock consumers, this isolates clients
    from internal details of the clock API.
    * clk.h is split so it only contains the client/consumer API, whereas
    clk-uclass.h contains the provider API. This aligns with the recently
    added reset and mailbox APIs.
    * clk_ops .of_xlate(), .request(), and .free() are added so providers
    can customize these operations if needed. This also aligns with the
    recently added reset and mailbox APIs.
    * clk_disable() is added.
    * All users of the current clock APIs are updated.
    * Sandbox clock tests are updated to exercise clock lookup via DT, and
    clock enable/disable.
    * rkclk_get_clk() is removed and replaced with standard APIs.

    Buildman shows no clock-related errors for any board for which buildman
    can download a toolchain.

    test/py passes for sandbox (which invokes the dm clk test amongst
    others).

    Signed-off-by: Stephen Warren
    Acked-by: Simon Glass

    Stephen Warren
     

22 Jan, 2016

2 commits


21 Jan, 2016

1 commit


22 Jul, 2015

1 commit

  • Clocks are an important feature of platforms and have become increasing
    complex with time. Most modern SoCs have multiple PLLs and dozens of clock
    dividers which distribute clocks to on-chip peripherals.

    Some SoC implementations have a clock API which is private to that SoC family,
    e.g. Tegra and Exynos. This is useful but it would be better to have a
    common API that can be understood and used throughout U-Boot.

    Add a simple clock API as a starting point. It supports querying and setting
    the rate of a clock. Each clock is a device. To reduce memory and processing
    overhead the concept of peripheral clocks is provided. These do not need to
    be explicit devices - it is possible to write a driver that can adjust the
    I2C clock (for example) without an explicit I2C clock device. This can
    dramatically reduce the number of devices (and associated overhead) in a
    complex SoC.

    Clocks are referenced by a number, and it is expected that SoCs will define
    that numbering themselves via an enum.

    Signed-off-by: Simon Glass

    Simon Glass