Skip to content

Commit 35395a9

Browse files
tmlindTero Kristo
authored andcommitted
Documentation: dt-bindings: Add binding documentation for TI clkctrl clocks
Texas Instruments omap variant SoCs starting with omap4 have a clkctrl clock controller instance for each interconnect target module. The clkctrl controls functional and interface clocks for the module. The clkctrl clocks are currently handled by arch/arm/mach-omap2 hwmod code. With this binding and a related clock device driver we can start moving the clkctrl clock handling to live in drivers/clk/ti. Note that this binding allows keeping the clockdomain related parts out of drivers/clock. The CLKCTCTRL and DYNAMICDEP registers can be handled by a separate driver in drivers/soc/ti and genpd. If the clockdomain driver needs to know it's clocks, we can just set the the clkctrl device instances to be children of the related clockdomain device. Each clkctrl clock can have multiple optional gate clocks, and multiple optional mux clocks. To represent this in device tree, it seems that it is best done using four clock cells #clock-cells = <2> property. The reasons for using #clock-cells = <2> are: 1. We need to specify the clkctrl offset from the instance base. Otherwise we end up with a large number of device tree nodes that need to be patched when new clocks are discovered in a clkctrl clock with minor hardware revision changes for example 2. On omap5 CM_L3INIT_USB_HOST_HS_CLKCTRL has ten OPTFCLKEN bits. So we need to use a separate cell for optional gate clocks to avoid address space conflicts There is probably no need to list input clocks for each clkctrl clock instance in the binding. If we want to add them, the standard clocks binding can be used for that. For hardware reference, see omap4430 TRM "Table 3-1312. L4PER_CM2 Registers Mapping Summary" for example. It shows one instance of a clkctrl clock controller with multiple clkctrl registers. Cc: Paul Walmsley <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Tero Kristo <[email protected]>
1 parent 2ea659a commit 35395a9

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Texas Instruments clkctrl clock binding
2+
3+
Texas Instruments SoCs can have a clkctrl clock controller for each
4+
interconnect target module. The clkctrl clock controller manages functional
5+
and interface clocks for each module. Each clkctrl controller can also
6+
gate one or more optional functional clocks for a module, and can have one
7+
or more clock muxes. There is a clkctrl clock controller typically for each
8+
interconnect target module on omap4 and later variants.
9+
10+
The clock consumers can specify the index of the clkctrl clock using
11+
the hardware offset from the clkctrl instance register space. The optional
12+
clocks can be specified by clkctrl hardware offset and the index of the
13+
optional clock.
14+
15+
For more information, please see the Linux clock framework binding at
16+
Documentation/devicetree/bindings/clock/clock-bindings.txt.
17+
18+
Required properties :
19+
- compatible : shall be "ti,clkctrl"
20+
- #clock-cells : shall contain 2 with the first entry being the instance
21+
offset from the clock domain base and the second being the
22+
clock index
23+
24+
Example: Clock controller node on omap 4430:
25+
26+
&cm2 {
27+
l4per: cm@1400 {
28+
cm_l4per@0 {
29+
cm_l4per_clkctrl: clk@20 {
30+
compatible = "ti,clkctrl";
31+
reg = <0x20 0x1b0>;
32+
#clock-cells = <2>;
33+
};
34+
};
35+
};
36+
};
37+
38+
Example: Preprocessor helper macros in dt-bindings/clock/ti-clkctrl.h
39+
40+
#define OMAP4_CLKCTRL_OFFSET 0x20
41+
#define OMAP4_CLKCTRL_INDEX(offset) ((offset) - OMAP4_CLKCTRL_OFFSET)
42+
#define MODULEMODE_HWCTRL 1
43+
#define MODULEMODE_SWCTRL 2
44+
45+
#define OMAP4_GPTIMER10_CLKTRL OMAP4_CLKCTRL_INDEX(0x28)
46+
#define OMAP4_GPTIMER11_CLKTRL OMAP4_CLKCTRL_INDEX(0x30)
47+
#define OMAP4_GPTIMER2_CLKTRL OMAP4_CLKCTRL_INDEX(0x38)
48+
...
49+
#define OMAP4_GPIO2_CLKCTRL OMAP_CLKCTRL_INDEX(0x60)
50+
51+
Example: Clock consumer node for GPIO2:
52+
53+
&gpio2 {
54+
clocks = <&cm_l4per_clkctrl OMAP4_GPIO2_CLKCTRL 0
55+
&cm_l4per_clkctrl OMAP4_GPIO2_CLKCTRL 8>;
56+
};

0 commit comments

Comments
 (0)