16be33864SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
26be33864SEmmanuel Vadot# Copyright (C) 2020 SiFive, Inc.
36be33864SEmmanuel Vadot%YAML 1.2
46be33864SEmmanuel Vadot---
56be33864SEmmanuel Vadot$id: http://devicetree.org/schemas/pwm/pwm-sifive.yaml#
66be33864SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
76be33864SEmmanuel Vadot
86be33864SEmmanuel Vadottitle: SiFive PWM controller
96be33864SEmmanuel Vadot
106be33864SEmmanuel Vadotmaintainers:
116be33864SEmmanuel Vadot  - Paul Walmsley <paul.walmsley@sifive.com>
126be33864SEmmanuel Vadot
136be33864SEmmanuel Vadotdescription:
146be33864SEmmanuel Vadot  Unlike most other PWM controllers, the SiFive PWM controller currently
156be33864SEmmanuel Vadot  only supports one period for all channels in the PWM. All PWMs need to
166be33864SEmmanuel Vadot  run at the same period. The period also has significant restrictions on
176be33864SEmmanuel Vadot  the values it can achieve, which the driver rounds to the nearest
186be33864SEmmanuel Vadot  achievable period. PWM RTL that corresponds to the IP block version
196be33864SEmmanuel Vadot  numbers can be found here -
206be33864SEmmanuel Vadot
216be33864SEmmanuel Vadot  https://github.com/sifive/sifive-blocks/tree/master/src/main/scala/devices/pwm
226be33864SEmmanuel Vadot
23*c9ccf3a3SEmmanuel VadotallOf:
24*c9ccf3a3SEmmanuel Vadot  - $ref: pwm.yaml#
25*c9ccf3a3SEmmanuel Vadot
266be33864SEmmanuel Vadotproperties:
276be33864SEmmanuel Vadot  compatible:
286be33864SEmmanuel Vadot    items:
295def4c47SEmmanuel Vadot      - enum:
305def4c47SEmmanuel Vadot          - sifive,fu540-c000-pwm
315def4c47SEmmanuel Vadot          - sifive,fu740-c000-pwm
326be33864SEmmanuel Vadot      - const: sifive,pwm0
336be33864SEmmanuel Vadot    description:
346be33864SEmmanuel Vadot      Should be "sifive,<chip>-pwm" and "sifive,pwm<version>". Supported
355def4c47SEmmanuel Vadot      compatible strings are "sifive,fu540-c000-pwm" and
365def4c47SEmmanuel Vadot      "sifive,fu740-c000-pwm" for the SiFive PWM v0 as integrated onto the
375def4c47SEmmanuel Vadot      SiFive FU540 and FU740 chip respectively, and "sifive,pwm0" for the
386be33864SEmmanuel Vadot      SiFive PWM v0 IP block with no chip integration tweaks.
396be33864SEmmanuel Vadot      Please refer to sifive-blocks-ip-versioning.txt for details.
406be33864SEmmanuel Vadot
416be33864SEmmanuel Vadot  reg:
426be33864SEmmanuel Vadot    maxItems: 1
436be33864SEmmanuel Vadot
446be33864SEmmanuel Vadot  clocks:
456be33864SEmmanuel Vadot    maxItems: 1
466be33864SEmmanuel Vadot
476be33864SEmmanuel Vadot  "#pwm-cells":
486be33864SEmmanuel Vadot    const: 3
496be33864SEmmanuel Vadot
506be33864SEmmanuel Vadot  interrupts:
516be33864SEmmanuel Vadot    maxItems: 4
526be33864SEmmanuel Vadot    description:
536be33864SEmmanuel Vadot      Each PWM instance in FU540-C000 has 4 comparators. One interrupt per comparator.
546be33864SEmmanuel Vadot
556be33864SEmmanuel Vadotrequired:
566be33864SEmmanuel Vadot  - compatible
576be33864SEmmanuel Vadot  - reg
586be33864SEmmanuel Vadot  - clocks
596be33864SEmmanuel Vadot  - interrupts
606be33864SEmmanuel Vadot
616be33864SEmmanuel VadotadditionalProperties: false
626be33864SEmmanuel Vadot
636be33864SEmmanuel Vadotexamples:
646be33864SEmmanuel Vadot  - |
656be33864SEmmanuel Vadot    pwm:  pwm@10020000 {
666be33864SEmmanuel Vadot      compatible = "sifive,fu540-c000-pwm", "sifive,pwm0";
676be33864SEmmanuel Vadot      reg = <0x10020000 0x1000>;
686be33864SEmmanuel Vadot      clocks = <&tlclk>;
696be33864SEmmanuel Vadot      interrupt-parent = <&plic>;
706be33864SEmmanuel Vadot      interrupts = <42>, <43>, <44>, <45>;
716be33864SEmmanuel Vadot      #pwm-cells = <3>;
726be33864SEmmanuel Vadot    };
73