18c2ecf20Sopenharmony_ciBinding for Silicon Labs Si5340, Si5341 Si5342, Si5344 and Si5345 programmable
28c2ecf20Sopenharmony_cii2c clock generator.
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciReference
58c2ecf20Sopenharmony_ci[1] Si5341 Data Sheet
68c2ecf20Sopenharmony_ci    https://www.silabs.com/documents/public/data-sheets/Si5341-40-D-DataSheet.pdf
78c2ecf20Sopenharmony_ci[2] Si5341 Reference Manual
88c2ecf20Sopenharmony_ci    https://www.silabs.com/documents/public/reference-manuals/Si5341-40-D-RM.pdf
98c2ecf20Sopenharmony_ci[3] Si5345 Reference Manual
108c2ecf20Sopenharmony_ci    https://www.silabs.com/documents/public/reference-manuals/Si5345-44-42-D-RM.pdf
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciThe Si5341 and Si5340 are programmable i2c clock generators with up to 10 output
138c2ecf20Sopenharmony_ciclocks. The chip contains a PLL that sources 5 (or 4) multisynth clocks, which
148c2ecf20Sopenharmony_ciin turn can be directed to any of the 10 (or 4) outputs through a divider.
158c2ecf20Sopenharmony_ciThe internal structure of the clock generators can be found in [2].
168c2ecf20Sopenharmony_ciThe Si5345 is similar to the Si5341 with the addition of fractional input
178c2ecf20Sopenharmony_cidividers and automatic input selection, as described in [3].
188c2ecf20Sopenharmony_ciThe Si5342 and Si5344 are smaller versions of the Si5345, with 2 or 4 outputs.
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciThe driver can be used in "as is" mode, reading the current settings from the
218c2ecf20Sopenharmony_cichip at boot, in case you have a (pre-)programmed device. If the PLL is not
228c2ecf20Sopenharmony_ciconfigured when the driver probes, it assumes the driver must fully initialize
238c2ecf20Sopenharmony_ciit.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciThe device type, speed grade and revision are determined runtime by probing.
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciThe driver currently only supports XTAL input mode, and does not support any
288c2ecf20Sopenharmony_cifancy input configurations. They can still be programmed into the chip and
298c2ecf20Sopenharmony_cithe driver will leave them "as is".
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci==I2C device node==
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciRequired properties:
348c2ecf20Sopenharmony_ci- compatible: shall be one of the following:
358c2ecf20Sopenharmony_ci	"silabs,si5340" - Si5340 A/B/C/D
368c2ecf20Sopenharmony_ci	"silabs,si5341" - Si5341 A/B/C/D
378c2ecf20Sopenharmony_ci	"silabs,si5342" - Si5342 A/B/C/D
388c2ecf20Sopenharmony_ci	"silabs,si5344" - Si5344 A/B/C/D
398c2ecf20Sopenharmony_ci	"silabs,si5345" - Si5345 A/B/C/D
408c2ecf20Sopenharmony_ci- reg: i2c device address, usually 0x74
418c2ecf20Sopenharmony_ci- #clock-cells: from common clock binding; shall be set to 2.
428c2ecf20Sopenharmony_ci	The first value is "0" for outputs, "1" for synthesizers.
438c2ecf20Sopenharmony_ci	The second value is the output or synthesizer index.
448c2ecf20Sopenharmony_ci- clocks: from common clock binding; list of parent clock  handles,
458c2ecf20Sopenharmony_ci	corresponding to inputs. Use a fixed clock for the "xtal" input.
468c2ecf20Sopenharmony_ci	At least one must be present.
478c2ecf20Sopenharmony_ci- clock-names: One of: "xtal", "in0", "in1", "in2"
488c2ecf20Sopenharmony_ci- vdd-supply: Regulator node for VDD
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciOptional properties:
518c2ecf20Sopenharmony_ci- vdda-supply: Regulator node for VDDA
528c2ecf20Sopenharmony_ci- vdds-supply: Regulator node for VDDS
538c2ecf20Sopenharmony_ci- silabs,pll-m-num, silabs,pll-m-den: Numerator and denominator for PLL
548c2ecf20Sopenharmony_ci  feedback divider. Must be such that the PLL output is in the valid range. For
558c2ecf20Sopenharmony_ci  example, to create 14GHz from a 48MHz xtal, use m-num=14000 and m-den=48. Only
568c2ecf20Sopenharmony_ci  the fraction matters, using 3500 and 12 will deliver the exact same result.
578c2ecf20Sopenharmony_ci  If these are not specified, and the PLL is not yet programmed when the driver
588c2ecf20Sopenharmony_ci  probes, the PLL will be set to 14GHz.
598c2ecf20Sopenharmony_ci- silabs,reprogram: When present, the driver will always assume the device must
608c2ecf20Sopenharmony_ci  be initialized, and always performs the soft-reset routine. Since this will
618c2ecf20Sopenharmony_ci  temporarily stop all output clocks, don't do this if the chip is generating
628c2ecf20Sopenharmony_ci  the CPU clock for example.
638c2ecf20Sopenharmony_ci- interrupts: Interrupt for INTRb pin.
648c2ecf20Sopenharmony_ci- #address-cells: shall be set to 1.
658c2ecf20Sopenharmony_ci- #size-cells: shall be set to 0.
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci== Child nodes: Outputs ==
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciThe child nodes list the output clocks.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciEach of the clock outputs can be overwritten individually by using a child node.
738c2ecf20Sopenharmony_ciIf a child node for a clock output is not set, the configuration remains
748c2ecf20Sopenharmony_ciunchanged.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ciRequired child node properties:
778c2ecf20Sopenharmony_ci- reg: number of clock output.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciOptional child node properties:
808c2ecf20Sopenharmony_ci- vdd-supply: Regulator node for VDD for this output. The driver selects default
818c2ecf20Sopenharmony_ci	values for common-mode and amplitude based on the voltage.
828c2ecf20Sopenharmony_ci- silabs,format: Output format, one of:
838c2ecf20Sopenharmony_ci	1 = differential (defaults to LVDS levels)
848c2ecf20Sopenharmony_ci	2 = low-power (defaults to HCSL levels)
858c2ecf20Sopenharmony_ci	4 = LVCMOS
868c2ecf20Sopenharmony_ci- silabs,common-mode: Manually override output common mode, see [2] for values
878c2ecf20Sopenharmony_ci- silabs,amplitude: Manually override output amplitude, see [2] for values
888c2ecf20Sopenharmony_ci- silabs,synth-master: boolean. If present, this output is allowed to change the
898c2ecf20Sopenharmony_ci	multisynth frequency dynamically.
908c2ecf20Sopenharmony_ci- silabs,silabs,disable-high: boolean. If set, the clock output is driven HIGH
918c2ecf20Sopenharmony_ci	when disabled, otherwise it's driven LOW.
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci==Example==
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* 48MHz reference crystal */
968c2ecf20Sopenharmony_ciref48: ref48M {
978c2ecf20Sopenharmony_ci	compatible = "fixed-clock";
988c2ecf20Sopenharmony_ci	#clock-cells = <0>;
998c2ecf20Sopenharmony_ci	clock-frequency = <48000000>;
1008c2ecf20Sopenharmony_ci};
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cii2c-master-node {
1038c2ecf20Sopenharmony_ci	/* Programmable clock (for logic) */
1048c2ecf20Sopenharmony_ci	si5341: clock-generator@74 {
1058c2ecf20Sopenharmony_ci		reg = <0x74>;
1068c2ecf20Sopenharmony_ci		compatible = "silabs,si5341";
1078c2ecf20Sopenharmony_ci		#clock-cells = <2>;
1088c2ecf20Sopenharmony_ci		#address-cells = <1>;
1098c2ecf20Sopenharmony_ci		#size-cells = <0>;
1108c2ecf20Sopenharmony_ci		clocks = <&ref48>;
1118c2ecf20Sopenharmony_ci		clock-names = "xtal";
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci		silabs,pll-m-num = <14000>; /* PLL at 14.0 GHz */
1148c2ecf20Sopenharmony_ci		silabs,pll-m-den = <48>;
1158c2ecf20Sopenharmony_ci		silabs,reprogram; /* Chips are not programmed, always reset */
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci		out@0 {
1188c2ecf20Sopenharmony_ci			reg = <0>;
1198c2ecf20Sopenharmony_ci			silabs,format = <1>; /* LVDS 3v3 */
1208c2ecf20Sopenharmony_ci			silabs,common-mode = <3>;
1218c2ecf20Sopenharmony_ci			silabs,amplitude = <3>;
1228c2ecf20Sopenharmony_ci			silabs,synth-master;
1238c2ecf20Sopenharmony_ci		};
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci		/*
1268c2ecf20Sopenharmony_ci		 * Output 6 configuration:
1278c2ecf20Sopenharmony_ci		 *  LVDS 1v8
1288c2ecf20Sopenharmony_ci		 */
1298c2ecf20Sopenharmony_ci		out@6 {
1308c2ecf20Sopenharmony_ci			reg = <6>;
1318c2ecf20Sopenharmony_ci			silabs,format = <1>; /* LVDS 1v8 */
1328c2ecf20Sopenharmony_ci			silabs,common-mode = <13>;
1338c2ecf20Sopenharmony_ci			silabs,amplitude = <3>;
1348c2ecf20Sopenharmony_ci		};
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci		/*
1378c2ecf20Sopenharmony_ci		 * Output 8 configuration:
1388c2ecf20Sopenharmony_ci		 *  HCSL 3v3
1398c2ecf20Sopenharmony_ci		 */
1408c2ecf20Sopenharmony_ci		out@8 {
1418c2ecf20Sopenharmony_ci			reg = <8>;
1428c2ecf20Sopenharmony_ci			silabs,format = <2>;
1438c2ecf20Sopenharmony_ci			silabs,common-mode = <11>;
1448c2ecf20Sopenharmony_ci			silabs,amplitude = <3>;
1458c2ecf20Sopenharmony_ci		};
1468c2ecf20Sopenharmony_ci	};
1478c2ecf20Sopenharmony_ci};
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_cisome-video-node {
1508c2ecf20Sopenharmony_ci	/* Standard clock bindings */
1518c2ecf20Sopenharmony_ci	clock-names = "pixel";
1528c2ecf20Sopenharmony_ci	clocks = <&si5341 0 7>; /* Output 7 */
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	/* Set output 7 to use syntesizer 3 as its parent */
1558c2ecf20Sopenharmony_ci	assigned-clocks = <&si5341 0 7>, <&si5341 1 3>;
1568c2ecf20Sopenharmony_ci	assigned-clock-parents = <&si5341 1 3>;
1578c2ecf20Sopenharmony_ci	/* Set output 7 to 148.5 MHz using a synth frequency of 594 MHz */
1588c2ecf20Sopenharmony_ci	assigned-clock-rates = <148500000>, <594000000>;
1598c2ecf20Sopenharmony_ci};
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_cisome-audio-node {
1628c2ecf20Sopenharmony_ci	clock-names = "i2s-clk";
1638c2ecf20Sopenharmony_ci	clocks = <&si5341 0 0>;
1648c2ecf20Sopenharmony_ci	/*
1658c2ecf20Sopenharmony_ci	 * since output 0 is a synth-master, the synth will be automatically set
1668c2ecf20Sopenharmony_ci	 * to an appropriate frequency when the audio driver requests another
1678c2ecf20Sopenharmony_ci	 * frequency. We give control over synth 2 to this output here.
1688c2ecf20Sopenharmony_ci	 */
1698c2ecf20Sopenharmony_ci	assigned-clocks = <&si5341 0 0>;
1708c2ecf20Sopenharmony_ci	assigned-clock-parents = <&si5341 1 2>;
1718c2ecf20Sopenharmony_ci};
172