20 Apr, 2019

2 commits

  • 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
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Tested-by: Jeffrey Hugo
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     
  • We don't need to hold the 'clocks_mutex' here when we're creating a clk
    pointer from a clk_lookup structure. Instead, we just need to make sure
    that the lookup doesn't go away while we dereference the lookup pointer
    to extract the clk_hw pointer out of it. Let's move things around
    slightly so that we have a new function to get the clk_hw out of the
    lookup with the right locking and then chain the two together for what
    used to be __clk_get_sys().

    Cc: Miquel Raynal
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Tested-by: Jeffrey Hugo
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

19 Apr, 2019

1 commit

  • We recently introduced a change to support devm clk lookups. That change
    introduced a code-path that used clk_find() without holding the
    'clocks_mutex'. Unfortunately, clk_find() iterates over the 'clocks'
    list and so we need to prevent the list from being modified at the same
    time. Do this by holding the mutex and checking to make sure it's held
    while iterating the list.

    Note, we don't really care if the lookup is freed after we find it with
    clk_find() because we're just doing a pointer comparison, but if we did
    care we would need to keep holding the mutex while we dereference the
    clk_lookup pointer.

    Fixes: 3eee6c7d119c ("clkdev: add managed clkdev lookup registration")
    Cc: Miquel Raynal
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Cc: Matti Vaittinen
    Acked-by: Matti Vaittinen
    Tested-by: Jeffrey Hugo
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

09 Mar, 2019

2 commits

  • * 'clk-parent-rewrite' (early part):
    clk: Move of_clk_*() APIs into clk.c from clkdev.c
    clk: Inform the core about consumer devices
    clk: Introduce of_clk_get_hw_from_clkspec()
    clk: core: clarify the check for runtime PM
    clk: Combine __clk_get() and __clk_create_clk()

    Stephen Boyd
     
  • …-meson' and 'clk-renesas' into clk-next

    - Add a {devm_}clk_get_optional() API
    - Add devm_clk_hw_register_clkdev() API to manage clkdev lookups

    * clk-optional:
    clk: Add (devm_)clk_get_optional() functions
    clk: Add comment about __of_clk_get_by_name() error values

    * clk-devm-clkdev-register:
    clk: clk-st: avoid clkdev lookup leak at remove
    clk: clk-max77686: Clean clkdev lookup leak and use devm
    clkdev: add managed clkdev lookup registration

    * clk-allwinner:
    clk: sunxi-ng: sun8i-a23: Enable PLL-MIPI LDOs when ungating it

    * clk-meson: (22 commits)
    clk: meson: meson8b: fix the naming of the APB clocks
    dt-bindings: clock: meson8b: add APB clock definition
    clk: meson: Add G12A AO Clock + Reset Controller
    dt-bindings: clk: add G12A AO Clock and Reset Bindings
    clk: meson: factorise meson64 peripheral clock controller drivers
    clk: meson: g12a: add peripheral clock controller
    dt-bindings: clk: meson: add g12a periph clock controller bindings
    clk: meson: pll: update driver for the g12a
    clk: meson: rework and clean drivers dependencies
    clk: meson: axg-audio does not require syscon
    clk: meson: use CONFIG_ARCH_MESON to enter meson clk directory
    clk: export some clk_hw function symbols for module drivers
    clk: meson: ao-clkc: claim clock controller input clocks from DT
    clk: meson: axg: claim clock controller input clock from DT
    clk: meson: gxbb: claim clock controller input clock from DT
    clk: meson: meson8b: add the GPU clock tree
    clk: meson: meson8b: use a separate clock table for Meson8
    clk: meson: axg-ao: add 32k generation subtree
    clk: meson: gxbb-ao: replace cec-32k with the dual divider
    clk: meson: add dual divider clock driver
    ...

    * clk-renesas:
    clk: renesas: r8a774a1: Fix LAST_DT_CORE_CLK
    clk: renesas: r8a774c0: Fix LAST_DT_CORE_CLK
    clk: renesas: r8a774c0: Add TMU clock
    clk: renesas: r8a77980: Add RPC clocks
    clk: renesas: rcar-gen3: Add RPC clocks
    clk: renesas: rcar-gen3: Add spinlock
    clk: renesas: rcar-gen3: Factor out cpg_reg_modify()
    clk: renesas: r8a774c0: Correct parent clock of DU
    clk: renesas: r8a774a1: Add missing CANFD clock
    clk: renesas: r8a774c0: Add missing CANFD clock

    Stephen Boyd
     

