xref: /freebsd/sys/contrib/device-tree/Bindings/clock/ti/divider.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotBinding for TI divider clock
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotBinding status: Unstable - ABI compatibility may be broken in the future
4*c66ec88fSEmmanuel Vadot
5*c66ec88fSEmmanuel VadotThis binding uses the common clock binding[1].  It assumes a
6*c66ec88fSEmmanuel Vadotregister-mapped adjustable clock rate divider that does not gate and has
7*c66ec88fSEmmanuel Vadotonly one input clock or parent.  By default the value programmed into
8*c66ec88fSEmmanuel Vadotthe register is one less than the actual divisor value.  E.g:
9*c66ec88fSEmmanuel Vadot
10*c66ec88fSEmmanuel Vadotregister value		actual divisor value
11*c66ec88fSEmmanuel Vadot0			1
12*c66ec88fSEmmanuel Vadot1			2
13*c66ec88fSEmmanuel Vadot2			3
14*c66ec88fSEmmanuel Vadot
15*c66ec88fSEmmanuel VadotThis assumption may be modified by the following optional properties:
16*c66ec88fSEmmanuel Vadot
17*c66ec88fSEmmanuel Vadotti,index-starts-at-one - valid divisor values start at 1, not the default
18*c66ec88fSEmmanuel Vadotof 0.  E.g:
19*c66ec88fSEmmanuel Vadotregister value		actual divisor value
20*c66ec88fSEmmanuel Vadot1			1
21*c66ec88fSEmmanuel Vadot2			2
22*c66ec88fSEmmanuel Vadot3			3
23*c66ec88fSEmmanuel Vadot
24*c66ec88fSEmmanuel Vadotti,index-power-of-two - valid divisor values are powers of two.  E.g:
25*c66ec88fSEmmanuel Vadotregister value		actual divisor value
26*c66ec88fSEmmanuel Vadot0			1
27*c66ec88fSEmmanuel Vadot1			2
28*c66ec88fSEmmanuel Vadot2			4
29*c66ec88fSEmmanuel Vadot
30*c66ec88fSEmmanuel VadotAdditionally an array of valid dividers may be supplied like so:
31*c66ec88fSEmmanuel Vadot
32*c66ec88fSEmmanuel Vadot	ti,dividers = <4>, <8>, <0>, <16>;
33*c66ec88fSEmmanuel Vadot
34*c66ec88fSEmmanuel VadotWhich will map the resulting values to a divisor table by their index:
35*c66ec88fSEmmanuel Vadotregister value		actual divisor value
36*c66ec88fSEmmanuel Vadot0			4
37*c66ec88fSEmmanuel Vadot1			8
38*c66ec88fSEmmanuel Vadot2			<invalid divisor, skipped>
39*c66ec88fSEmmanuel Vadot3			16
40*c66ec88fSEmmanuel Vadot
41*c66ec88fSEmmanuel VadotAny zero value in this array means the corresponding bit-value is invalid
42*c66ec88fSEmmanuel Vadotand must not be used.
43*c66ec88fSEmmanuel Vadot
44*c66ec88fSEmmanuel VadotThe binding must also provide the register to control the divider and
45*c66ec88fSEmmanuel Vadotunless the divider array is provided, min and max dividers. Optionally
46*c66ec88fSEmmanuel Vadotthe number of bits to shift that mask, if necessary. If the shift value
47*c66ec88fSEmmanuel Vadotis missing it is the same as supplying a zero shift.
48*c66ec88fSEmmanuel Vadot
49*c66ec88fSEmmanuel VadotThis binding can also optionally provide support to the hardware autoidle
50*c66ec88fSEmmanuel Vadotfeature, see [2].
51*c66ec88fSEmmanuel Vadot
52*c66ec88fSEmmanuel Vadot[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
53*c66ec88fSEmmanuel Vadot[2] Documentation/devicetree/bindings/clock/ti/autoidle.txt
54*c66ec88fSEmmanuel Vadot
55*c66ec88fSEmmanuel VadotRequired properties:
56*c66ec88fSEmmanuel Vadot- compatible : shall be "ti,divider-clock" or "ti,composite-divider-clock".
57*c66ec88fSEmmanuel Vadot- #clock-cells : from common clock binding; shall be set to 0.
58*c66ec88fSEmmanuel Vadot- clocks : link to phandle of parent clock
59*c66ec88fSEmmanuel Vadot- reg : offset for register controlling adjustable divider
60*c66ec88fSEmmanuel Vadot
61*c66ec88fSEmmanuel VadotOptional properties:
62*c66ec88fSEmmanuel Vadot- clock-output-names : from common clock binding.
63*c66ec88fSEmmanuel Vadot- ti,dividers : array of integers defining divisors
64*c66ec88fSEmmanuel Vadot- ti,bit-shift : number of bits to shift the divider value, defaults to 0
65*c66ec88fSEmmanuel Vadot- ti,min-div : min divisor for dividing the input clock rate, only
66*c66ec88fSEmmanuel Vadot  needed if the first divisor is offset from the default value (1)
67*c66ec88fSEmmanuel Vadot- ti,max-div : max divisor for dividing the input clock rate, only needed
68*c66ec88fSEmmanuel Vadot  if ti,dividers is not defined.
69*c66ec88fSEmmanuel Vadot- ti,index-starts-at-one : valid divisor programming starts at 1, not zero,
70*c66ec88fSEmmanuel Vadot  only valid if ti,dividers is not defined.
71*c66ec88fSEmmanuel Vadot- ti,index-power-of-two : valid divisor programming must be a power of two,
72*c66ec88fSEmmanuel Vadot  only valid if ti,dividers is not defined.
73*c66ec88fSEmmanuel Vadot- ti,autoidle-shift : bit shift of the autoidle enable bit for the clock,
74*c66ec88fSEmmanuel Vadot  see [2]
75*c66ec88fSEmmanuel Vadot- ti,invert-autoidle-bit : autoidle is enabled by setting the bit to 0,
76*c66ec88fSEmmanuel Vadot  see [2]
77*c66ec88fSEmmanuel Vadot- ti,set-rate-parent : clk_set_rate is propagated to parent
78*c66ec88fSEmmanuel Vadot- ti,latch-bit : latch the divider value to HW, only needed if the register
79*c66ec88fSEmmanuel Vadot  access requires this. As an example dra76x DPLL_GMAC H14 divider implements
80*c66ec88fSEmmanuel Vadot  such behavior.
81*c66ec88fSEmmanuel Vadot
82*c66ec88fSEmmanuel VadotExamples:
83*c66ec88fSEmmanuel Vadotdpll_usb_m2_ck: dpll_usb_m2_ck@4a008190 {
84*c66ec88fSEmmanuel Vadot	#clock-cells = <0>;
85*c66ec88fSEmmanuel Vadot	compatible = "ti,divider-clock";
86*c66ec88fSEmmanuel Vadot	clocks = <&dpll_usb_ck>;
87*c66ec88fSEmmanuel Vadot	ti,max-div = <127>;
88*c66ec88fSEmmanuel Vadot	reg = <0x190>;
89*c66ec88fSEmmanuel Vadot	ti,index-starts-at-one;
90*c66ec88fSEmmanuel Vadot};
91*c66ec88fSEmmanuel Vadot
92*c66ec88fSEmmanuel Vadotaess_fclk: aess_fclk@4a004528 {
93*c66ec88fSEmmanuel Vadot	#clock-cells = <0>;
94*c66ec88fSEmmanuel Vadot	compatible = "ti,divider-clock";
95*c66ec88fSEmmanuel Vadot	clocks = <&abe_clk>;
96*c66ec88fSEmmanuel Vadot	ti,bit-shift = <24>;
97*c66ec88fSEmmanuel Vadot	reg = <0x528>;
98*c66ec88fSEmmanuel Vadot	ti,max-div = <2>;
99*c66ec88fSEmmanuel Vadot};
100*c66ec88fSEmmanuel Vadot
101*c66ec88fSEmmanuel Vadotdpll_core_m3x2_div_ck: dpll_core_m3x2_div_ck {
102*c66ec88fSEmmanuel Vadot	#clock-cells = <0>;
103*c66ec88fSEmmanuel Vadot	compatible = "ti,composite-divider-clock";
104*c66ec88fSEmmanuel Vadot	clocks = <&dpll_core_x2_ck>;
105*c66ec88fSEmmanuel Vadot	ti,max-div = <31>;
106*c66ec88fSEmmanuel Vadot	reg = <0x0134>;
107*c66ec88fSEmmanuel Vadot	ti,index-starts-at-one;
108*c66ec88fSEmmanuel Vadot};
109*c66ec88fSEmmanuel Vadot
110*c66ec88fSEmmanuel Vadotssi_ssr_div_fck_3430es2: ssi_ssr_div_fck_3430es2 {
111*c66ec88fSEmmanuel Vadot	#clock-cells = <0>;
112*c66ec88fSEmmanuel Vadot	compatible = "ti,composite-divider-clock";
113*c66ec88fSEmmanuel Vadot	clocks = <&corex2_fck>;
114*c66ec88fSEmmanuel Vadot	ti,bit-shift = <8>;
115*c66ec88fSEmmanuel Vadot	reg = <0x0a40>;
116*c66ec88fSEmmanuel Vadot	ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
117*c66ec88fSEmmanuel Vadot};
118