18c2ecf20Sopenharmony_ciBinding for TI divider clock
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciBinding status: Unstable - ABI compatibility may be broken in the future
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciThis binding uses the common clock binding[1].  It assumes a
68c2ecf20Sopenharmony_ciregister-mapped adjustable clock rate divider that does not gate and has
78c2ecf20Sopenharmony_cionly one input clock or parent.  By default the value programmed into
88c2ecf20Sopenharmony_cithe register is one less than the actual divisor value.  E.g:
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciregister value		actual divisor value
118c2ecf20Sopenharmony_ci0			1
128c2ecf20Sopenharmony_ci1			2
138c2ecf20Sopenharmony_ci2			3
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciThis assumption may be modified by the following optional properties:
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_citi,index-starts-at-one - valid divisor values start at 1, not the default
188c2ecf20Sopenharmony_ciof 0.  E.g:
198c2ecf20Sopenharmony_ciregister value		actual divisor value
208c2ecf20Sopenharmony_ci1			1
218c2ecf20Sopenharmony_ci2			2
228c2ecf20Sopenharmony_ci3			3
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_citi,index-power-of-two - valid divisor values are powers of two.  E.g:
258c2ecf20Sopenharmony_ciregister value		actual divisor value
268c2ecf20Sopenharmony_ci0			1
278c2ecf20Sopenharmony_ci1			2
288c2ecf20Sopenharmony_ci2			4
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciAdditionally an array of valid dividers may be supplied like so:
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	ti,dividers = <4>, <8>, <0>, <16>;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciWhich will map the resulting values to a divisor table by their index:
358c2ecf20Sopenharmony_ciregister value		actual divisor value
368c2ecf20Sopenharmony_ci0			4
378c2ecf20Sopenharmony_ci1			8
388c2ecf20Sopenharmony_ci2			<invalid divisor, skipped>
398c2ecf20Sopenharmony_ci3			16
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciAny zero value in this array means the corresponding bit-value is invalid
428c2ecf20Sopenharmony_ciand must not be used.
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciThe binding must also provide the register to control the divider and
458c2ecf20Sopenharmony_ciunless the divider array is provided, min and max dividers. Optionally
468c2ecf20Sopenharmony_cithe number of bits to shift that mask, if necessary. If the shift value
478c2ecf20Sopenharmony_ciis missing it is the same as supplying a zero shift.
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciThis binding can also optionally provide support to the hardware autoidle
508c2ecf20Sopenharmony_cifeature, see [2].
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
538c2ecf20Sopenharmony_ci[2] Documentation/devicetree/bindings/clock/ti/autoidle.txt
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciRequired properties:
568c2ecf20Sopenharmony_ci- compatible : shall be "ti,divider-clock" or "ti,composite-divider-clock".
578c2ecf20Sopenharmony_ci- #clock-cells : from common clock binding; shall be set to 0.
588c2ecf20Sopenharmony_ci- clocks : link to phandle of parent clock
598c2ecf20Sopenharmony_ci- reg : offset for register controlling adjustable divider
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciOptional properties:
628c2ecf20Sopenharmony_ci- clock-output-names : from common clock binding.
638c2ecf20Sopenharmony_ci- ti,dividers : array of integers defining divisors
648c2ecf20Sopenharmony_ci- ti,bit-shift : number of bits to shift the divider value, defaults to 0
658c2ecf20Sopenharmony_ci- ti,min-div : min divisor for dividing the input clock rate, only
668c2ecf20Sopenharmony_ci  needed if the first divisor is offset from the default value (1)
678c2ecf20Sopenharmony_ci- ti,max-div : max divisor for dividing the input clock rate, only needed
688c2ecf20Sopenharmony_ci  if ti,dividers is not defined.
698c2ecf20Sopenharmony_ci- ti,index-starts-at-one : valid divisor programming starts at 1, not zero,
708c2ecf20Sopenharmony_ci  only valid if ti,dividers is not defined.
718c2ecf20Sopenharmony_ci- ti,index-power-of-two : valid divisor programming must be a power of two,
728c2ecf20Sopenharmony_ci  only valid if ti,dividers is not defined.
738c2ecf20Sopenharmony_ci- ti,autoidle-shift : bit shift of the autoidle enable bit for the clock,
748c2ecf20Sopenharmony_ci  see [2]
758c2ecf20Sopenharmony_ci- ti,invert-autoidle-bit : autoidle is enabled by setting the bit to 0,
768c2ecf20Sopenharmony_ci  see [2]
778c2ecf20Sopenharmony_ci- ti,set-rate-parent : clk_set_rate is propagated to parent
788c2ecf20Sopenharmony_ci- ti,latch-bit : latch the divider value to HW, only needed if the register
798c2ecf20Sopenharmony_ci  access requires this. As an example dra76x DPLL_GMAC H14 divider implements
808c2ecf20Sopenharmony_ci  such behavior.
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ciExamples:
838c2ecf20Sopenharmony_cidpll_usb_m2_ck: dpll_usb_m2_ck@4a008190 {
848c2ecf20Sopenharmony_ci	#clock-cells = <0>;
858c2ecf20Sopenharmony_ci	compatible = "ti,divider-clock";
868c2ecf20Sopenharmony_ci	clocks = <&dpll_usb_ck>;
878c2ecf20Sopenharmony_ci	ti,max-div = <127>;
888c2ecf20Sopenharmony_ci	reg = <0x190>;
898c2ecf20Sopenharmony_ci	ti,index-starts-at-one;
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ciaess_fclk: aess_fclk@4a004528 {
938c2ecf20Sopenharmony_ci	#clock-cells = <0>;
948c2ecf20Sopenharmony_ci	compatible = "ti,divider-clock";
958c2ecf20Sopenharmony_ci	clocks = <&abe_clk>;
968c2ecf20Sopenharmony_ci	ti,bit-shift = <24>;
978c2ecf20Sopenharmony_ci	reg = <0x528>;
988c2ecf20Sopenharmony_ci	ti,max-div = <2>;
998c2ecf20Sopenharmony_ci};
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_cidpll_core_m3x2_div_ck: dpll_core_m3x2_div_ck {
1028c2ecf20Sopenharmony_ci	#clock-cells = <0>;
1038c2ecf20Sopenharmony_ci	compatible = "ti,composite-divider-clock";
1048c2ecf20Sopenharmony_ci	clocks = <&dpll_core_x2_ck>;
1058c2ecf20Sopenharmony_ci	ti,max-div = <31>;
1068c2ecf20Sopenharmony_ci	reg = <0x0134>;
1078c2ecf20Sopenharmony_ci	ti,index-starts-at-one;
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_cissi_ssr_div_fck_3430es2: ssi_ssr_div_fck_3430es2 {
1118c2ecf20Sopenharmony_ci	#clock-cells = <0>;
1128c2ecf20Sopenharmony_ci	compatible = "ti,composite-divider-clock";
1138c2ecf20Sopenharmony_ci	clocks = <&corex2_fck>;
1148c2ecf20Sopenharmony_ci	ti,bit-shift = <8>;
1158c2ecf20Sopenharmony_ci	reg = <0x0a40>;
1168c2ecf20Sopenharmony_ci	ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
1178c2ecf20Sopenharmony_ci};
118