18c2ecf20Sopenharmony_ciMediaTek T-PHY binding
28c2ecf20Sopenharmony_ci--------------------------
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciT-phy controller supports physical layer functionality for a number of
58c2ecf20Sopenharmony_cicontrollers on MediaTek SoCs, such as, USB2.0, USB3.0, PCIe, and SATA.
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciRequired properties (controller (parent) node):
88c2ecf20Sopenharmony_ci - compatible	: should be one of
98c2ecf20Sopenharmony_ci		  "mediatek,generic-tphy-v1"
108c2ecf20Sopenharmony_ci		  "mediatek,generic-tphy-v2"
118c2ecf20Sopenharmony_ci		  "mediatek,mt2701-u3phy" (deprecated)
128c2ecf20Sopenharmony_ci		  "mediatek,mt2712-u3phy" (deprecated)
138c2ecf20Sopenharmony_ci		  "mediatek,mt8173-u3phy";
148c2ecf20Sopenharmony_ci		  make use of "mediatek,generic-tphy-v1" on mt2701 instead and
158c2ecf20Sopenharmony_ci		  "mediatek,generic-tphy-v2" on mt2712 instead.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci- #address-cells:	the number of cells used to represent physical
188c2ecf20Sopenharmony_ci		base addresses.
198c2ecf20Sopenharmony_ci- #size-cells:	the number of cells used to represent the size of an address.
208c2ecf20Sopenharmony_ci- ranges:	the address mapping relationship to the parent, defined with
218c2ecf20Sopenharmony_ci		- empty value: if optional 'reg' is used.
228c2ecf20Sopenharmony_ci		- non-empty value: if optional 'reg' is not used. should set
238c2ecf20Sopenharmony_ci			the child's base address to 0, the physical address
248c2ecf20Sopenharmony_ci			within parent's address space, and the length of
258c2ecf20Sopenharmony_ci			the address map.
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciRequired nodes	: a sub-node is required for each port the controller
288c2ecf20Sopenharmony_ci		  provides. Address range information including the usual
298c2ecf20Sopenharmony_ci		  'reg' property is used inside these nodes to describe
308c2ecf20Sopenharmony_ci		  the controller's topology.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciOptional properties (controller (parent) node):
338c2ecf20Sopenharmony_ci - reg		: offset and length of register shared by multiple ports,
348c2ecf20Sopenharmony_ci		  exclude port's private register. It is needed on mt2701
358c2ecf20Sopenharmony_ci		  and mt8173, but not on mt2712.
368c2ecf20Sopenharmony_ci - mediatek,src-ref-clk-mhz	: frequency of reference clock for slew rate
378c2ecf20Sopenharmony_ci		  calibrate
388c2ecf20Sopenharmony_ci - mediatek,src-coef	: coefficient for slew rate calibrate, depends on
398c2ecf20Sopenharmony_ci		  SoC process
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciRequired properties (port (child) node):
428c2ecf20Sopenharmony_ci- reg		: address and length of the register set for the port.
438c2ecf20Sopenharmony_ci- #phy-cells	: should be 1 (See second example)
448c2ecf20Sopenharmony_ci		  cell after port phandle is phy type from:
458c2ecf20Sopenharmony_ci			- PHY_TYPE_USB2
468c2ecf20Sopenharmony_ci			- PHY_TYPE_USB3
478c2ecf20Sopenharmony_ci			- PHY_TYPE_PCIE
488c2ecf20Sopenharmony_ci			- PHY_TYPE_SATA
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciOptional properties (PHY_TYPE_USB2 port (child) node):
518c2ecf20Sopenharmony_ci- clocks	: a list of phandle + clock-specifier pairs, one for each
528c2ecf20Sopenharmony_ci		  entry in clock-names
538c2ecf20Sopenharmony_ci- clock-names	: may contain
548c2ecf20Sopenharmony_ci		  "ref": 48M reference clock for HighSpeed (digital) phy; and 26M
558c2ecf20Sopenharmony_ci			reference clock for SuperSpeed (digital) phy, sometimes is
568c2ecf20Sopenharmony_ci			24M, 25M or 27M, depended on platform.
578c2ecf20Sopenharmony_ci		  "da_ref": the reference clock of analog phy, used if the clocks
588c2ecf20Sopenharmony_ci			of analog and digital phys are separated, otherwise uses
598c2ecf20Sopenharmony_ci			"ref" clock only if needed.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci- mediatek,eye-src	: u32, the value of slew rate calibrate
628c2ecf20Sopenharmony_ci- mediatek,eye-vrt	: u32, the selection of VRT reference voltage
638c2ecf20Sopenharmony_ci- mediatek,eye-term	: u32, the selection of HS_TX TERM reference voltage
648c2ecf20Sopenharmony_ci- mediatek,bc12	: bool, enable BC12 of u2phy if support it
658c2ecf20Sopenharmony_ci- mediatek,discth	: u32, the selection of disconnect threshold
668c2ecf20Sopenharmony_ci- mediatek,intr	: u32, the selection of internal R (resistance)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciExample:
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciu3phy: usb-phy@11290000 {
718c2ecf20Sopenharmony_ci	compatible = "mediatek,mt8173-u3phy";
728c2ecf20Sopenharmony_ci	reg = <0 0x11290000 0 0x800>;
738c2ecf20Sopenharmony_ci	#address-cells = <2>;
748c2ecf20Sopenharmony_ci	#size-cells = <2>;
758c2ecf20Sopenharmony_ci	ranges;
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	u2port0: usb-phy@11290800 {
788c2ecf20Sopenharmony_ci		reg = <0 0x11290800 0 0x100>;
798c2ecf20Sopenharmony_ci		clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
808c2ecf20Sopenharmony_ci		clock-names = "ref";
818c2ecf20Sopenharmony_ci		#phy-cells = <1>;
828c2ecf20Sopenharmony_ci	};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci	u3port0: usb-phy@11290900 {
858c2ecf20Sopenharmony_ci		reg = <0 0x11290800 0 0x700>;
868c2ecf20Sopenharmony_ci		clocks = <&clk26m>;
878c2ecf20Sopenharmony_ci		clock-names = "ref";
888c2ecf20Sopenharmony_ci		#phy-cells = <1>;
898c2ecf20Sopenharmony_ci	};
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	u2port1: usb-phy@11291000 {
928c2ecf20Sopenharmony_ci		reg = <0 0x11291000 0 0x100>;
938c2ecf20Sopenharmony_ci		clocks = <&apmixedsys CLK_APMIXED_REF2USB_TX>;
948c2ecf20Sopenharmony_ci		clock-names = "ref";
958c2ecf20Sopenharmony_ci		#phy-cells = <1>;
968c2ecf20Sopenharmony_ci	};
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ciSpecifying phy control of devices
1008c2ecf20Sopenharmony_ci---------------------------------
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciDevice nodes should specify the configuration required in their "phys"
1038c2ecf20Sopenharmony_ciproperty, containing a phandle to the phy port node and a device type;
1048c2ecf20Sopenharmony_ciphy-names for each port are optional.
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciExample:
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#include <dt-bindings/phy/phy.h>
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciusb30: usb@11270000 {
1118c2ecf20Sopenharmony_ci	...
1128c2ecf20Sopenharmony_ci	phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>;
1138c2ecf20Sopenharmony_ci	phy-names = "usb2-0", "usb3-0";
1148c2ecf20Sopenharmony_ci	...
1158c2ecf20Sopenharmony_ci};
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ciLayout differences of banks between mt8173/mt2701 and mt2712
1198c2ecf20Sopenharmony_ci-------------------------------------------------------------
1208c2ecf20Sopenharmony_cimt8173 and mt2701:
1218c2ecf20Sopenharmony_ciport        offset    bank
1228c2ecf20Sopenharmony_cishared      0x0000    SPLLC
1238c2ecf20Sopenharmony_ci            0x0100    FMREG
1248c2ecf20Sopenharmony_ciu2 port0    0x0800    U2PHY_COM
1258c2ecf20Sopenharmony_ciu3 port0    0x0900    U3PHYD
1268c2ecf20Sopenharmony_ci            0x0a00    U3PHYD_BANK2
1278c2ecf20Sopenharmony_ci            0x0b00    U3PHYA
1288c2ecf20Sopenharmony_ci            0x0c00    U3PHYA_DA
1298c2ecf20Sopenharmony_ciu2 port1    0x1000    U2PHY_COM
1308c2ecf20Sopenharmony_ciu3 port1    0x1100    U3PHYD
1318c2ecf20Sopenharmony_ci            0x1200    U3PHYD_BANK2
1328c2ecf20Sopenharmony_ci            0x1300    U3PHYA
1338c2ecf20Sopenharmony_ci            0x1400    U3PHYA_DA
1348c2ecf20Sopenharmony_ciu2 port2    0x1800    U2PHY_COM
1358c2ecf20Sopenharmony_ci            ...
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_cimt2712:
1388c2ecf20Sopenharmony_ciport        offset    bank
1398c2ecf20Sopenharmony_ciu2 port0    0x0000    MISC
1408c2ecf20Sopenharmony_ci            0x0100    FMREG
1418c2ecf20Sopenharmony_ci            0x0300    U2PHY_COM
1428c2ecf20Sopenharmony_ciu3 port0    0x0700    SPLLC
1438c2ecf20Sopenharmony_ci            0x0800    CHIP
1448c2ecf20Sopenharmony_ci            0x0900    U3PHYD
1458c2ecf20Sopenharmony_ci            0x0a00    U3PHYD_BANK2
1468c2ecf20Sopenharmony_ci            0x0b00    U3PHYA
1478c2ecf20Sopenharmony_ci            0x0c00    U3PHYA_DA
1488c2ecf20Sopenharmony_ciu2 port1    0x1000    MISC
1498c2ecf20Sopenharmony_ci            0x1100    FMREG
1508c2ecf20Sopenharmony_ci            0x1300    U2PHY_COM
1518c2ecf20Sopenharmony_ciu3 port1    0x1700    SPLLC
1528c2ecf20Sopenharmony_ci            0x1800    CHIP
1538c2ecf20Sopenharmony_ci            0x1900    U3PHYD
1548c2ecf20Sopenharmony_ci            0x1a00    U3PHYD_BANK2
1558c2ecf20Sopenharmony_ci            0x1b00    U3PHYA
1568c2ecf20Sopenharmony_ci            0x1c00    U3PHYA_DA
1578c2ecf20Sopenharmony_ciu2 port2    0x2000    MISC
1588c2ecf20Sopenharmony_ci            ...
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci    SPLLC shared by u3 ports and FMREG shared by u2 ports on
1618c2ecf20Sopenharmony_cimt8173/mt2701 are put back into each port; a new bank MISC for
1628c2ecf20Sopenharmony_ciu2 ports and CHIP for u3 ports are added on mt2712.
163