02 Mar, 2019

4 commits

  • 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
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Signed-off-by: Stephen Boyd

    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
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Signed-off-by: Stephen Boyd

    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
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Signed-off-by: Stephen Boyd

    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
    Cc: Jerome Brunet
    Cc: Russell King
    Cc: Michael Turquette
    Cc: Jeffrey Hugo
    Cc: Chen-Yu Tsai
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

07 Feb, 2019

2 commits


13 Aug, 2018

1 commit

  • The way this function is implemented caused some confusion when
    converting the TI DaVinci platform to using the common clock framework.

    Current kernel supports booting DaVinci boards both in device tree as
    well as legacy, board-file mode. In the latter, we always end up
    calling clk_get_sys() as of_node is NULL and __of_clk_get_by_name()
    returns -ENOENT.

    It was not obvious at first glance how clk_get(dev, NULL) will work in
    board-file mode since we always call __of_clk_get_by_name(). Let's make
    it clearer by checking if of_node is NULL and skipping right to
    clk_get_sys().

    Cc: Sekhar Nori
    Cc: Kevin Hilman
    Cc: David Lechner
    Reviewed-by: David Lechner
    Reviewed-by: Sekhar Nori
    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Russell King

    Bartosz Golaszewski
     

11 Jul, 2018

1 commit


03 Jan, 2018

1 commit

  • Now that all the users of asm/clkdev.h have been replaced with
    the generic file we can get rid of the asm-generic file as well
    and implement that code directly where it's used.

    We only have one caller of __clkdev_alloc(), in clkdev.c so we
    can easily remove that and drop the include of asm/clkdev.h in
    linux/clkdev.h by putting the __clk_get/__clk_put inlines in
    their respective location.

    Cc: Russell King
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

22 Jul, 2017

1 commit

  • Now that we have a custom printf format specifier, convert users of
    full_name to use %pOF instead. This is preparation to remove storing
    of the full path string for each node.

    Signed-off-by: Rob Herring
    Cc: Michael Turquette
    Cc: Stephen Boyd
    Cc: Maxime Coquelin
    Cc: Alexandre Torgue
    Cc: Russell King
    Cc: Matthias Brugger
    Cc: Geert Uytterhoeven
    Cc: Maxime Ripard
    Cc: Chen-Yu Tsai
    Cc: "Emilio López"
    Cc: Peter De Schrijver
    Cc: Prashant Gaikwad
    Cc: Thierry Reding
    Cc: Jonathan Hunter
    Cc: Tero Kristo
    Cc: linux-clk@vger.kernel.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-mediatek@lists.infradead.org
    Cc: linux-renesas-soc@vger.kernel.org
    Cc: linux-tegra@vger.kernel.org
    Cc: linux-omap@vger.kernel.org
    Acked-by: Maxime Ripard
    Reviewed-by: Geert Uytterhoeven
    Acked-by: Geert Uytterhoeven
    Acked-by: James Liao
    Acked-by: Alexandre TORGUE
    Reviewed-by: Matthias Brugger
    Signed-off-by: Stephen Boyd

    Rob Herring
     

22 Nov, 2016

1 commit

  • Unlike clk_register_clkdev(), clk_hw_register_clkdev() doesn't check for
    passed error objects from a previous registration call. Hence the caller
    of clk_hw_register_*() has to check for errors before calling
    clk_hw_register_clkdev*().

    Make clk_hw_register_clkdev() more similar to clk_register_clkdev() by
    adding this error check, removing the burden from callers that do mass
    registration.

    Fixes: e4f1b49bda6d6aa2 ("clkdev: Add clk_hw based registration APIs")
    Fixes: 944b9a41e004534f ("clk: ls1x: Migrate to clk_hw based OF and registration APIs")
    Fixes: 44ce9a9ae977736f ("MIPS: TXx9: Convert to Common Clock Framework")
    Fixes: f48d947a162dfa9d ("clk: clps711x: Migrate to clk_hw based OF and registration APIs")
    Fixes: b4626a7f489238a5 ("CLK: Add Loongson1C clock support")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Russell King

    Geert Uytterhoeven
     

03 Aug, 2016

