18c2ecf20Sopenharmony_ci* Rockchip RK3399 Clock and Reset Unit
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciThe RK3399 clock controller generates and supplies clock to various
48c2ecf20Sopenharmony_cicontrollers within the SoC and also implements a reset controller for SoC
58c2ecf20Sopenharmony_ciperipherals.
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciRequired Properties:
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci- compatible: PMU for CRU should be "rockchip,rk3399-pmucru"
108c2ecf20Sopenharmony_ci- compatible: CRU should be "rockchip,rk3399-cru"
118c2ecf20Sopenharmony_ci- reg: physical base address of the controller and length of memory mapped
128c2ecf20Sopenharmony_ci  region.
138c2ecf20Sopenharmony_ci- #clock-cells: should be 1.
148c2ecf20Sopenharmony_ci- #reset-cells: should be 1.
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciOptional Properties:
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci- rockchip,grf: phandle to the syscon managing the "general register files".
198c2ecf20Sopenharmony_ci  It is used for GRF muxes, if missing any muxes present in the GRF will not
208c2ecf20Sopenharmony_ci  be available.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciEach clock is assigned an identifier and client nodes can use this identifier
238c2ecf20Sopenharmony_cito specify the clock which they consume. All available clocks are defined as
248c2ecf20Sopenharmony_cipreprocessor macros in the dt-bindings/clock/rk3399-cru.h headers and can be
258c2ecf20Sopenharmony_ciused in device tree sources. Similar macros exist for the reset sources in
268c2ecf20Sopenharmony_cithese files.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciExternal clocks:
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciThere are several clocks that are generated outside the SoC. It is expected
318c2ecf20Sopenharmony_cithat they are defined using standard clock bindings with following
328c2ecf20Sopenharmony_ciclock-output-names:
338c2ecf20Sopenharmony_ci - "xin24m" - crystal input - required,
348c2ecf20Sopenharmony_ci - "xin32k" - rtc clock - optional,
358c2ecf20Sopenharmony_ci - "clkin_gmac" - external GMAC clock - optional,
368c2ecf20Sopenharmony_ci - "clkin_i2s" - external I2S clock - optional,
378c2ecf20Sopenharmony_ci - "pclkin_cif" - external ISP clock - optional,
388c2ecf20Sopenharmony_ci - "clk_usbphy0_480m" - output clock of the pll in the usbphy0
398c2ecf20Sopenharmony_ci - "clk_usbphy1_480m" - output clock of the pll in the usbphy1
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciExample: Clock controller node:
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	pmucru: pmu-clock-controller@ff750000 {
448c2ecf20Sopenharmony_ci		compatible = "rockchip,rk3399-pmucru";
458c2ecf20Sopenharmony_ci		reg = <0x0 0xff750000 0x0 0x1000>;
468c2ecf20Sopenharmony_ci		#clock-cells = <1>;
478c2ecf20Sopenharmony_ci		#reset-cells = <1>;
488c2ecf20Sopenharmony_ci	};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	cru: clock-controller@ff760000 {
518c2ecf20Sopenharmony_ci		compatible = "rockchip,rk3399-cru";
528c2ecf20Sopenharmony_ci		reg = <0x0 0xff760000 0x0 0x1000>;
538c2ecf20Sopenharmony_ci		#clock-cells = <1>;
548c2ecf20Sopenharmony_ci		#reset-cells = <1>;
558c2ecf20Sopenharmony_ci	};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciExample: UART controller node that consumes the clock generated by the clock
588c2ecf20Sopenharmony_ci  controller:
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci	uart0: serial@ff1a0000 {
618c2ecf20Sopenharmony_ci		compatible = "rockchip,rk3399-uart", "snps,dw-apb-uart";
628c2ecf20Sopenharmony_ci		reg = <0x0 0xff180000 0x0 0x100>;
638c2ecf20Sopenharmony_ci		clocks = <&cru SCLK_UART0>, <&cru PCLK_UART0>;
648c2ecf20Sopenharmony_ci		clock-names = "baudclk", "apb_pclk";
658c2ecf20Sopenharmony_ci		interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
668c2ecf20Sopenharmony_ci		reg-shift = <2>;
678c2ecf20Sopenharmony_ci		reg-io-width = <4>;
688c2ecf20Sopenharmony_ci	};
69