xref: /freebsd/sys/contrib/device-tree/Bindings/clock/mediatek,mt8196-sys-clock.yaml (revision 1537cf73828a2db2a67622ccfff77383c7db6f07)
1*1537cf73SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2*1537cf73SEmmanuel Vadot%YAML 1.2
3*1537cf73SEmmanuel Vadot---
4*1537cf73SEmmanuel Vadot$id: http://devicetree.org/schemas/clock/mediatek,mt8196-sys-clock.yaml#
5*1537cf73SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*1537cf73SEmmanuel Vadot
7*1537cf73SEmmanuel Vadottitle: MediaTek System Clock Controller for MT8196
8*1537cf73SEmmanuel Vadot
9*1537cf73SEmmanuel Vadotmaintainers:
10*1537cf73SEmmanuel Vadot  - Guangjie Song <guangjie.song@mediatek.com>
11*1537cf73SEmmanuel Vadot  - Laura Nao <laura.nao@collabora.com>
12*1537cf73SEmmanuel Vadot
13*1537cf73SEmmanuel Vadotdescription: |
14*1537cf73SEmmanuel Vadot  The clock architecture in MediaTek SoCs is structured like below:
15*1537cf73SEmmanuel Vadot  PLLs -->
16*1537cf73SEmmanuel Vadot          dividers -->
17*1537cf73SEmmanuel Vadot                      muxes
18*1537cf73SEmmanuel Vadot                           -->
19*1537cf73SEmmanuel Vadot                              clock gate
20*1537cf73SEmmanuel Vadot
21*1537cf73SEmmanuel Vadot  The apmixedsys, apmixedsys_gp2, vlpckgen, armpll, ccipll, mfgpll and ptppll
22*1537cf73SEmmanuel Vadot  provide most of the PLLs which are generated from the SoC's 26MHZ crystal oscillator.
23*1537cf73SEmmanuel Vadot  The topckgen, topckgen_gp2 and vlpckgen provide dividers and muxes which
24*1537cf73SEmmanuel Vadot  provide the clock source to other IP blocks.
25*1537cf73SEmmanuel Vadot
26*1537cf73SEmmanuel Vadotproperties:
27*1537cf73SEmmanuel Vadot  compatible:
28*1537cf73SEmmanuel Vadot    items:
29*1537cf73SEmmanuel Vadot      - enum:
30*1537cf73SEmmanuel Vadot          - mediatek,mt8196-apmixedsys
31*1537cf73SEmmanuel Vadot          - mediatek,mt8196-armpll-b-pll-ctrl
32*1537cf73SEmmanuel Vadot          - mediatek,mt8196-armpll-bl-pll-ctrl
33*1537cf73SEmmanuel Vadot          - mediatek,mt8196-armpll-ll-pll-ctrl
34*1537cf73SEmmanuel Vadot          - mediatek,mt8196-apmixedsys-gp2
35*1537cf73SEmmanuel Vadot          - mediatek,mt8196-ccipll-pll-ctrl
36*1537cf73SEmmanuel Vadot          - mediatek,mt8196-mfgpll-pll-ctrl
37*1537cf73SEmmanuel Vadot          - mediatek,mt8196-mfgpll-sc0-pll-ctrl
38*1537cf73SEmmanuel Vadot          - mediatek,mt8196-mfgpll-sc1-pll-ctrl
39*1537cf73SEmmanuel Vadot          - mediatek,mt8196-ptppll-pll-ctrl
40*1537cf73SEmmanuel Vadot          - mediatek,mt8196-topckgen
41*1537cf73SEmmanuel Vadot          - mediatek,mt8196-topckgen-gp2
42*1537cf73SEmmanuel Vadot          - mediatek,mt8196-vlpckgen
43*1537cf73SEmmanuel Vadot      - const: syscon
44*1537cf73SEmmanuel Vadot
45*1537cf73SEmmanuel Vadot  reg:
46*1537cf73SEmmanuel Vadot    maxItems: 1
47*1537cf73SEmmanuel Vadot
48*1537cf73SEmmanuel Vadot  '#clock-cells':
49*1537cf73SEmmanuel Vadot    const: 1
50*1537cf73SEmmanuel Vadot
51*1537cf73SEmmanuel Vadot  mediatek,hardware-voter:
52*1537cf73SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
53*1537cf73SEmmanuel Vadot    description: |
54*1537cf73SEmmanuel Vadot      Phandle to the "Hardware Voter" (HWV), as named in the vendor
55*1537cf73SEmmanuel Vadot      documentation for MT8196/MT6991.
56*1537cf73SEmmanuel Vadot
57*1537cf73SEmmanuel Vadot      The HWV is a SoC-internal fixed-function MCU used to collect votes from
58*1537cf73SEmmanuel Vadot      both the Application Processor and other remote processors within the SoC.
59*1537cf73SEmmanuel Vadot      It is intended to transparently enable or disable hardware resources (such
60*1537cf73SEmmanuel Vadot      as power domains or clocks) based on internal vote aggregation handled by
61*1537cf73SEmmanuel Vadot      the MCU's internal state machine.
62*1537cf73SEmmanuel Vadot
63*1537cf73SEmmanuel Vadot      However, in practice, this design is incomplete. While the HWV performs
64*1537cf73SEmmanuel Vadot      some internal vote aggregation,software is still required to
65*1537cf73SEmmanuel Vadot      - Manually enable power supplies externally, if present and if required
66*1537cf73SEmmanuel Vadot      - Manually enable parent clocks via direct MMIO writes to clock controllers
67*1537cf73SEmmanuel Vadot      - Enable the FENC after the clock has been ungated via direct MMIO
68*1537cf73SEmmanuel Vadot      writes to clock controllers
69*1537cf73SEmmanuel Vadot
70*1537cf73SEmmanuel Vadot      As such, the HWV behaves more like a hardware-managed clock reference
71*1537cf73SEmmanuel Vadot      counter than a true voter. Furthermore, it is not a separate
72*1537cf73SEmmanuel Vadot      controller. It merely serves as an alternative interface to the same
73*1537cf73SEmmanuel Vadot      underlying clock or power controller. Actual control still requires
74*1537cf73SEmmanuel Vadot      direct access to the controller's own MMIO register space, in
75*1537cf73SEmmanuel Vadot      addition to writing to the HWV's MMIO region.
76*1537cf73SEmmanuel Vadot
77*1537cf73SEmmanuel Vadot      For this reason, a custom phandle is used here - drivers need to directly
78*1537cf73SEmmanuel Vadot      access the HWV MMIO region in a syscon-like fashion, due to how the
79*1537cf73SEmmanuel Vadot      hardware is wired. This differs from true hardware voting systems, which
80*1537cf73SEmmanuel Vadot      typically do not require custom phandles and rely instead on generic APIs
81*1537cf73SEmmanuel Vadot      (clocks, power domains, interconnects).
82*1537cf73SEmmanuel Vadot
83*1537cf73SEmmanuel Vadot      The name "hardware-voter" is retained to match vendor documentation, but
84*1537cf73SEmmanuel Vadot      this should not be reused or misunderstood as a proper voting mechanism.
85*1537cf73SEmmanuel Vadot
86*1537cf73SEmmanuel Vadotrequired:
87*1537cf73SEmmanuel Vadot  - compatible
88*1537cf73SEmmanuel Vadot  - reg
89*1537cf73SEmmanuel Vadot  - '#clock-cells'
90*1537cf73SEmmanuel Vadot
91*1537cf73SEmmanuel VadotadditionalProperties: false
92*1537cf73SEmmanuel Vadot
93*1537cf73SEmmanuel Vadotexamples:
94*1537cf73SEmmanuel Vadot  - |
95*1537cf73SEmmanuel Vadot    apmixedsys_clk: syscon@10000800 {
96*1537cf73SEmmanuel Vadot        compatible = "mediatek,mt8196-apmixedsys", "syscon";
97*1537cf73SEmmanuel Vadot        reg = <0x10000800 0x1000>;
98*1537cf73SEmmanuel Vadot        #clock-cells = <1>;
99*1537cf73SEmmanuel Vadot    };
100*1537cf73SEmmanuel Vadot  - |
101*1537cf73SEmmanuel Vadot    topckgen: syscon@10000000 {
102*1537cf73SEmmanuel Vadot        compatible = "mediatek,mt8196-topckgen", "syscon";
103*1537cf73SEmmanuel Vadot        reg = <0x10000000 0x800>;
104*1537cf73SEmmanuel Vadot        mediatek,hardware-voter = <&scp_hwv>;
105*1537cf73SEmmanuel Vadot        #clock-cells = <1>;
106*1537cf73SEmmanuel Vadot    };
107*1537cf73SEmmanuel Vadot
108