18c2ecf20Sopenharmony_ciImagination Technologies Pistachio SoC clock controllers
28c2ecf20Sopenharmony_ci========================================================
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciPistachio has four clock controllers (core clock, peripheral clock, peripheral
58c2ecf20Sopenharmony_cigeneral control, and top general control) which are instantiated individually
68c2ecf20Sopenharmony_cifrom the device-tree.
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciExternal clocks:
98c2ecf20Sopenharmony_ci----------------
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciThere are three external inputs to the clock controllers which should be
128c2ecf20Sopenharmony_cidefined with the following clock-output-names:
138c2ecf20Sopenharmony_ci- "xtal": External 52Mhz oscillator (required)
148c2ecf20Sopenharmony_ci- "audio_clk_in": Alternate audio reference clock (optional)
158c2ecf20Sopenharmony_ci- "enet_clk_in": Alternate ethernet PHY clock (optional)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciCore clock controller:
188c2ecf20Sopenharmony_ci----------------------
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciThe core clock controller generates clocks for the CPU, RPU (WiFi + BT
218c2ecf20Sopenharmony_cico-processor), audio, and several peripherals.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ciRequired properties:
248c2ecf20Sopenharmony_ci- compatible: Must be "img,pistachio-clk".
258c2ecf20Sopenharmony_ci- reg: Must contain the base address and length of the core clock controller.
268c2ecf20Sopenharmony_ci- #clock-cells: Must be 1.  The single cell is the clock identifier.
278c2ecf20Sopenharmony_ci  See dt-bindings/clock/pistachio-clk.h for the list of valid identifiers.
288c2ecf20Sopenharmony_ci- clocks: Must contain an entry for each clock in clock-names.
298c2ecf20Sopenharmony_ci- clock-names: Must include "xtal" (see "External clocks") and
308c2ecf20Sopenharmony_ci  "audio_clk_in_gate", "enet_clk_in_gate" which are generated by the
318c2ecf20Sopenharmony_ci  top-level general control.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciExample:
348c2ecf20Sopenharmony_ci	clk_core: clock-controller@18144000 {
358c2ecf20Sopenharmony_ci		compatible = "img,pistachio-clk";
368c2ecf20Sopenharmony_ci		reg = <0x18144000 0x800>;
378c2ecf20Sopenharmony_ci		clocks = <&xtal>, <&cr_top EXT_CLK_AUDIO_IN>,
388c2ecf20Sopenharmony_ci			 <&cr_top EXT_CLK_ENET_IN>;
398c2ecf20Sopenharmony_ci		clock-names = "xtal", "audio_clk_in_gate", "enet_clk_in_gate";
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci		#clock-cells = <1>;
428c2ecf20Sopenharmony_ci	};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciPeripheral clock controller:
458c2ecf20Sopenharmony_ci----------------------------
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciThe peripheral clock controller generates clocks for the DDR, ROM, and other
488c2ecf20Sopenharmony_ciperipherals.  The peripheral system clock ("periph_sys") generated by the core
498c2ecf20Sopenharmony_ciclock controller is the input clock to the peripheral clock controller.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciRequired properties:
528c2ecf20Sopenharmony_ci- compatible: Must be "img,pistachio-periph-clk".
538c2ecf20Sopenharmony_ci- reg: Must contain the base address and length of the peripheral clock
548c2ecf20Sopenharmony_ci  controller.
558c2ecf20Sopenharmony_ci- #clock-cells: Must be 1.  The single cell is the clock identifier.
568c2ecf20Sopenharmony_ci  See dt-bindings/clock/pistachio-clk.h for the list of valid identifiers.
578c2ecf20Sopenharmony_ci- clocks: Must contain an entry for each clock in clock-names.
588c2ecf20Sopenharmony_ci- clock-names: Must include "periph_sys", the peripheral system clock generated
598c2ecf20Sopenharmony_ci  by the core clock controller.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciExample:
628c2ecf20Sopenharmony_ci	clk_periph: clock-controller@18144800 {
638c2ecf20Sopenharmony_ci		compatible = "img,pistachio-clk-periph";
648c2ecf20Sopenharmony_ci		reg = <0x18144800 0x800>;
658c2ecf20Sopenharmony_ci		clocks = <&clk_core CLK_PERIPH_SYS>;
668c2ecf20Sopenharmony_ci		clock-names = "periph_sys";
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci		#clock-cells = <1>;
698c2ecf20Sopenharmony_ci	};
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciPeripheral general control:
728c2ecf20Sopenharmony_ci---------------------------
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ciThe peripheral general control block generates system interface clocks and
758c2ecf20Sopenharmony_ciresets for various peripherals.  It also contains miscellaneous peripheral
768c2ecf20Sopenharmony_cicontrol registers.  The system clock ("sys") generated by the peripheral clock
778c2ecf20Sopenharmony_cicontroller is the input clock to the system clock controller.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciRequired properties:
808c2ecf20Sopenharmony_ci- compatible: Must include "img,pistachio-periph-cr" and "syscon".
818c2ecf20Sopenharmony_ci- reg: Must contain the base address and length of the peripheral general
828c2ecf20Sopenharmony_ci  control registers.
838c2ecf20Sopenharmony_ci- #clock-cells: Must be 1.  The single cell is the clock identifier.
848c2ecf20Sopenharmony_ci  See dt-bindings/clock/pistachio-clk.h for the list of valid identifiers.
858c2ecf20Sopenharmony_ci- clocks: Must contain an entry for each clock in clock-names.
868c2ecf20Sopenharmony_ci- clock-names: Must include "sys", the system clock generated by the peripheral
878c2ecf20Sopenharmony_ci  clock controller.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciExample:
908c2ecf20Sopenharmony_ci	cr_periph: syscon@18144800 {
918c2ecf20Sopenharmony_ci		compatible = "img,pistachio-cr-periph", "syscon";
928c2ecf20Sopenharmony_ci		reg = <0x18148000 0x1000>;
938c2ecf20Sopenharmony_ci		clocks = <&clock_periph PERIPH_CLK_PERIPH_SYS>;
948c2ecf20Sopenharmony_ci		clock-names = "sys";
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci		#clock-cells = <1>;
978c2ecf20Sopenharmony_ci	};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ciTop-level general control:
1008c2ecf20Sopenharmony_ci--------------------------
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciThe top-level general control block contains miscellaneous control registers and
1038c2ecf20Sopenharmony_cigates for the external clocks "audio_clk_in" and "enet_clk_in".
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciRequired properties:
1068c2ecf20Sopenharmony_ci- compatible: Must include "img,pistachio-cr-top" and "syscon".
1078c2ecf20Sopenharmony_ci- reg: Must contain the base address and length of the top-level
1088c2ecf20Sopenharmony_ci  control registers.
1098c2ecf20Sopenharmony_ci- clocks: Must contain an entry for each clock in clock-names.
1108c2ecf20Sopenharmony_ci- clock-names: Two optional clocks, "audio_clk_in" and "enet_clk_in" (see
1118c2ecf20Sopenharmony_ci  "External clocks").
1128c2ecf20Sopenharmony_ci- #clock-cells: Must be 1.  The single cell is the clock identifier.
1138c2ecf20Sopenharmony_ci  See dt-bindings/clock/pistachio-clk.h for the list of valid identifiers.
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ciExample:
1168c2ecf20Sopenharmony_ci	cr_top: syscon@18144800 {
1178c2ecf20Sopenharmony_ci		compatible = "img,pistachio-cr-top", "syscon";
1188c2ecf20Sopenharmony_ci		reg = <0x18149000 0x200>;
1198c2ecf20Sopenharmony_ci		clocks = <&audio_refclk>, <&ext_enet_in>;
1208c2ecf20Sopenharmony_ci		clock-names = "audio_clk_in", "enet_clk_in";
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci		#clock-cells = <1>;
1238c2ecf20Sopenharmony_ci	};
124