OpenCloudOS-Kernel/drivers/clk
Alex Elder 1f27f15258 clk: bcm281xx: add initial clock framework support
Add code for device tree support of clocks in the BCM281xx family of
SoCs.  Machines in this family use peripheral clocks implemented by
"Kona" clock control units (CCUs).  (Other Broadcom SoC families use
Kona style CCUs as well, but support for them is not yet upstream.)

A BCM281xx SoC has multiple CCUs, each of which manages a set of
clocks on the SoC.  A Kona peripheral clock is composite clock that
may include a gate, a parent clock multiplexor, and zero, one
or two dividers.  There is a variety of gate types, and many gates
implement hardware-managed gating (often called "auto-gating").
Most dividers divide their input clock signal by an integer value
(one or more).  There are also "fractional" dividers which allow
division by non-integer values.  To accomodate such dividers,
clock rates and dividers are generally maintained by the code in
"scaled" form, which allows integer and fractional dividers to
be handled in a uniform way.

If present, the gate for a Kona peripheral clock must be enabled
when a change is made to its multiplexor or one of its dividers.
Additionally, dividers and multiplexors have trigger registers which
must be used whenever the divider value or selected parent clock is
changed.  The same trigger is often used for a divider and
multiplexor, and a BCM281xx peripheral clock occasionally has two
triggers.

The gate, dividers, and parent clock selector are treated in this
code as "components" of a peripheral clock.  Their functionality is
implemented directly--e.g. the common clock framework gate
implementation is not used for a Kona peripheral clock gate.  (This
has being considered though, and the intention is to evolve this
code to leverage common code as much as possible.)

The source code is divided into three general portions:

    drivers/clk/bcm/clk-kona.h
    drivers/clk/bcm/clk-kona.c
        These implement the basic Kona clock functionality,
        including the clk_ops methods and various routines to
        manipulate registers and interpret their values.  This
        includes some functions used to set clocks to a desired
        initial state (though this feature is only partially
        implemented here).

    drivers/clk/bcm/clk-kona-setup.c
        This contains generic run-time initialization code for
        data structures representing Kona CCUs and clocks.  This
        encapsulates the clock structure initialization that can't
        be done statically.  Note that there is a great deal of
        validity-checking code here, making explicit certain
        assumptions in the code.   This is mostly useful for adding
        new clock definitions and could possibly be disabled for
        production use.

    drivers/clk/bcm/clk-bcm281xx.c
        This file defines the specific CCUs used by BCM281XX family
        SoCs, as well as the specific clocks implemented by each.
        It declares a device tree clock match entry for each CCU
        defined.

    include/dt-bindings/clock/bcm281xx.h
        This file defines the selector (index) values used to
        identify a particular clock provided by a CCU.  It consists
        entirely of C preprocessor constants, to be used by both the
        C source and device tree source files.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Matt Porter <mporter@linaro.org>
