Commit 4b7cf35c authored by Paul Cercueil's avatar Paul Cercueil Committed by Rob Herring
Browse files

dt-bindings: clock: Convert ingenic,cgu.txt to YAML



Convert the ingenic,cgu.txt doc file to ingenic,cgu.yaml.

The binding documentation has been updated as well. The node can have a
child node that corresponds to the USB PHY, which happens to be present
in the middle of the CGU registers.

Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent c54030b1
Loading
Loading
Loading
Loading
+0 −57
Original line number Diff line number Diff line
Ingenic SoC CGU binding

The CGU in an Ingenic SoC provides all the clocks generated on-chip. It
typically includes a variety of PLLs, multiplexers, dividers & gates in order
to provide many different clock signals derived from only 2 external source
clocks.

Required properties:
- compatible : Should be one of:
  * ingenic,jz4740-cgu
  * ingenic,jz4725b-cgu
  * ingenic,jz4770-cgu
  * ingenic,jz4780-cgu
  * ingenic,x1000-cgu
- reg : The address & length of the CGU registers.
- clocks : List of phandle & clock specifiers for clocks external to the CGU.
  Two such external clocks should be specified - first the external crystal
  "ext" and second the RTC clock source "rtc".
- clock-names : List of name strings for the external clocks.
- #clock-cells: Should be 1.
  Clock consumers specify this argument to identify a clock. The valid values
  may be found in <dt-bindings/clock/<soctype>-cgu.h>.

Example SoC include file:

/ {
	cgu: jz4740-cgu {
		compatible = "ingenic,jz4740-cgu";
		reg = <0x10000000 0x100>;
		#clock-cells = <1>;
	};

	uart0: serial@10030000 {
		clocks = <&cgu JZ4740_CLK_UART0>;
	};
};

Example board file:

/ {
	ext: clock@0 {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <12000000>;
	};

	rtc: clock@1 {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <32768>;
	};

	&cgu {
		clocks = <&ext> <&rtc>;
		clock-names: "ext", "rtc";
	};
};
+122 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/ingenic,cgu.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Ingenic SoCs CGU devicetree bindings

description: |
  The CGU in an Ingenic SoC provides all the clocks generated on-chip. It
  typically includes a variety of PLLs, multiplexers, dividers & gates in order
  to provide many different clock signals derived from only 2 external source
  clocks.

maintainers:
  - Paul Cercueil <paul@crapouillou.net>

select:
  properties:
    compatible:
      contains:
        enum:
          - ingenic,jz4740-cgu
          - ingenic,jz4725b-cgu
          - ingenic,jz4770-cgu
          - ingenic,jz4780-cgu
          - ingenic,x1000-cgu
  required:
    - compatible

properties:
  $nodename:
    pattern: "^clock-controller@[0-9a-f]+$"

  "#address-cells":
    const: 1

  "#size-cells":
    const: 1

  "#clock-cells":
    const: 1

  ranges: true

  compatible:
    items:
      - enum:
        - ingenic,jz4740-cgu
        - ingenic,jz4725b-cgu
        - ingenic,jz4770-cgu
        - ingenic,jz4780-cgu
        - ingenic,x1000-cgu
      - const: simple-mfd
    minItems: 1

  reg:
    maxItems: 1

  clocks:
    items:
      - description: External oscillator clock
      - description: Internal 32 kHz RTC clock

  clock-names:
    items:
      - const: ext
      - enum:
        - rtc
        - osc32k # Different name, same clock

  assigned-clocks:
    minItems: 1
    maxItems: 64

  assigned-clock-parents:
    minItems: 1
    maxItems: 64

  assigned-clock-rates:
    minItems: 1
    maxItems: 64

required:
  - "#clock-cells"
  - compatible
  - reg
  - clocks
  - clock-names

patternProperties:
  "^usb-phy@[a-f0-9]+$":
    allOf: [ $ref: "../usb/ingenic,jz4770-phy.yaml#" ]

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/jz4770-cgu.h>
    cgu: clock-controller@10000000 {
      compatible = "ingenic,jz4770-cgu", "simple-mfd";
      reg = <0x10000000 0x100>;
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0x0 0x10000000 0x100>;

      clocks = <&ext>, <&osc32k>;
      clock-names = "ext", "osc32k";

      #clock-cells = <1>;

      otg_phy: usb-phy@3c {
        compatible = "ingenic,jz4770-phy";
        reg = <0x3c 0x10>;

        clocks = <&cgu JZ4770_CLK_OTG_PHY>;

        vcc-supply = <&ldo5>;

        #phy-cells = <0>;
      };
    };