summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
Commit message (Collapse)AuthorAgeFilesLines
* clk: Support CLK_IS_CRITICAL flagSascha Hauer2019-03-111-0/+3
| | | | | | | Support CLK_IS_CRITICAL flag. Simply do not disable the clock even when the enable count is zero. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: fix NULL deref without OF node in debug messageMatthias Schiffer2018-11-231-1/+1
| | | | | | | | | | | | of_clk_add_provider() may be called for devices added via add_generic_device(). There is no OF node in this case, leading to a crash when debug logs are enabled. This affects various i.MX CPUs, which add imx*-ccm clock devices using add_generic_device(). Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: support pinmux configuration in clock provider nodesNikita Yushchenko2018-05-141-3/+6
| | | | | | | | | | | | | | | | Some device trees use pinctrl-* settings inside device tree nodes for clock providers. Barebox does not threat clock providers (such as fixed-clock or gpio-gate-clock) as conventional devices, thus setting default pinctrl configuration in driver binding code does not happen for clock providers. This patch adds setting default pinctrl configuration to of_clk_init(), just before calling clock provider's probe routine. Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Make COMMON_CLK_OF_PROVIDER depend on OFTREEAndrey Smirnov2017-03-091-1/+1
| | | | | | | | | | | | | Make COMMON_CLK_OF_PROVIDER depend on OFTREE, this way checking for: defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER) can be simplified to just: defined(CONFIG_COMMON_CLK_OF_PROVIDER) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Port two helper functions from LinuxAndrey Smirnov2017-03-091-0/+39
| | | | | | | Port of_clk_get_parent_count() and of_clk_parent_fill() from Linux. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: implement CLK_OPS_PARENT_ENABLESascha Hauer2017-02-061-4/+27
| | | | | | | | Some clocks may only be modified when their parent clocks are enabled. The kernel has the CLK_OPS_PARENT_ENABLE flag for this purpose. Implement it for barebox aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Keep enable count consistent over reparentSascha Hauer2017-02-061-6/+15
| | | | | | | | When reparenting a clock we have to make sure the new parent is enabled when the clock was enabled on the old parent. Also we have to decrease the old parents use counter when the clock was enabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Port of_clk_set_defaults()Andrey Smirnov2017-01-111-0/+2
| | | | | | | | Port of_clk_set_defautls() from Linux kernel in order to support DT configurations that require it (e. g. Vybrid). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/vybrid'Sascha Hauer2016-11-141-7/+82
|\
| * clk: Port clock dependency resolution codeAndrey Smirnov2016-11-141-7/+82
| | | | | | | | | | | | | | | | | | | | Port the clock dependency resolution algorithm utilized by Linux kernel's version of of_clk_init(), to allow for SoCs whose DT clock configuration reqires such behaviour for correct initialization (Vybrid is one such example). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: add clock command completionSascha Hauer2016-11-081-0/+22
|/ | | | | | This adds tab completion for the clk_* commands. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rockchip'Sascha Hauer2015-03-091-0/+10
|\ | | | | | | | | Conflicts: arch/arm/Kconfig
| * CLK: Check and do not allow to register clock twiceAndrey Panov2015-03-051-0/+10
| | | | | | | | | | Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | clk: Treat NULL as dummy clocksSascha Hauer2015-03-051-0/+17
|/ | | | | | | | | NULL pointers should be treated as dummy clocks as done in the kernel. Using a not fully filled in clk * array for of_clk_add_provider may result in NULL clks. When these are passed into the clk framework we should not crash. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: move of_clk_get_parent_name() to common clk codeAntony Pavlov2014-04-291-0/+20
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix signedness mixups in printf format specifiersLucas Stach2014-04-231-1/+1
| | | | | | | | | This most likely doesn't fix any real bugs, but it's the right thing to do and reduces the noise level with static checkers. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Add parent round/set rate for mux and gateSascha Hauer2014-03-281-0/+20
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: implement clk_round_rateSascha Hauer2014-03-281-0/+10
| | | | | | | Instead of returning just the current rate implement clk_round_rate properly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add of_clk_init and CLK_OF_DECLARE macroSebastian Hesselbarth2013-11-111-0/+37
| | | | | | | | | | This add barebox versions of of_clk_init for parsing and registering clock providers from DT. Also, a macro CLK_OF_DECLARE is added, that allows to put init callbacks into its own section that can be linked in the binary. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: of: introduce of_clk_src_simple_getSascha Hauer2013-09-231-0/+7
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add clock lookup from devicetreeLucas Stach2013-07-021-0/+97
| | | | | | | Taken from the Linuxkernel with some small adjustments for barebox. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add prototype for clk_is_enabledSascha Hauer2013-06-201-1/+1
| | | | | | | | On MXS we need to poll the busy bit when changing a clock rate, but only when the parent clocks are enabled. This exposes the already present function clk_is_enabled which is suitable for this job. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: fix warning: no previous prototype for 'clk_is_enabled'Antony Pavlov2013-06-051-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: Add is_enabled callbackSascha Hauer2013-03-151-15/+46
| | | | | | | | | | | | | | | This allows us to better detect whether a clk is enabled or not. - If we can ask a clk, ask it. If it's enabled, go on and ask parents - If we can't ask it, but it can be enabled, depend on the enable_count. if it's positive, go on and ask parents - If we can't ask it and it cannot be enabled, assume it is enabled and ask parents. This makes the CLK_ALWAYS_ENABLED unnecessary, since the fixed clk now always returns 1 in its is_enabled callback. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: clk_dump: denote always enabled clocksAntony Pavlov2012-12-031-2/+6
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add always enabled clocksAntony Pavlov2012-12-031-0/+10
| | | | | | | | | | | | | Current barebox clk framework allow disable any clock and there is no means to prevent that. But there are the clocks that can't be disabled by software at all. This patch allow registration of a clock immune to clk_disable(). Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: check for invalid clocksSascha Hauer2012-11-291-0/+23
| | | | | | | | Checking for invalid clocks on function entry allows users to for example do a clk_set_rate(clk_lookup("myclk"), x) without checking for validity of the result of clk_lookup first. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: initial common clk supportSascha Hauer2012-10-041-0/+224
This adds barebox common clk support loosely based on the Kernel common clk support. differences are: - barebox does not need prepare/unprepare - no parent rate propagation for set_rate - struct clk is not really encapsulated from the drivers Along with the clk support we have support for some basic clk building blocks: - clk-fixed - clk-fixed-factor - clk-mux - clk-divider clk-fixed and clk-fixed-factor are completely generic, clk-mux and clk-divider are currently the way i.MX muxes/dividers are implemented. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>