Acked-by: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Matt Porter <mporter@linaro.org>
2014-02-24 13:43:46 -05:00
..
at91 Second cleanup pull-request for 3.14: 2014-01-14 15:41:57 -08:00
bcm clk: bcm281xx: add initial clock framework support 2014-02-24 13:43:46 -05:00
hisilicon clk: hi3620: add gate clock flag 2013-12-11 16:42:23 +08:00
keystone clk: keystone: gate: fix error handling on init 2013-12-10 11:08:20 -05:00
mmp clk: add CLK_SET_RATE_NO_REPARENT flag 2013-08-19 12:27:17 -07:00
mvebu clk: mvebu: Staticize of_cpu_clk_setup 2013-12-19 17:47:32 -08:00
mxs ARM: mxs: remove custom .init_time hook 2013-09-29 21:09:34 +02:00
qcom clk: qcom: Fix modular build 2014-01-17 13:39:42 -08:00
rockchip clk: add support for Rockchip gate clocks 2013-06-20 15:58:27 -07:00
samsung The second half of the clock framework pull requeust for 3.14 is 2014-01-28 18:44:53 -08:00
shmobile clk: shmobile: Fix MSTP clock array initialization 2014-01-14 11:35:57 -08:00
sirf clk: sirf: re-arch to make the codes support both prima2 and atlas6 2014-01-16 12:00:53 -08:00
socfpga clk: socfpga: Use NULL instead of 0 2013-12-19 17:47:32 -08:00
spear clk: SPEAr: Staticize clk_frac_ops 2013-12-19 11:45:17 -08:00
sunxi clk: sunxi: fix overflow when setting up divided factors 2014-01-27 12:28:23 -08:00
tegra The first half of the clk framework pull request is made up almost 2014-01-23 18:56:08 -08:00
ti CLK: TI: add am43xx clock init file 2014-01-17 12:35:52 -08:00
ux500 clk: ux500: Remove extra semicolon 2013-12-19 17:47:33 -08:00
versatile The first half of the clk framework pull request is made up almost 2014-01-23 18:56:08 -08:00
x86 ACPI / LPSS: add support for Intel BayTrail 2013-06-19 01:08:47 +02:00
zynq clk/zynq/clkc: Add 'fclk-enable' feature 2013-12-20 13:23:55 +01:00
Kconfig clk: bcm281xx: add initial clock framework support 2014-02-24 13:43:46 -05:00
Makefile clk: bcm281xx: add initial clock framework support 2014-02-24 13:43:46 -05:00
clk-axi-clkgen.c clk: Add axi-clkgen driver 2013-03-19 17:20:30 -07:00
clk-bcm2835.c ARM: bcm2835: remove custom .init_time hook 2013-09-29 21:09:24 +02:00
clk-composite.c clk: composite: pass mux_hw into determine_rate 2014-01-15 07:48:03 -08:00
clk-devres.c ARM: 7537/1: clk: Fix release in devm_clk_put() 2012-09-19 21:51:27 +01:00
clk-divider.c clk: clk-divider: fix divisor > 255 bug 2014-01-08 08:33:12 -08:00
clk-efm32gg.c clk: new driver for efm32 SoC 2013-11-04 12:23:18 -08:00
clk-fixed-factor.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
clk-fixed-rate.c clk: add accuracy support for fixed clock 2013-12-22 23:14:28 -08:00
clk-gate.c clk: wrap I/O access for improved portability 2013-08-27 17:50:38 -07:00
clk-highbank.c ARM: highbank: remove custom .init_time hook 2013-09-29 21:09:29 +02:00
clk-ls1x.c clk: add Loongson1B clock support 2012-08-31 11:05:18 -07:00
clk-max77686.c clk: max77686: Register OF clock provider 2014-01-08 09:57:07 -08:00
clk-mux.c clk: wrap I/O access for improved portability 2013-08-27 17:50:38 -07:00
clk-nomadik.c clk: nomadik: fix missing __init on nomadik_src_init 2013-10-07 11:41:21 -07:00
clk-nspire.c clk: Add TI-Nspire clock drivers 2013-05-31 12:07:45 -07:00
clk-ppc-corenet.c powerpc: add missing explicit OF includes for ppc 2013-11-11 09:10:50 -06:00
clk-s2mps11.c mfd: s2mps11: Fix build after regmap field rename in sec-core.c 2013-12-16 11:30:39 +00:00
clk-si570.c clk: si570: Remove redundant of_match_ptr helper 2013-12-22 22:46:52 -08:00
clk-si5351.c The second half of the clock framework pull requeust for 3.14 is 2014-01-28 18:44:53 -08:00
clk-si5351.h clk: si5351: remove variant from platform_data 2014-01-27 11:20:22 -08:00
clk-twl6040.c clk: use platform_{get,set}_drvdata() 2013-05-30 18:19:34 -07:00
clk-u300.c clk: u300: Fix incorrect placement of __initconst 2013-08-27 18:34:09 -07:00
clk-vt8500.c clk: vt8500: Staticize vtwm_pll_ops 2013-12-19 17:47:32 -08:00
clk-wm831x.c clk: wm831x: get rid of the implementation of remove function 2013-10-02 01:23:34 -07:00
clk-xgene.c clk: Add APM X-Gene SoC clock driver 2013-10-07 11:22:15 -07:00
clk.c clk: Export more clk-provider functions 2014-01-27 11:43:19 -08:00
clk.h clk: Provide not locked variant of of_clk_get_from_provider() 2013-12-04 17:19:30 +01:00
clkdev.c clkdev: Fix race condition in clock lookup from device tree 2013-12-04 17:19:36 +01:00