18c2ecf20Sopenharmony_ci* Clock Block on Freescale QorIQ Platforms
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciFreescale QorIQ chips take primary clocking input from the external
48c2ecf20Sopenharmony_ciSYSCLK signal. The SYSCLK input (frequency) is multiplied using
58c2ecf20Sopenharmony_cimultiple phase locked loops (PLL) to create a variety of frequencies
68c2ecf20Sopenharmony_ciwhich can then be passed to a variety of internal logic, including
78c2ecf20Sopenharmony_cicores and peripheral IP blocks.
88c2ecf20Sopenharmony_ciPlease refer to the Reference Manual for details.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciAll references to "1.0" and "2.0" refer to the QorIQ chassis version to
118c2ecf20Sopenharmony_ciwhich the chip complies.
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciChassis Version		Example Chips
148c2ecf20Sopenharmony_ci---------------		-------------
158c2ecf20Sopenharmony_ci1.0			p4080, p5020, p5040
168c2ecf20Sopenharmony_ci2.0			t4240, b4860
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci1. Clock Block Binding
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciRequired properties:
218c2ecf20Sopenharmony_ci- compatible: Should contain a chip-specific clock block compatible
228c2ecf20Sopenharmony_ci	string and (if applicable) may contain a chassis-version clock
238c2ecf20Sopenharmony_ci	compatible string.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci	Chip-specific strings are of the form "fsl,<chip>-clockgen", such as:
268c2ecf20Sopenharmony_ci	* "fsl,p2041-clockgen"
278c2ecf20Sopenharmony_ci	* "fsl,p3041-clockgen"
288c2ecf20Sopenharmony_ci	* "fsl,p4080-clockgen"
298c2ecf20Sopenharmony_ci	* "fsl,p5020-clockgen"
308c2ecf20Sopenharmony_ci	* "fsl,p5040-clockgen"
318c2ecf20Sopenharmony_ci	* "fsl,t1023-clockgen"
328c2ecf20Sopenharmony_ci	* "fsl,t1024-clockgen"
338c2ecf20Sopenharmony_ci	* "fsl,t1040-clockgen"
348c2ecf20Sopenharmony_ci	* "fsl,t1042-clockgen"
358c2ecf20Sopenharmony_ci	* "fsl,t2080-clockgen"
368c2ecf20Sopenharmony_ci	* "fsl,t2081-clockgen"
378c2ecf20Sopenharmony_ci	* "fsl,t4240-clockgen"
388c2ecf20Sopenharmony_ci	* "fsl,b4420-clockgen"
398c2ecf20Sopenharmony_ci	* "fsl,b4860-clockgen"
408c2ecf20Sopenharmony_ci	* "fsl,ls1012a-clockgen"
418c2ecf20Sopenharmony_ci	* "fsl,ls1021a-clockgen"
428c2ecf20Sopenharmony_ci	* "fsl,ls1028a-clockgen"
438c2ecf20Sopenharmony_ci	* "fsl,ls1043a-clockgen"
448c2ecf20Sopenharmony_ci	* "fsl,ls1046a-clockgen"
458c2ecf20Sopenharmony_ci	* "fsl,ls1088a-clockgen"
468c2ecf20Sopenharmony_ci	* "fsl,ls2080a-clockgen"
478c2ecf20Sopenharmony_ci	Chassis-version clock strings include:
488c2ecf20Sopenharmony_ci	* "fsl,qoriq-clockgen-1.0": for chassis 1.0 clocks
498c2ecf20Sopenharmony_ci	* "fsl,qoriq-clockgen-2.0": for chassis 2.0 clocks
508c2ecf20Sopenharmony_ci- reg: Describes the address of the device's resources within the
518c2ecf20Sopenharmony_ci	address space defined by its parent bus, and resource zero
528c2ecf20Sopenharmony_ci	represents the clock register set
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ciOptional properties:
558c2ecf20Sopenharmony_ci- ranges: Allows valid translation between child's address space and
568c2ecf20Sopenharmony_ci	parent's. Must be present if the device has sub-nodes.
578c2ecf20Sopenharmony_ci- #address-cells: Specifies the number of cells used to represent
588c2ecf20Sopenharmony_ci	physical base addresses.  Must be present if the device has
598c2ecf20Sopenharmony_ci	sub-nodes and set to 1 if present
608c2ecf20Sopenharmony_ci- #size-cells: Specifies the number of cells used to represent
618c2ecf20Sopenharmony_ci	the size of an address. Must be present if the device has
628c2ecf20Sopenharmony_ci	sub-nodes and set to 1 if present
638c2ecf20Sopenharmony_ci- clock-frequency: Input system clock frequency (SYSCLK)
648c2ecf20Sopenharmony_ci- clocks: If clock-frequency is not specified, sysclk may be provided
658c2ecf20Sopenharmony_ci	as an input clock.  Either clock-frequency or clocks must be
668c2ecf20Sopenharmony_ci	provided.
678c2ecf20Sopenharmony_ci	A second input clock, called "coreclk", may be provided if
688c2ecf20Sopenharmony_ci	core PLLs are based on a different input clock from the
698c2ecf20Sopenharmony_ci	platform PLL.
708c2ecf20Sopenharmony_ci- clock-names: Required if a coreclk is present.  Valid names are
718c2ecf20Sopenharmony_ci	"sysclk" and "coreclk".
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci2. Clock Provider
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciThe clockgen node should act as a clock provider, though in older device
768c2ecf20Sopenharmony_citrees the children of the clockgen node are the clock providers.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciWhen the clockgen node is a clock provider, #clock-cells = <2>.
798c2ecf20Sopenharmony_ciThe first cell of the clock specifier is the clock type, and the
808c2ecf20Sopenharmony_cisecond cell is the clock index for the specified type.
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci	Type#	Name		Index Cell
838c2ecf20Sopenharmony_ci	0	sysclk		must be 0
848c2ecf20Sopenharmony_ci	1	cmux		index (n in CLKCnCSR)
858c2ecf20Sopenharmony_ci	2	hwaccel		index (n in CLKCGnHWACSR)
868c2ecf20Sopenharmony_ci	3	fman		0 for fm1, 1 for fm2
878c2ecf20Sopenharmony_ci	4	platform pll	n=pll/(n+1). For example, when n=1,
888c2ecf20Sopenharmony_ci				that means output_freq=PLL_freq/2.
898c2ecf20Sopenharmony_ci	5	coreclk		must be 0
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci3. Example
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	clockgen: global-utilities@e1000 {
948c2ecf20Sopenharmony_ci		compatible = "fsl,p5020-clockgen", "fsl,qoriq-clockgen-1.0";
958c2ecf20Sopenharmony_ci		clock-frequency = <133333333>;
968c2ecf20Sopenharmony_ci		reg = <0xe1000 0x1000>;
978c2ecf20Sopenharmony_ci		#clock-cells = <2>;
988c2ecf20Sopenharmony_ci	};
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	fman@400000 {
1018c2ecf20Sopenharmony_ci		...
1028c2ecf20Sopenharmony_ci		clocks = <&clockgen 3 0>;
1038c2ecf20Sopenharmony_ci		...
1048c2ecf20Sopenharmony_ci	};
1058c2ecf20Sopenharmony_ci}
1068c2ecf20Sopenharmony_ci4. Legacy Child Nodes
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ciNOTE: These nodes are deprecated.  Kernels should continue to support
1098c2ecf20Sopenharmony_cidevice trees with these nodes, but new device trees should not use them.
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ciMost of the bindings are from the common clock binding[1].
1128c2ecf20Sopenharmony_ci [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ciRequired properties:
1158c2ecf20Sopenharmony_ci- compatible : Should include one of the following:
1168c2ecf20Sopenharmony_ci	* "fsl,qoriq-core-pll-1.0" for core PLL clocks (v1.0)
1178c2ecf20Sopenharmony_ci	* "fsl,qoriq-core-pll-2.0" for core PLL clocks (v2.0)
1188c2ecf20Sopenharmony_ci	* "fsl,qoriq-core-mux-1.0" for core mux clocks (v1.0)
1198c2ecf20Sopenharmony_ci	* "fsl,qoriq-core-mux-2.0" for core mux clocks (v2.0)
1208c2ecf20Sopenharmony_ci	* "fsl,qoriq-sysclk-1.0": for input system clock (v1.0).
1218c2ecf20Sopenharmony_ci		It takes parent's clock-frequency as its clock.
1228c2ecf20Sopenharmony_ci	* "fsl,qoriq-sysclk-2.0": for input system clock (v2.0).
1238c2ecf20Sopenharmony_ci		It takes parent's clock-frequency as its clock.
1248c2ecf20Sopenharmony_ci	* "fsl,qoriq-platform-pll-1.0" for the platform PLL clock (v1.0)
1258c2ecf20Sopenharmony_ci	* "fsl,qoriq-platform-pll-2.0" for the platform PLL clock (v2.0)
1268c2ecf20Sopenharmony_ci- #clock-cells: From common clock binding. The number of cells in a
1278c2ecf20Sopenharmony_ci	clock-specifier. Should be <0> for "fsl,qoriq-sysclk-[1,2].0"
1288c2ecf20Sopenharmony_ci	clocks, or <1> for "fsl,qoriq-core-pll-[1,2].0" clocks.
1298c2ecf20Sopenharmony_ci	For "fsl,qoriq-core-pll-[1,2].0" clocks, the single
1308c2ecf20Sopenharmony_ci	clock-specifier cell may take the following values:
1318c2ecf20Sopenharmony_ci	* 0 - equal to the PLL frequency
1328c2ecf20Sopenharmony_ci	* 1 - equal to the PLL frequency divided by 2
1338c2ecf20Sopenharmony_ci	* 2 - equal to the PLL frequency divided by 4
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ciRecommended properties:
1368c2ecf20Sopenharmony_ci- clocks: Should be the phandle of input parent clock
1378c2ecf20Sopenharmony_ci- clock-names: From common clock binding, indicates the clock name
1388c2ecf20Sopenharmony_ci- clock-output-names: From common clock binding, indicates the names of
1398c2ecf20Sopenharmony_ci	output clocks
1408c2ecf20Sopenharmony_ci- reg: Should be the offset and length of clock block base address.
1418c2ecf20Sopenharmony_ci	The length should be 4.
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ciLegacy Example:
1448c2ecf20Sopenharmony_ci/ {
1458c2ecf20Sopenharmony_ci	clockgen: global-utilities@e1000 {
1468c2ecf20Sopenharmony_ci		compatible = "fsl,p5020-clockgen", "fsl,qoriq-clockgen-1.0";
1478c2ecf20Sopenharmony_ci		ranges = <0x0 0xe1000 0x1000>;
1488c2ecf20Sopenharmony_ci		clock-frequency = <133333333>;
1498c2ecf20Sopenharmony_ci		reg = <0xe1000 0x1000>;
1508c2ecf20Sopenharmony_ci		#address-cells = <1>;
1518c2ecf20Sopenharmony_ci		#size-cells = <1>;
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci		sysclk: sysclk {
1548c2ecf20Sopenharmony_ci			#clock-cells = <0>;
1558c2ecf20Sopenharmony_ci			compatible = "fsl,qoriq-sysclk-1.0";
1568c2ecf20Sopenharmony_ci			clock-output-names = "sysclk";
1578c2ecf20Sopenharmony_ci		};
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci		pll0: pll0@800 {
1608c2ecf20Sopenharmony_ci			#clock-cells = <1>;
1618c2ecf20Sopenharmony_ci			reg = <0x800 0x4>;
1628c2ecf20Sopenharmony_ci			compatible = "fsl,qoriq-core-pll-1.0";
1638c2ecf20Sopenharmony_ci			clocks = <&sysclk>;
1648c2ecf20Sopenharmony_ci			clock-output-names = "pll0", "pll0-div2";
1658c2ecf20Sopenharmony_ci		};
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci		pll1: pll1@820 {
1688c2ecf20Sopenharmony_ci			#clock-cells = <1>;
1698c2ecf20Sopenharmony_ci			reg = <0x820 0x4>;
1708c2ecf20Sopenharmony_ci			compatible = "fsl,qoriq-core-pll-1.0";
1718c2ecf20Sopenharmony_ci			clocks = <&sysclk>;
1728c2ecf20Sopenharmony_ci			clock-output-names = "pll1", "pll1-div2";
1738c2ecf20Sopenharmony_ci		};
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci		mux0: mux0@0 {
1768c2ecf20Sopenharmony_ci			#clock-cells = <0>;
1778c2ecf20Sopenharmony_ci			reg = <0x0 0x4>;
1788c2ecf20Sopenharmony_ci			compatible = "fsl,qoriq-core-mux-1.0";
1798c2ecf20Sopenharmony_ci			clocks = <&pll0 0>, <&pll0 1>, <&pll1 0>, <&pll1 1>;
1808c2ecf20Sopenharmony_ci			clock-names = "pll0", "pll0-div2", "pll1", "pll1-div2";
1818c2ecf20Sopenharmony_ci			clock-output-names = "cmux0";
1828c2ecf20Sopenharmony_ci		};
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci		mux1: mux1@20 {
1858c2ecf20Sopenharmony_ci			#clock-cells = <0>;
1868c2ecf20Sopenharmony_ci			reg = <0x20 0x4>;
1878c2ecf20Sopenharmony_ci			compatible = "fsl,qoriq-core-mux-1.0";
1888c2ecf20Sopenharmony_ci			clocks = <&pll0 0>, <&pll0 1>, <&pll1 0>, <&pll1 1>;
1898c2ecf20Sopenharmony_ci			clock-names = "pll0", "pll0-div2", "pll1", "pll1-div2";
1908c2ecf20Sopenharmony_ci			clock-output-names = "cmux1";
1918c2ecf20Sopenharmony_ci		};
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci		platform-pll: platform-pll@c00 {
1948c2ecf20Sopenharmony_ci			#clock-cells = <1>;
1958c2ecf20Sopenharmony_ci			reg = <0xc00 0x4>;
1968c2ecf20Sopenharmony_ci			compatible = "fsl,qoriq-platform-pll-1.0";
1978c2ecf20Sopenharmony_ci			clocks = <&sysclk>;
1988c2ecf20Sopenharmony_ci			clock-output-names = "platform-pll", "platform-pll-div2";
1998c2ecf20Sopenharmony_ci		};
2008c2ecf20Sopenharmony_ci	};
2018c2ecf20Sopenharmony_ci};
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ciExample for legacy clock consumer:
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci/ {
2068c2ecf20Sopenharmony_ci	cpu0: PowerPC,e5500@0 {
2078c2ecf20Sopenharmony_ci		...
2088c2ecf20Sopenharmony_ci		clocks = <&mux0>;
2098c2ecf20Sopenharmony_ci		...
2108c2ecf20Sopenharmony_ci	};
2118c2ecf20Sopenharmony_ci};
212