xref: /freebsd/sys/contrib/device-tree/Bindings/clock/ti/ti,divider-clock.yaml (revision 833e5d42ab135b0238e61c5b3c19b8619677cbfa)
15f62a964SEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only
25f62a964SEmmanuel Vadot%YAML 1.2
35f62a964SEmmanuel Vadot---
45f62a964SEmmanuel Vadot$id: http://devicetree.org/schemas/clock/ti/ti,divider-clock.yaml#
55f62a964SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
65f62a964SEmmanuel Vadot
75f62a964SEmmanuel Vadottitle: Texas Instruments divider clock
85f62a964SEmmanuel Vadot
95f62a964SEmmanuel Vadotmaintainers:
105f62a964SEmmanuel Vadot  - Tero Kristo <kristo@kernel.org>
115f62a964SEmmanuel Vadot
125f62a964SEmmanuel Vadotdescription: |
135f62a964SEmmanuel Vadot  This clock It assumes a register-mapped adjustable clock rate divider
145f62a964SEmmanuel Vadot  that does not gate and has only one input clock or parent.  By default the
155f62a964SEmmanuel Vadot  value programmed into the register is one less than the actual divisor value.
165f62a964SEmmanuel Vadot  E.g:
175f62a964SEmmanuel Vadot
185f62a964SEmmanuel Vadot  register value    actual divisor value
195f62a964SEmmanuel Vadot  0                 1
205f62a964SEmmanuel Vadot  1                 2
215f62a964SEmmanuel Vadot  2                 3
225f62a964SEmmanuel Vadot
235f62a964SEmmanuel Vadot  This assumption may be modified by the following optional properties:
245f62a964SEmmanuel Vadot
255f62a964SEmmanuel Vadot  ti,index-starts-at-one - valid divisor values start at 1, not the default
265f62a964SEmmanuel Vadot  of 0.  E.g:
275f62a964SEmmanuel Vadot  register value    actual divisor value
285f62a964SEmmanuel Vadot  1                 1
295f62a964SEmmanuel Vadot  2                 2
305f62a964SEmmanuel Vadot  3                 3
315f62a964SEmmanuel Vadot
325f62a964SEmmanuel Vadot  ti,index-power-of-two - valid divisor values are powers of two.  E.g:
335f62a964SEmmanuel Vadot  register value    actual divisor value
345f62a964SEmmanuel Vadot  0                 1
355f62a964SEmmanuel Vadot  1                 2
365f62a964SEmmanuel Vadot  2                 4
375f62a964SEmmanuel Vadot
385f62a964SEmmanuel Vadot  Additionally an array of valid dividers may be supplied like so:
395f62a964SEmmanuel Vadot
405f62a964SEmmanuel Vadot  ti,dividers = <4>, <8>, <0>, <16>;
415f62a964SEmmanuel Vadot
425f62a964SEmmanuel Vadot  Which will map the resulting values to a divisor table by their index:
435f62a964SEmmanuel Vadot  register value    actual divisor value
445f62a964SEmmanuel Vadot  0                 4
455f62a964SEmmanuel Vadot  1                 8
465f62a964SEmmanuel Vadot  2                 <invalid divisor, skipped>
475f62a964SEmmanuel Vadot  3                 16
485f62a964SEmmanuel Vadot
495f62a964SEmmanuel Vadot  Any zero value in this array means the corresponding bit-value is invalid
505f62a964SEmmanuel Vadot  and must not be used.
515f62a964SEmmanuel Vadot
525f62a964SEmmanuel Vadot  The binding must also provide the register to control the divider and
535f62a964SEmmanuel Vadot  unless the divider array is provided, min and max dividers. Optionally
545f62a964SEmmanuel Vadot  the number of bits to shift that mask, if necessary. If the shift value
555f62a964SEmmanuel Vadot  is missing it is the same as supplying a zero shift.
565f62a964SEmmanuel Vadot
575f62a964SEmmanuel Vadot  This binding can also optionally provide support to the hardware autoidle
58*833e5d42SEmmanuel Vadot  feature.
595f62a964SEmmanuel Vadot
60*833e5d42SEmmanuel VadotallOf:
61*833e5d42SEmmanuel Vadot  - $ref: ti,autoidle.yaml#
625f62a964SEmmanuel Vadot
635f62a964SEmmanuel Vadotproperties:
645f62a964SEmmanuel Vadot  compatible:
655f62a964SEmmanuel Vadot    enum:
665f62a964SEmmanuel Vadot      - ti,divider-clock
675f62a964SEmmanuel Vadot      - ti,composite-divider-clock
685f62a964SEmmanuel Vadot
695f62a964SEmmanuel Vadot  "#clock-cells":
705f62a964SEmmanuel Vadot    const: 0
715f62a964SEmmanuel Vadot
725f62a964SEmmanuel Vadot  clocks:
735f62a964SEmmanuel Vadot    maxItems: 1
745f62a964SEmmanuel Vadot
755f62a964SEmmanuel Vadot  clock-output-names:
765f62a964SEmmanuel Vadot    maxItems: 1
775f62a964SEmmanuel Vadot
785f62a964SEmmanuel Vadot  reg:
795f62a964SEmmanuel Vadot    maxItems: 1
805f62a964SEmmanuel Vadot
815f62a964SEmmanuel Vadot  ti,dividers:
825f62a964SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-array
835f62a964SEmmanuel Vadot    description:
845f62a964SEmmanuel Vadot      array of integers defining divisors
855f62a964SEmmanuel Vadot
865f62a964SEmmanuel Vadot  ti,bit-shift:
875f62a964SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
885f62a964SEmmanuel Vadot    description:
895f62a964SEmmanuel Vadot      number of bits to shift the divider value
905f62a964SEmmanuel Vadot    maximum: 31
915f62a964SEmmanuel Vadot    default: 0
925f62a964SEmmanuel Vadot
935f62a964SEmmanuel Vadot  ti,min-div:
945f62a964SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
955f62a964SEmmanuel Vadot    description:
965f62a964SEmmanuel Vadot      min divisor for dividing the input clock rate, only
975f62a964SEmmanuel Vadot      needed if the first divisor is offset from the default value (1)
985f62a964SEmmanuel Vadot    minimum: 1
995f62a964SEmmanuel Vadot    default: 1
1005f62a964SEmmanuel Vadot
1015f62a964SEmmanuel Vadot  ti,max-div:
1025f62a964SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
1035f62a964SEmmanuel Vadot    description:
1045f62a964SEmmanuel Vadot      max divisor for dividing the input clock rate, only needed
1055f62a964SEmmanuel Vadot      if ti,dividers is not defined.
1065f62a964SEmmanuel Vadot
1075f62a964SEmmanuel Vadot  ti,index-starts-at-one:
1085f62a964SEmmanuel Vadot    type: boolean
1095f62a964SEmmanuel Vadot    description:
1105f62a964SEmmanuel Vadot      valid divisor programming starts at 1, not zero,
1115f62a964SEmmanuel Vadot      only valid if ti,dividers is not defined
1125f62a964SEmmanuel Vadot
1135f62a964SEmmanuel Vadot  ti,index-power-of-two:
1145f62a964SEmmanuel Vadot    type: boolean
1155f62a964SEmmanuel Vadot    description:
1165f62a964SEmmanuel Vadot      valid divisor programming must be a power of two,
1175f62a964SEmmanuel Vadot      only valid if ti,dividers is not defined.
1185f62a964SEmmanuel Vadot
1195f62a964SEmmanuel Vadot  ti,set-rate-parent:
1205f62a964SEmmanuel Vadot    type: boolean
1215f62a964SEmmanuel Vadot    description:
1225f62a964SEmmanuel Vadot      clk_set_rate is propagated to parent            |
1235f62a964SEmmanuel Vadot
1245f62a964SEmmanuel Vadot  ti,latch-bit:
1255f62a964SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
1265f62a964SEmmanuel Vadot    description:
1275f62a964SEmmanuel Vadot      latch the divider value to HW, only needed if the register
1285f62a964SEmmanuel Vadot      compatible access requires this. As an example dra76x DPLL_GMAC
1295f62a964SEmmanuel Vadot      H14 divider implements such behavior.
1305f62a964SEmmanuel Vadot
1315f62a964SEmmanuel VadotdependentSchemas:
1325f62a964SEmmanuel Vadot  ti,dividers:
1335f62a964SEmmanuel Vadot    properties:
1345f62a964SEmmanuel Vadot      ti,min-div: false
1355f62a964SEmmanuel Vadot      ti,max-div: false
1365f62a964SEmmanuel Vadot      ti,index-power-of-two: false
1375f62a964SEmmanuel Vadot      ti,index-starts-at-one: false
1385f62a964SEmmanuel Vadot
1395f62a964SEmmanuel Vadotrequired:
1405f62a964SEmmanuel Vadot  - compatible
1415f62a964SEmmanuel Vadot  - "#clock-cells"
1425f62a964SEmmanuel Vadot  - clocks
1435f62a964SEmmanuel Vadot  - reg
1445f62a964SEmmanuel Vadot
145*833e5d42SEmmanuel VadotunevaluatedProperties: false
1465f62a964SEmmanuel Vadot
1475f62a964SEmmanuel Vadotexamples:
1485f62a964SEmmanuel Vadot  - |
1495f62a964SEmmanuel Vadot    bus {
1505f62a964SEmmanuel Vadot      #address-cells = <1>;
1515f62a964SEmmanuel Vadot      #size-cells = <0>;
1525f62a964SEmmanuel Vadot
1535f62a964SEmmanuel Vadot      clock-controller@190 {
1545f62a964SEmmanuel Vadot        #clock-cells = <0>;
1555f62a964SEmmanuel Vadot        compatible = "ti,divider-clock";
1565f62a964SEmmanuel Vadot        clocks = <&dpll_usb_ck>;
1575f62a964SEmmanuel Vadot        ti,max-div = <127>;
1585f62a964SEmmanuel Vadot        reg = <0x190>;
1595f62a964SEmmanuel Vadot        ti,index-starts-at-one;
1605f62a964SEmmanuel Vadot      };
1615f62a964SEmmanuel Vadot
1625f62a964SEmmanuel Vadot      clock-controller@528 {
1635f62a964SEmmanuel Vadot        #clock-cells = <0>;
1645f62a964SEmmanuel Vadot        compatible = "ti,divider-clock";
1655f62a964SEmmanuel Vadot        clocks = <&abe_clk>;
1665f62a964SEmmanuel Vadot        ti,bit-shift = <24>;
1675f62a964SEmmanuel Vadot        reg = <0x528>;
1685f62a964SEmmanuel Vadot        ti,max-div = <2>;
1695f62a964SEmmanuel Vadot      };
1705f62a964SEmmanuel Vadot
1715f62a964SEmmanuel Vadot      clock-controller@a40 {
1725f62a964SEmmanuel Vadot        #clock-cells = <0>;
1735f62a964SEmmanuel Vadot        compatible = "ti,composite-divider-clock";
1745f62a964SEmmanuel Vadot        clocks = <&corex2_fck>;
1755f62a964SEmmanuel Vadot        ti,bit-shift = <8>;
1765f62a964SEmmanuel Vadot        reg = <0x0a40>;
1775f62a964SEmmanuel Vadot        ti,dividers = <0>, <1>, <2>, <3>, <4>, <0>, <6>, <0>, <8>;
1785f62a964SEmmanuel Vadot      };
1795f62a964SEmmanuel Vadot    };
180