aboutsummaryrefslogtreecommitdiff
path: root/include/linux/clk-provider.h
AgeCommit message (Collapse)AuthorFilesLines
2015-02-02clk: Add rate constraints to clocksTomeu Vizoso1-3/+14
Adds a way for clock consumers to set maximum and minimum rates. This can be used for thermal drivers to set minimum rates, or by misc. drivers to set maximum rates to assure a minimum performance level. Changes the signature of the determine_rate callback by adding the parameters min_rate and max_rate. Signed-off-by: Tomeu Vizoso <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> [[email protected]: set req_rate in __clk_init] Signed-off-by: Michael Turquette <[email protected]> [[email protected]: min/max rate for sun6i_ahb1_clk_determine_rate migrated clk-private.h changes to clk.c]
2015-02-02clk: Make clk API return per-user struct clk instancesTomeu Vizoso1-5/+7
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 <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Tested-by: Tony Lindgren <[email protected]> Signed-off-by: Michael Turquette <[email protected]> [[email protected]: adapted clk_has_parent to struct clk_core applied OMAP3+ DPLL fix from Tero & Tony]
2015-01-27clk: divider: Make generic for usage elsewhereStephen Boyd1-0/+11
Some devices don't use mmio to interact with dividers. Split out the logic from the register read/write parts so that we can reuse the division logic elsewhere. Signed-off-by: Stephen Boyd <[email protected]> Tested-by: Kenneth Westfield <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2015-01-27clk: Add __clk_mux_determine_rate_closestStephen Boyd1-1/+7
Some clock drivers want to find the closest rate on the input of a mux instead of a rate that's less than or equal to the desired rate. Add a generic mux function to support this. Signed-off-by: Stephen Boyd <[email protected]> Tested-by: Kenneth Westfield <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2015-01-17clk: Add clk_unregister_{divider, gate, mux} to close memory leakKrzysztof Kozlowski1-0/+4
The common clk_register_{divider,gate,mux} functions allocated memory for internal data which wasn't freed anywhere. Drivers using these helpers could only unregister clocks but the memory would still leak. Add corresponding unregister functions which will release all resources. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2014-12-03clk: Change clk_ops->determine_rate to return a clk_hw as the best parentTomeu Vizoso1-2/+2
This is in preparation for clock providers to not have to deal with struct clk. Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2014-12-03clk: change clk_debugfs_add_file to take a struct clk_hwTomeu Vizoso1-1/+1
Instead of struct clk, as this should be only used by providers. Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2014-12-03clk: Don't expose __clk_get_accuracyTomeu Vizoso1-1/+0
As it's only used internally, in drivers/clk/clk.c. Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2014-12-03clk: Remove unused function __clk_get_prepare_countTomeu Vizoso1-1/+0
Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2014-11-17clk-divider: Fix READ_ONLY when divider > 1James Hogan1-1/+0
Commit 79c6ab509558 (clk: divider: add CLK_DIVIDER_READ_ONLY flag) in v3.16 introduced the CLK_DIVIDER_READ_ONLY flag which caused the recalc_rate() and round_rate() clock callbacks to be omitted. However using this flag has the unfortunate side effect of causing the clock recalculation code when a clock rate change is attempted to always treat it as a pass-through clock, i.e. with a fixed divide of 1, which may not be the case. Child clock rates are then recalculated using the wrong parent rate. Therefore instead of dropping the recalc_rate() and round_rate() callbacks, alter clk_divider_bestdiv() to always report the current divider as the best divider so that it is never altered. For me the read only clock was the system clock, which divided the PLL rate by 2, from which both the UART and the SPI clocks were divided. Initial setting of the UART rate set it correctly, but when the SPI clock was set, the other child clocks were miscalculated. The UART clock was recalculated using the PLL rate as the parent rate, resulting in a UART new_rate of double what it should be, and a UART which spewed forth garbage when the rate changes were propagated. Signed-off-by: James Hogan <[email protected]> Cc: Thomas Abraham <[email protected]> Cc: Tomasz Figa <[email protected]> Cc: Max Schwarz <[email protected]> Cc: <[email protected]> # v3.16+ Acked-by: Haojian Zhuang <[email protected]> Signed-off-by: Michael Turquette <[email protected]>
2014-09-27Merge tag 'sunxi-clocks-for-3.18' of ↵Mike Turquette1-0/+11
git://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into clk-next Allwinner Clocks Additions for 3.18 The most important part of this serie is the addition of the phase API to handle the MMC clocks in the Allwinner SoCs. Apart from that, the A23 gained a new mbus driver, and there's a fix for a incorrect divider table on the APB0 clock.
2014-09-27clk: Add a function to retrieve phaseMaxime Ripard1-0/+5
The current phase API doesn't look into the actual hardware to get the phase value, but will rather get it from a variable only set by the set_phase function. This will cause issue when the client driver will never call the set_phase function, where we can end up having a reported phase that will not match what the hardware has been programmed to by the bootloader or what phase is programmed out of reset. Add a new get_phase function for the drivers to implement so that we can get this value. Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Acked-by: Hans de Goede <[email protected]>
2014-09-27clk: Include of.h in clock-provider.hMaxime Ripard1-0/+1
CLK_OF_DECLARE relies on OF_DECLARE_1 that is defined in of.h. Fixes build errors when one use CLK_OF_DECLARE but doesn't include of.h Signed-off-by: Maxime Ripard <[email protected]> Acked-by: Hans de Goede <[email protected]>
2014-09-27clk: introduce clk_set_phase function & callbackMike Turquette1-0/+5
A common operation for a clock signal generator is to shift the phase of that signal. This patch introduces a new function to the clk.h API to dynamically adjust the phase of a clock signal. Additionally this patch introduces support for the new function in the common clock framework via the .set_phase call back in struct clk_ops. Signed-off-by: Mike Turquette <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Acked-by: Hans de Goede <[email protected]>
2014-09-26clk: add gpio gated clockJyri Sarha1-0/+22
The added gpio-gate-clock is a basic clock that can be enabled and disabled trough a gpio output. The DT binding document for the clock is also added. For EPROBE_DEFER handling the registering of the clock has to be delayed until of_clk_get() call time. Signed-off-by: Jyri Sarha <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-07-02clk: define and export clk_debugs_add_filePeter De Schrijver1-0/+5
Define and export a new function clk_debugs_add_file which adds a file to a existing clock's debugfs directory. This can be used by clock providers to add debugfs entries which are not related to a specific clock type. Examples include the ability to measure the rate of a clock. It can also be used by modules to create new debugfs entries. This is useful if you want to expose features for testing which can potentially cause system instability such as allowing to change a clock's rate from userspace. Signed-off-by: Peter De Schrijver <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-06-07Merge tag 'clk-for-linus-3.16' of ↵Linus Torvalds1-57/+70
git://git.linaro.org/people/mike.turquette/linux into next Pull clock framework updates from Mike Turquette: "The clock framework changes for 3.16 are pretty typical: mostly clock driver additions and fixes. There are additions to the clock core code for some of the basic types (e.g. the common divider type has some fixes and featured added to it). One minor annoyance is a last-minute dependency that wasn't handled quite right. Commit ba0fae3b06a6 ("clk: berlin: add core clock driver for BG2/BG2CD") in this pull request depends on include/dt-bindings/clock/berlin2.h, which is already in your tree via the arm-soc pull request. Building for the berlin platform will break when the clk tree is built on it's own, but merged into your master branch everything should be fine" * tag 'clk-for-linus-3.16' of git://git.linaro.org/people/mike.turquette/linux: (75 commits) mmc: sunxi: Add driver for SD/MMC hosts found on Allwinner sunxi SoCs clk: export __clk_round_rate for providers clk: versatile: free icst on error return clk: qcom: Return error pointers for unimplemented clocks clk: qcom: Support msm8974pro global clock control hardware clk: qcom: Properly support display clocks on msm8974 clk: qcom: Support display RCG clocks clk: qcom: Return highest rate when round_rate() exceeds plan clk: qcom: Fix mmcc-8974's PLL configurations clk: qcom: Fix clk_rcg2_is_enabled() check clk: berlin: add core clock driver for BG2Q clk: berlin: add core clock driver for BG2/BG2CD clk: berlin: add driver for BG2x complex divider cells clk: berlin: add driver for BG2x simple PLLs clk: berlin: add driver for BG2x audio/video PLL clk: st: Terminate of match table clk/exynos4: Fix compilation warning ARM: shmobile: r8a7779: Add clock index macros for DT sources clk: divider: Fix overflow in clk_divider_bestdiv clk: u300: Terminate of match table ...
2014-06-04Merge tag 'devicetree-for-3.16' of ↵Linus Torvalds1-4/+1
git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux into next Pull DeviceTree updates from Rob Herring: - Another round of clean-up of FDT related code in architecture code. This removes knowledge of internal FDT details from most architectures except powerpc. - Conversion of kernel's custom FDT parsing code to use libfdt. - DT based initialization for generic serial earlycon. The introduction of generic serial earlycon support went in through the tty tree. - Improve the platform device naming for DT probed devices to ensure unique naming and use parent names instead of a global index. - Fix a race condition in of_update_property. - Unify the various linker section OF match tables and fix several function prototype errors. - Update platform_get_irq_byname to work in deferred probe cases. - 2 binding doc updates * tag 'devicetree-for-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (58 commits) of: handle NULL node in next_child iterators of/irq: provide more wrappers for !CONFIG_OF devicetree: bindings: Document micrel vendor prefix dt: bindings: dwc2: fix required value for the phy-names property of_pci_irq: kill useless variable in of_irq_parse_pci() of/irq: do irq resolution in platform_get_irq_byname() of: Add a testcase for of_find_node_by_path() of: Make of_find_node_by_path() handle /aliases of: Create unlocked version of for_each_child_of_node() lib: add glibc style strchrnul() variant of: Handle memory@0 node on PPC32 only pci/of: Remove dead code of: fix race between search and remove in of_update_property() of: Use NULL for pointers of: Stop naming platform_device using dcr address of: Ensure unique names without sacrificing determinism tty/serial: pl011: add DT based earlycon support of/fdt: add FDT serial scanning for earlycon of/fdt: add FDT address translation support serial: earlycon: add DT support ...
2014-05-23clk: divider: add CLK_DIVIDER_READ_ONLY flagHeiko Stuebner1-0/+4
From: Heiko Stuebner <[email protected]> Similar to muxes which already have a read-only flag there sometimes exist dividers which should not be changed by the clock framework but whose value still should be readable. Therefore add a READ_ONLY flag similar to the mux-one to clk-divider Signed-off-by: Heiko Stuebner <[email protected]> [changed flag bit to BIT(5) as suggested by Tomasz Figa] Signed-off-by: Thomas Abraham <[email protected]> Acked-by: Tomasz Figa <[email protected]> Acked-by: Max Schwarz <[email protected]> Tested-by: Max Schwarz <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-05-20of: consolidate linker section OF match table declarationsRob Herring1-4/+1
We now have several OF match tables using linker sections that are nearly the same definition. The only variation is the callback function prototype. Create a common define for creating linker section OF match table entries which each table declaration can use. Acked-by: Grant Likely <[email protected]> Signed-off-by: Rob Herring <[email protected]>
2014-05-20clk: new basic clk type for fractional dividerHeikki Krogerus1-0/+31
Fractional divider clocks are fairly common. This adds basic type for them. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Mike Turquette <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2014-05-12clk: Improve clk_ops documentationGeert Uytterhoeven1-19/+25
General: - Add parameter names to .round_rate() and .set_rate(). Documentation/clk.txt: - Add missing parameter for .set_rate(), - Add missing .debug_init(). include/linux/clk-provider.h: - Add parent rate documentation for .round_rate(), - Reorder documentation to match implementation order, - Add missing documentation for .init(). Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-05-12clk: Fixup spacing in commentsGeert Uytterhoeven1-44/+44
- Remove spaces in front of TABs, - Correct indentation for some CLK_* flag descriptions. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-04-30clk: divider: Add round to closest dividerMaxime COQUELIN1-0/+3
In some cases, we want to be able to round the divider to the closest one, instead than rounding up. This patch adds a new CLK_DIVIDER_ROUND_CLOSEST flag to specify the divider has to round to closest div, keeping rounding up as de default behaviour. Signed-off-by: Maxime Coquelin <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-03-24clk: support hardware-specific debugfs entriesAlex Elder1-0/+8
Add a new clk_ops->debug_init method to allow a clock hardware driver to populate the clock's debugfs directory with entries beyond those common for every clock. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-01-30Merge branch 'next' of ↵Linus Torvalds1-0/+16
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc Pull more powerpc bits from Ben Herrenschmidt: "Here are a few more powerpc bits for this merge window. The bulk is made of two pull requests from Scott and Anatolij that I had missed previously (they arrived while I was away). Since both their branches are in -next independently, and the content has been around for a little while, they can still go in. The rest is mostly bug and regression fixes, a small series of cleanups to our pseries cpuidle code (including moving it to the right place), and one new cpuidle bakend for the powernv platform. I also wired up the new sched_attr syscalls" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (37 commits) powerpc: Wire up sched_setattr and sched_getattr syscalls powerpc/hugetlb: Replace __get_cpu_var with get_cpu_var powerpc: Make sure "cache" directory is removed when offlining cpu powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed address space powerpc/powernv/cpuidle: Back-end cpuidle driver for powernv platform. powerpc/pseries/cpuidle: smt-snooze-delay cleanup. powerpc/pseries/cpuidle: Remove MAX_IDLE_STATE macro. powerpc/pseries/cpuidle: Make cpuidle-pseries backend driver a non-module. powerpc/pseries/cpuidle: Use cpuidle_register() for initialisation. powerpc/pseries/cpuidle: Move processor_idle.c to drivers/cpuidle. powerpc: Fix 32-bit frames for signals delivered when transactional powerpc/iommu: Fix initialisation of DART iommu table powerpc/numa: Fix decimal permissions powerpc/mm: Fix compile error of pgtable-ppc64.h powerpc: Fix hw breakpoints on !HAVE_HW_BREAKPOINT configurations clk: corenet: Adds the clock binding powerpc/booke64: Guard e6500 tlb handler with CONFIG_PPC_FSL_BOOK3E powerpc/512x: dts: add MPC5125 clock specs powerpc/512x: clk: support MPC5121/5123/5125 SoC variants powerpc/512x: clk: enforce even SDHC divider values ...
2014-01-29Merge remote-tracking branch 'agust/next' into nextBenjamin Herrenschmidt1-0/+16
<< Switch mpc512x to the common clock framework and adapt mpc512x drivers to use the new clock driver. Old PPC_CLOCK code is removed entirely since there are no users any more. >>
2014-01-17CLK: ti: add init support for clock IP blocksTero Kristo1-0/+2
ti_dt_clk_init_provider() can now be used to initialize the contents of a single clock IP block. This parses all the clocks under the IP block and calls the corresponding init function for them. This patch also introduces a helper function for the TI clock drivers to get register info from DT and append the master IP info to this. Signed-off-by: Tero Kristo <[email protected]> Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-01-16clk: Add set_rate_and_parent() opStephen Boyd1-0/+15
Some of Qualcomm's clocks can change their parent and rate at the same time with a single register write. Add support for this hardware to the common clock framework by adding a new set_rate_and_parent() op. When the clock framework determines that both the parent and the rate are going to change during clk_set_rate() it will call the .set_rate_and_parent() op if available and fall back to calling .set_parent() followed by .set_rate() otherwise. Reviewed-by: James Hogan <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2014-01-12clk: mpc512x: introduce COMMON_CLK for MPC512x (disabled)Gerhard Sittig1-0/+16
this change implements a clock driver for the MPC512x PowerPC platform which follows the COMMON_CLK approach and uses common clock drivers shared with other platforms this driver implements the publicly announced set of clocks (those listed in the dt-bindings header file), as well as generates additional 'struct clk' items where the SoC hardware cannot easily get mapped to the common primitives (shared code) of the clock API, or requires "intermediate clock nodes" to represent clocks that have both gates and dividers the previous PPC_CLOCK implementation is kept in place and remains active for the moment, the newly introduced CCF clock driver will receive additional support for backwards compatibility in a subsequent patch before it gets enabled and will replace the PPC_CLOCK approach some of the clock items get pre-enabled in the clock driver to not have them automatically disabled by the underlying clock subsystem because of their being unused -- this approach is desirable because - some of the clocks are useful to have for diagnostics and information despite their not getting claimed by any drivers (CPU, internal and external RAM, internal busses, boot media) - some of the clocks aren't claimed by their peripheral drivers yet, either because of missing driver support or because device tree specs aren't available yet (but the workarounds will get removed as the drivers get adjusted and the device tree provides the clock specs) clkdev registration provides "alias names" for few clock items - to not break those peripheral drivers which encode their component index into the name that is used for clock lookup (UART, SPI, USB) - to not break those drivers which use names for the clock lookup which were encoded in the previous PPC_CLOCK implementation (NFC, VIU, CAN) this workaround will get removed as these drivers get adjusted after device tree based clock lookup has become available the COMMON_CLK implementation copes with device trees which lack an oscillator node (backwards compat), the REF clock is then derived from the IPS bus frequency and multiplier values fetched from hardware Cc: Mike Turquette <[email protected]> Cc: Anatolij Gustschin <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Gerhard Sittig <[email protected]> Signed-off-by: Anatolij Gustschin <[email protected]>
2013-12-22clk: add accuracy support for fixed clockBoris BREZILLON1-0/+4
This patch adds support for accuracy retrieval on fixed clocks. It also adds a new dt property called 'clock-accuracy' to define the clock accuracy. This can be usefull for oscillator (RC, crystal, ...) definitions which are always given an accuracy characteristic. Signed-off-by: Boris BREZILLON <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-12-22clk: add clk accuracy retrieval supportBoris BREZILLON1-0/+11
The clock accuracy is expressed in ppb (parts per billion) and represents the possible clock drift. Say you have a clock (e.g. an oscillator) which provides a fixed clock of 20MHz with an accuracy of +- 20Hz. This accuracy expressed in ppb is 20Hz/20MHz = 1000 ppb (or 1 ppm). Clock users may need the clock accuracy information in order to choose the best clock (the one with the best accuracy) across several available clocks. This patch adds clk accuracy retrieval support for common clk framework by means of a new function called clk_get_accuracy. This function returns the given clock accuracy expressed in ppb. In order to get the clock accuracy, this implementation adds one callback called recalc_accuracy to the clk_ops structure. This callback is given the parent clock accuracy (if the clock is not a root clock) and should recalculate the given clock accuracy. This callback is optional and may be implemented if the clock is not a perfect clock (accuracy != 0 ppb). Signed-off-by: Boris BREZILLON <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-10-07clk: of: helper for determining number of parent clocksMike Turquette1-0/+1
Walks the "clocks" array of parent clock phandles and returns the number. Signed-off-by: Mike Turquette <[email protected]>
2013-08-27clk: wrap I/O access for improved portabilityGerhard Sittig1-0/+17
the common clock drivers were motivated/initiated by ARM development and apparently assume little endian peripherals wrap register/peripherals access in the common code (div, gate, mux) in preparation of adding COMMON_CLK support for other platforms Signed-off-by: Gerhard Sittig <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-08-19clk: clk-mux: implement remuxing on set_rateJames Hogan1-0/+3
Implement clk-mux remuxing if the CLK_SET_RATE_NO_REPARENT flag isn't set. This implements determine_rate for clk-mux to propagate to each parent and to choose the best one (like clk-divider this chooses the parent which provides the fastest rate <= the requested rate). The determine_rate op is implemented as a core helper function so that it can be easily used by more complex clocks which incorporate muxes. Signed-off-by: James Hogan <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Mike Turquette <[email protected]> Cc: [email protected] Signed-off-by: Mike Turquette <[email protected]>
2013-08-19clk: add CLK_SET_RATE_NO_REPARENT flagJames Hogan1-0/+1
Add a CLK_SET_RATE_NO_REPARENT clock flag, which will prevent muxes being reparented during clk_set_rate. To avoid breaking existing platforms, all callers of clk_register_mux() are adjusted to pass the new flag. Platform maintainers are encouraged to remove the flag if they wish to allow mux reparenting on set_rate. Signed-off-by: James Hogan <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Mike Turquette <[email protected]> Cc: Russell King <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Stephen Warren <[email protected]> Cc: Viresh Kumar <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Haojian Zhuang <[email protected]> Cc: Chao Xie <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: "Emilio López" <[email protected]> Cc: Gregory CLEMENT <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Prashant Gaikwad <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Peter De Schrijver <[email protected]> Cc: Pawel Moll <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Andrew Chew <[email protected]> Cc: Doug Anderson <[email protected]> Cc: Heiko Stuebner <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Sylwester Nawrocki <[email protected]> Cc: Thomas Abraham <[email protected]> Cc: Tomasz Figa <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Tested-by: Haojian Zhuang <[email protected]> Acked-by: Stephen Warren <[email protected]> [tegra] Acked-by: Maxime Ripard <[email protected]> [sunxi] Acked-by: Sören Brinkmann <[email protected]> [Zynq] Signed-off-by: Mike Turquette <[email protected]>
2013-08-19clk: add support for clock reparent on set_rateJames Hogan1-0/+7
Add core support to allow clock implementations to select the best parent clock when rounding a rate, e.g. the one which can provide the closest clock rate to that requested. This is by way of adding a new clock op, determine_rate(), which is like round_rate() but has an extra parameter to allow the clock implementation to optionally select a different parent clock. The core then takes care of reparenting the clock when setting the rate. The parent change takes place with the help of some new private data members. struct clk::new_parent specifies a clock's new parent (NULL indicates no change), and struct clk::new_child specifies a clock's new child (whose new_parent member points back to it). The purpose of these are to allow correct walking of the future tree for notifications prior to actually reparenting any clocks, specifically to skip child clocks who are being reparented to another clock (they will be notified via the new parent), and to include any new child clock. These pointers are set by clk_calc_subtree(), and the new_child pointer gets cleared when a child is actually reparented to avoid duplicate POST_RATE_CHANGE notifications. Each place where round_rate() is called, determine_rate() is checked first and called in preference. This restructures a few of the call sites to simplify the logic into if/else blocks. Signed-off-by: James Hogan <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Mike Turquette <[email protected]> Cc: [email protected] Signed-off-by: Mike Turquette <[email protected]>
2013-08-19clk: abstract parent cacheJames Hogan1-0/+1
Abstract access to the clock parent cache by defining clk_get_parent_by_index(clk, index). This allows access to parent clocks from clock drivers. Signed-off-by: James Hogan <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Mike Turquette <[email protected]> Cc: [email protected] Signed-off-by: Mike Turquette <[email protected]>
2013-08-05clk: mux: Add support for read-only muxes.Tomasz Figa1-0/+2
Some platforms have read-only clock muxes that are preconfigured at reset and cannot be changed at runtime. This patch extends mux clock driver to allow handling such read-only muxes by adding new CLK_MUX_READ_ONLY mux flag. Signed-off-by: Tomasz Figa <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-06-15clk: gate: add CLK_GATE_HIWORD_MASKHaojian Zhuang1-0/+5
In Rockchip Cortex-A9 based chips, they don't use paradigm of reading-changing-writing the register contents. Instead they use a hiword mask to indicate the changed bits. When b1 should be set as gate, it also needs to indicate the change by setting hiword mask (b1 << 16). The patch adds gate flag for this usage. Signed-off-by: Heiko Stuebner <[email protected]> Signed-off-by: Haojian Zhuang <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-06-15clk: divider: add CLK_DIVIDER_HIWORD_MASK flagHaojian Zhuang1-0/+5
In both Hisilicon & Rockchip Cortex-A9 based chips, they don't use the paradigm of reading-changing-writing the register contents. Instead they use a hiword mask to indicate the changed bits. When b01 should be set as setting divider, it also needs to indicate the change by setting hiword mask (b11 << 16). The patch adds divider flag for this usage. Signed-off-by: Heiko Stuebner <[email protected]> Signed-off-by: Haojian Zhuang <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-06-15clk: mux: add CLK_MUX_HIWORD_MASKHaojian Zhuang1-0/+5
In both Hisilicon & Rockchip Cortex-A9 based chips, they don't use the paradigm of reading-changing-writing the register contents. Instead they use a hiword mask to indicate the changed bits. When b01 should be set as switching mux, it also needs to indicate the change by setting hiword mask (b11 << 16). The patch adds mux flag for this usage. Signed-off-by: Heiko Stuebner <[email protected]> Signed-off-by: Haojian Zhuang <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-05-28clk: add non CONFIG_OF routines for clk-providerSebastian Hesselbarth1-8/+39
Some drivers that are shared between architectures have HAVE_CLK selected but don't have OF. To remove compilation errors for drivers that provide clocks on DT with of_clk_add_provider we would have to enclose these calls within #ifdef CONFIG_OF, #endif. This patch adds some stubs for OF related clk-provider functions that either do nothing or return appropriate values if CONFIG_OF is not set. So, definition of these routines will always be available. Signed-off-by: Sebastian Hesselbarth <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-04-12clk: composite: rename 'div' references to 'rate'Mike Turquette1-7/+7
Rename all div_hw and div_ops related variables and functions to use rate_hw, rate_ops, etc. This is to make the rate-change portion of the composite clk implementation more generic. A patch following this one will allow for fixed-rate clocks to reuse this infrastructure. Signed-off-by: Mike Turquette <[email protected]> Reviewed-by: Prashant Gaikwad <[email protected]> Tested-by: Emilio López <[email protected]> Cc: Gregory CLEMENT <[email protected]>
2013-04-12clk: add device tree fixed-factor-clock binding supportGregory CLEMENT1-0/+2
Add support for DT "fixed-factor-clock" binding to the common fixed factor clock support. Signed-off-by: Gregory CLEMENT <[email protected]> Tested-by: Christian Ruppert <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-04-03clk: divider: Introduce CLK_DIVIDER_ALLOW_ZERO flagSoren Brinkmann1-1/+7
Dividers which have CLK_DIVIDER_ONE_BASED set have a redundant state, being a divider value of zero. Some hardware implementations allow a zero divider which simply doesn't alter the frequency. I.e. it acts like a divide by one or bypassing the divider. This flag is used to handle such HW in the clk-divider model. Signed-off-by: Soren Brinkmann <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-04-02clk: fix clk_mux::flags kerneldocJames Hogan1-1/+1
The kerneldoc comment for struct clk_mux documented the non-existent num_clks instead of flags. Correct this. Signed-off-by: James Hogan <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-03-26clk: Add composite clock typePrashant Gaikwad1-0/+31
Not all clocks are required to be decomposed into basic clock types but at the same time want to use the functionality provided by these basic clock types instead of duplicating. For example, Tegra SoC has ~100 clocks which can be decomposed into Mux -> Div -> Gate clock types making the clock count to ~300. Also, parent change operation can not be performed on gate clock which forces to use mux clock in driver if want to change the parent. Instead aggregate the basic clock types functionality into one clock and just use this clock for all operations. This clock type re-uses the functionality of basic clock types and not limited to basic clock types but any hardware-specific implementation. Signed-off-by: Prashant Gaikwad <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-03-22clk: add table lookup to muxPeter De Schrijver1-1/+8
Add a table lookup feature to the mux clock. Also allow arbitrary masks instead of the width. This will be used by some clocks on Tegra114. Also adapt the tegra periph clk because it uses struct clk_mux directly. Signed-off-by: Peter De Schrijver <[email protected]> Tested-by: Stephen Warren <[email protected]> Signed-off-by: Mike Turquette <[email protected]>
2013-03-19clk: Introduce optional unprepare_unused callbackUlf Hansson1-0/+5
An unprepare_unused callback is introduced due to the same reasons to why the disable_unused callback was added. During the clk_disable_unused sequence, those clk_hw that needs specific treatment with regards to being unprepared, shall implement the unprepare_unused callback. Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Mike Turquette <[email protected]>