1 commit

  • There was only one use of __initdata_refok and __exit_refok

    __init_refok was used 46 times against 82 for __ref.

    Those definitions are obsolete since commit 312b1485fb50 ("Introduce new
    section reference annotations tags: __ref, __refdata, __refconst")

    This patch removes the following compatibility definitions and replaces
    them treewide.

    /* compatibility defines */
    #define __init_refok __ref
    #define __initdata_refok __refdata
    #define __exit_refok __ref

    I can also provide separate patches if necessary.
    (One patch per tree and check in 1 month or 2 to remove old definitions)

    [akpm@linux-foundation.org: coding-style fixes]
    Link: http://lkml.kernel.org/r/1466796271-3043-1-git-send-email-fabf@skynet.be
    Signed-off-by: Fabian Frederick
    Cc: Ingo Molnar
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

20 Apr, 2016

2 commits

  • 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 a struct clk_lookup. Luckily, clkdev already
    operates on struct clk_hw pointers, except for the registration
    facing APIs where it converts struct clk pointers into struct
    clk_hw pointers almost immediately.

    Let's add clk_hw based registration APIs so that we can skip the
    conversion step and provide a way for clk provider drivers to
    operate exclusively on clk_hw structs. This way we clearly
    split the API between consumers and providers.

    Cc: Russell King
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     
  • Now that we've converted the only caller over to another clkdev
    API, remove this one.

    Reviewed-by: Andy Shevchenko
    Cc: Russell King
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

17 Feb, 2016

1 commit

  • Many callers either use NULL or const strings for the third argument of
    clk_register_clkdev. For those that do not and use a non-const string,
    this is a risk for format strings being accidentally processed (for
    example in device names). As this interface is already used as if it
    weren't a format string (prints nothing when NULL), and there are zero
    users of the format strings, remove the format string interface to make
    sure format strings will not leak into the clkdev.

    $ git grep '\bclk_register_clkdev\b' | grep % | wc -l
    0

    Unfortunately, all the internals expect a va_list even though they treat
    a NULL format string as special. To deal with this, we must pass either
    (..., "%s", string) or (..., NULL) so that a the va_list will be created
    correctly (passing the name as an argument, not as a format string).

    Signed-off-by: Kees Cook
    Signed-off-by: Russell King

    Kees Cook
     

21 Oct, 2015

1 commit

  • clk_add_alias() was not correctly handling the case where alias_dev_name
    was NULL: rather than producing an entry with a NULL dev_id pointer,
    it would produce a device name of (null). Fix this.

    Cc:
    Fixes: 2568999835d7 ("clkdev: add clkdev_create() helper")
    Reported-by: Aaro Koskinen
    Tested-by: Aaro Koskinen
    Signed-off-by: Russell King

    Russell King
     

06 May, 2015

4 commits

  • Add a helper to allocate and add a clk_lookup structure. This can not
    only be used in several places in clkdev.c to simplify the code, but
    more importantly, can be used by callers of the clkdev code to simplify
    their clkdev creation and registration.

    Signed-off-by: Russell King

    Russell King
     
  • The connection id is only passed to clk_get() which is already const.
    Const-ify this argument too.

    Signed-off-by: Russell King

    Russell King
     
  • We want to be able to call clkdev_add_table() from non-init code, so we
    need to drop the __init marker from it.

    Signed-off-by: Russell King

    Russell King
     
  • clk_add_alias() calls clk_get() followed by clk_put() but in between
    those two calls it saves away the struct clk pointer to a clk_lookup
    structure. This leaves the 'clk' member of the clk_lookup pointing at
    freed memory on configurations where CONFIG_COMMON_CLK=y. This is a
    problem because clk_get_sys() will eventually try to dereference the
    freed pointer by calling __clk_get_hw() on it. Fix this by saving away
    the struct clk_hw pointer instead of the struct clk pointer so that when
    we try to create a per-user struct clk in clk_get_sys() we don't
    dereference a junk pointer.

    Signed-off-by: Russell King

    Russell King
     

13 Mar, 2015

1 commit

  • of_clk_get_by_clkspec() has the same function signature as
    of_clk_get_from_provider()

    struct clk *of_clk_get_by_clkspec(struct of_phandle_args
    *clkspec)
    struct clk *of_clk_get_from_provider(struct of_phandle_args
    *clkspec)

    except of_clk_get_by_clkspec() checks to make sure clkspec is not
    NULL. Let's remove of_clk_get_by_clkspec() and replace the
    callers of it (clkconf.c) with of_clk_get_from_provider().

    Cc: Sylwester Nawrocki
    Reviewed-by: Tomeu Vizoso
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

07 Feb, 2015

1 commit

  • of_clk_get_by_clkspec() returns a struct clk pointer but it
    doesn't create a new handle for the consumers when we're using
    the common clock framework. Instead it just returns whatever the
    clk provider hands out. When the consumers go to call clk_put()
    we get an Oops.

    Unable to handle kernel paging request at virtual address 00200200
    pgd = c0004000
    [00200200] *pgd=00000000
    Internal error: Oops: 805 [#1] PREEMPT SMP ARM
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.19.0-rc1-00104-ga251361a-dirty #992
    Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
    task: ee00b000 ti: ee088000 task.ti: ee088000
    PC is at __clk_put+0x24/0xd0
    LR is at clk_prepare_lock+0xc/0xec
    pc : [] lr : [] psr: 20000153
    sp : ee089de8 ip : 00000000 fp : 00000000
    r10: ee02f480 r9 : 00000001 r8 : 00000000
    r7 : ee031cc0 r6 : ee089e08 r5 : 00000000 r4 : ee02f480
    r3 : 00100100 r2 : 00200200 r1 : 0000091e r0 : 00000001
    Flags: nzCv IRQs on FIQs off Mode SVC_32 ISA ARM Segment kernel
    Control: 10c5387d Table: 4000404a DAC: 00000015
    Process swapper/0 (pid: 1, stack limit = 0xee088238)
    Stack: (0xee089de8 to 0xee08a000)
    9de0: ee7c8f14 c03f0ec8 ee089e08 00000000 c0718dc8 00000001
    9e00: 00000000 c04ee0f0 ee7e0844 00000001 00000181 c04edb58 ee2bd320 00000000
    9e20: 00000000 c011dc5c ee16a1e0 00000000 00000000 c0718dc8 ee16a1e0 ee2bd1e0
    9e40: c0641740 ee16a1e0 00000000 ee2bd320 c0718dc8 ee1d3e10 ee1d3e10 00000000
    9e60: c0769a88 00000000 c0718dc8 00000000 00000000 c02c3124 c02c310c ee1d3e10
    9e80: c07b4eec 00000000 c0769a88 c02c1d0c ee1d3e10 c0769a88 ee1d3e44 00000000
    9ea0: c07091dc c02c1eb8 00000000 c0769a88 c02c1e2c c02c0544 ee005478 ee1676c0
    9ec0: c0769a88 ee3a4e80 c0760ce8 c02c150c c0669b90 c0769a88 c0746cd8 c0769a88
    9ee0: c0746cd8 ee2bc4c0 c0778c00 c02c24e0 00000000 c0746cd8 c0746cd8 c07091f0
    9f00: 00000000 c0008944 c04f405c 00000025 ee00b000 60000153 c074ab00 00000000
    9f20: 00000000 c074ab90 60000153 00000000 ef7fca5d c050860c 000000b6 c0036b88
    9f40: c065ecc4 c06bc728 00000006 00000006 c074ab30 ef7fca40 c0739bdc 00000006
    9f60: c0718dbc c0778c00 000000b6 c0718dc8 c06ed598 c06edd64 00000006 00000006
    9f80: c06ed598 c003b438 00000000 c04e64f4 00000000 00000000 00000000 00000000
    9fa0: 00000000 c04e64fc 00000000 c000e838 00000000 00000000 00000000 00000000
    9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
    [] (__clk_put) from [] (of_clk_set_defaults+0xe0/0x2c0)
    [] (of_clk_set_defaults) from [] (platform_drv_probe+0x18/0xa4)
    [] (platform_drv_probe) from [] (driver_probe_device+0x10c/0x22c)
    [] (driver_probe_device) from [] (__driver_attach+0x8c/0x90)
    [] (__driver_attach) from [] (bus_for_each_dev+0x54/0x88)
    [] (bus_for_each_dev) from [] (bus_add_driver+0xd4/0x1d0)
    [] (bus_add_driver) from [] (driver_register+0x78/0xf4)
    [] (driver_register) from [] (fimc_md_init+0x14/0x30)
    [] (fimc_md_init) from [] (do_one_initcall+0x80/0x1d0)
    [] (do_one_initcall) from [] (kernel_init_freeable+0x108/0x1d4)
    [] (kernel_init_freeable) from [] (kernel_init+0x8/0xec)
    [] (kernel_init) from [] (ret_from_fork+0x14/0x3c)
    Code: ebfff4ae e5943014 e5942018 e3530000 (e5823000)

    Let's create a per-user handle here so that clk_put() can
    properly unlink it and free the handle. Now that we allocate a
    clk structure here we need to free it if __clk_get() fails so
    bury the __clk_get() call in __of_clk_get_from_provider(). We
    need to handle the same problem in clk_get_sys() so export
    __clk_free_clk() to clkdev.c and do the same thing, except let's
    use a union to make this code #ifdef free.

    This fixes the above crash, properly calls __clk_get() when
    of_clk_get_from_provider() is called, and cleans up the clk
    structure on the error path of clk_get_sys().

    Fixes: 035a61c314eb "clk: Make clk API return per-user struct clk instances"
    Reported-by: Sylwester Nawrocki
    Reported-by: Alban Browaeys
    Tested-by: Sylwester Nawrocki
    Tested-by: Alban Browaeys
    Reviewed-by: Tomeu Vizoso
    Signed-off-by: Stephen Boyd
    Signed-off-by: Michael Turquette

    Stephen Boyd
     

03 Feb, 2015

2 commits

  • So it can be used from modules such as clk-test.ko.

    Signed-off-by: Tomeu Vizoso
    Reviewed-by: Stephen Boyd
    Signed-off-by: Michael Turquette

    Tomeu Vizoso
     
  • Moves clock state to struct clk_core, but takes care to change as little API as
    possible.

    struct clk_hw still has a pointer to a struct clk, which is the
    implementation's per-user clk instance, for backwards compatibility.

    The struct clk that clk_get_parent() returns isn't owned by the caller, but by
    the clock implementation, so the former shouldn't call clk_put() on it.

    Because some boards in mach-omap2 still register clocks statically, their clock
    registration had to be updated to take into account that the clock information
    is stored in struct clk_core now.

    Signed-off-by: Tomeu Vizoso
    Reviewed-by: Stephen Boyd
    Tested-by: Tony Lindgren
    Signed-off-by: Michael Turquette
    [mturquette@linaro.org: adapted clk_has_parent to struct clk_core
    applied OMAP3+ DPLL fix from Tero & Tony]

    Tomeu Vizoso
     

27 Jun, 2014

1 commit

  • This error message can spam the logs if you have lots of probe
    deferals due to missing clocks. Just silence the error in this
    case because the driver should try again later.

    Signed-off-by: Stephen Boyd
    Acked-by: Russell King
    Signed-off-by: Mike Turquette

    Stephen Boyd
     

23 May, 2014

1 commit

  • This patch adds of_clk_get_by_clkspec() helper function, which does only
    a struct clk lookup from the clock providers. It is used in the subsequent
    patch where parsing of a clock from device tree and the lookup from
    providers needed to be split.

    Signed-off-by: Sylwester Nawrocki
    Signed-off-by: Mike Turquette

    Sylwester Nawrocki
     

25 Feb, 2014

1 commit

  • At probe time, a clock device may not be ready when some other device
    wants to use it.

    This patch lets the functions clk_get/devm_clk_get return a probe defer
    when the clock is defined in the DT but not yet available.

    Signed-off-by: Jean-Francois Moine
    Reviewed-by: Sylwester Nawrocki
    Tested-by: Sylwester Nawrocki
    Signed-off-by: Mike Turquette

    Jean-Francois Moine
     

05 Dec, 2013

1 commit

  • There is currently a race condition in the device tree part of clk_get()
    function, since the pointer returned from of_clk_get_by_name() may become
    invalid before __clk_get() call. E.g. due to the clock provider driver
    remove() callback being called in between of_clk_get_by_name() and
    __clk_get().

    Fix this by doing both the look up and __clk_get() operations with the
    clock providers list mutex held. This ensures that the clock pointer
    returned from __of_clk_get_from_provider() call and passed to __clk_get()
    is valid, as long as the clock supplier module first removes its clock
    provider instance and then does clk_unregister() on the corresponding
    clocks.

    Signed-off-by: Sylwester Nawrocki
    Signed-off-by: Kyungmin Park
    Reviewed-by: Mike Turquette
    Acked-by: Russell King

    Sylwester Nawrocki
     

16 Sep, 2012

1 commit

  • The managed clk functions are currently only available when the generic clk
    lookup framework is build. But the managed clk functions are merely wrappers
    around clk_get and clk_put and do not depend on any specifics of the generic
    lookup functions and there are still quite a few custom implementations of the
    clk API. So make the managed functions available whenever the clk API is
    implemented.

    The patch also removes the custom implementation of devm_clk_get for the
    coldfire platform.

    Signed-off-by: Lars-Peter Clausen
    Acked-by: Greg Ungerer
    Signed-off-by: Russell King

    Lars-Peter Clausen
     

20 Jul, 2012

2 commits

  • With commit 766e6a4ec602d0c107 (clk: add DT clock binding support),
    compiling with OF && !COMMON_CLK is broken.

    Reported-by: Alexandre Pereira da Silva
    Reported-by: Prashant Gaikwad
    Signed-off-by: Rob Herring
    Signed-off-by: Mike Turquette

    Rob Herring
     
  • The commit 766e6a4 (clk: add DT clock binding support) plugs device
    tree clk lookup of_clk_get_by_name into clk_get, and fall on non-DT
    lookup clk_get_sys if DT lookup fails.

    The return check on of_clk_get_by_name takes (clk != NULL) as a
    successful DT lookup. But it's not the case. For any system that
    does not define clk lookup in device tree, ERR_PTR(-ENOENT) will be
    returned, and consequently, all the client drivers calling clk_get
    in their probe functions will fail to probe with error code -ENOENT
    returned.

    Fix the issue by checking of_clk_get_by_name return with !IS_ERR(clk),
    and update of_clk_get and of_clk_get_by_name for !CONFIG_OF build
    correspondingly.

    Signed-off-by: Shawn Guo
    Acked-by: Rob Herring
    Tested-by: Marek Vasut
    Tested-by: Lauri Hintsala
    Signed-off-by: Mike Turquette

    Shawn Guo
     

12 Jul, 2012

1 commit

  • Based on work 1st by Ben Herrenschmidt and Jeremy Kerr, then by Grant
    Likely, this patch adds support to clk_get to allow drivers to retrieve
    clock data from the device tree.

    Platforms scan for clocks in DT with of_clk_init and a match table, and
    the register a provider through of_clk_add_provider. The provider's
    clk_src_get function will be called when a device references the
    provider's OF node for a clock reference.

    v6 (Rob Herring):
    - Return error values instead of NULL to match clock framework
    expectations

    v5 (Rob Herring):
    - Move from drivers/of into common clock subsystem
    - Squashed "dt/clock: add a simple provider get function" and
    "dt/clock: add function to get parent clock name"
    - Rebase to 3.4-rc1
    - Drop CONFIG_OF_CLOCK and just use CONFIG_OF
    - Add missing EXPORT_SYMBOL to various functions
    - s/clock-output-name/clock-output-names/
    - Define that fixed-clock binding is a single output

    v4 (Rob Herring):
    - Rework for common clk subsystem
    - Add of_clk_get_parent_name function

    v3: - Clarified documentation

    v2: - fixed errant ';' causing compile error
    - Editorial fixes from Shawn Guo
    - merged in adding lookup to clkdev
    - changed property names to match established convention. After
    working with the binding a bit it really made more sense to follow the
    lead of 'reg', 'gpios' and 'interrupts' by making the input simply
    'clocks' & 'clock-names' instead of 'clock-input-*', and to only use
    clock-output* for the producer nodes. (Sorry Shawn, this will mean
    you need to change some code, but it should be trivial)
    - Add ability to inherit clocks from parent nodes by using an empty
    'clock-ranges' property. Useful for busses. I could use some feedback
    on the new property name, 'clock-ranges' doesn't feel right to me.

    Signed-off-by: Grant Likely
    Signed-off-by: Rob Herring
    Reviewed-by: Shawn Guo
    Cc: Sascha Hauer
    Signed-off-by: Mike Turquette

    Grant Likely
     

02 May, 2012

1 commit


20 Apr, 2012

2 commits

  • clk_find must return as soon as it gets the correct clock. Currently it check
    all clocks until it found a lookup with both dev_id and con_id matching.

    If only one of them is passed, then we don't actually need to wait for both of
    them to match. We can quit as soon as the requested id (dev_id or con_id)
    matches.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Russell King

    viresh kumar
     
  • Allow clk API users to simplify their cleanup paths by providing a
    managed version of clk_get() and clk_put().

    Signed-off-by: Mark Brown
    Signed-off-by: Russell King

    Mark Brown