Marvell EBU Comphy binding
==========================

This binding describes a Comphy device that is used to control
and configure comphy hardware on Marvell SoCs.

Each Comphy device has several PHYs which can be configured
to support various modes:
SATA, USB, PCIE, Network modes, etc.

Required properties for comphy node:
	- compatible:		Should be "marvell,cp110-comphy"
	- reg:			Address and length of register sets
				for each device in "reg-names"
	- reg-names:		The names of the register addresses
				corresponding to the registers filled in "reg".
	- #phy-cells:		Standard property (Documentation: phy-bindings.txt)
				Should be 2.
	- dfx-reg:		Address and length of DFX register which is needed when PCIe
				COMPHY initialization on CP110. It is optional, and should not
				be modified if it exist.
	- sar-data:		The phandle to Sample At Reset(SAR), which is needed when PCIe
				COMPHY initialization on CP110. It is optional, and should not
				be modified if it exist.
	- skip_pcie_power_off:	This flag allows us to skip all pcie lanes shutdowns if needed.
				e.g in case using PCIe as End point, thus link must be always kept alive.
				It is optional property.
	Example will be provided in the end of this file.

Each device using Comphy should have handle with the following properties:
	- Handle to the Comphy node.
	- Comphy index (SerDes lane number).
	- Required Comphy description.
	  There are 2 options to describe the COMPHY settings.
	  1. Simplified description (default speed & invert settings)
	     With this approach, comphy settings are selected by a single definition
	     which describes the COMPHY type and the unit index. This description
	     configures default speed and no polarity invert for COMPHY lane.
	     Default speed is for COMPHYs with configurable speed, such as SGMII - 1Gbps/2.5Gbps
	     - Simplified usage options:
				- COMPHY_SATA0 COMPHY_SATA1
				- COMPHY_SGMII0 COMPHY_SGMII1 COMPHY_SGMII2
				- COMPHY_HS_SGMII0 COMPHY_HS_SGMII1 COMPHY_HS_SGMII2
				- COMPHY_USB3H0 COMPHY_USB3H1
				- COMPHY_USB3D0
				- COMPHY_PCIE0 COMPHY_PCIE1 COMPHY_PCIE2 COMPHY_PCIE3
				- COMPHY_RXAUI0 COMPHY_RXAUI1
				- COMPHY_XFI
				- COMPHY_SFI
				- COMPHY_USB3
	  2. Complex description (for specific speed and/or polarity invert settings)
	     With this approach, comphy settings are selected by the macro COMPHY_DEF,
	     which defines comphy mode, unit index, comphy speed, and comphy RX/TX invert settings.
	     - COMPHY_DEF definition:
		COMPHY_DEF(COMPHY_MODE, COMPHY_ID, COMPHY_SPEED, COMPHY_INVERT)
			COMPHY_MODE:
				- COMPHY_SATA_MODE
				- COMPHY_SGMII_MODE
				- COMPHY_USB3H_MODE
				- COMPHY_USB3D_MODE
				- COMPHY_PCIE_MODE
				- COMPHY_RXAUI_MODE
				- COMPHY_XFI_MODE
				- COMPHY_SFI_MODE
				- COMPHY_USB3_MODE
			COMPHY_UNIT_ID: unit index
				- relevant to following interfaces, SATA, USB, RXAUI, SGMII and PCIE.
				- SATA/USB/RXAUI: 0/1
				- SGMII/PCIE: 0/1/2
			COMPHY_SPEED:
				- COMPHY_SPEED_DEFAULT: for COMPHY type uses fixed speed
				- COMPHY_SPEED_1_25: for SMGII works at 1Gbps
				- COMPHY_SPEED_3_125: for SMGII works at 2.5Gbps
				- COMPHY_SPEED_5_15625G for sfi/xfi works at 5Gbps
				- COMPHY_SPEED_10_3125G for sfi/xfi works at 10Gbps
			COMPHY_INVERT: polarity invert
				- COMPHY_POLARITY_NO_INVERT:  there is no polarity inverted
				- COMPHY_POLARITY_TXD_INVERT: there is TX polarity inverted
				- COMPHY_POLARITY_RXD_INVERT: there is RX polarity inverted
				- COMPHY_POLARITY_ALL_INVERT: there are both TX and RX polarity inverted
	Example will be provided in the end of this file.

Example:
Comphy Node:
============
	comphy0: comphy {
		compatible = "marvell,cp110-comphy";
		reg = <0x441000 0x100>, <0x120000 0x6000>;
		reg-names = "comphy", "serdes";
		dfx-reg = <0x400280 4>;
		#phy-cells = <2>;
		sar-data = <&cpm_sar>;
		skip_pcie_power_off; /* skip power off at pcie lanes*/
		status = "okay";
	};

	comphy1: comphy {
		compatible = "marvell,cp110-comphy";
		reg = <0x441000 0x100>, <0x120000 0x6000>;
		reg-names = "comphy", "serdes";
		dfx-reg = <0x400280 4>;
		#phy-cells = <2>;
		sar-data = <&cps_sar>;
		status = "okay";
	};

	a3700_comphy: comphy@18300 {
			compatible = "marvell,mvebu-comphy", "marvell,armada-3700-comphy";
			reg = <0x18300 0x300>, /* comphy */
			      <0x1F000 0x1000>, /* serdes */
			      <0x5c000 0x1000>, /* usb3_gbe1 phy reg */
			      <0xe0178 0x8>; /* lane2 indirect access */
			reg-names = "comphy", "serdes", "usb3_gbe1_phy", "indirect";
			#phy-cells = <2>;
			status = "okay";
	};

Comphy consumer:
===============
	(1) The example with simplified option of comphy description:
		sata@540000 {
			phys = <&comphy0 4 COMPHY_SATA0>
			status = "okay";
		};

		Explain for above sata example:
		- phy handler is comphy0
		- the sata interface uses lane 4 of comphy
		- COMPHY description:
			- the comphy works at SATA mode
			- the unit index of the sata interface is 0
			- the speed is default
			- the invert is also default without polarity inverted

		sata@e0000 {
				status = "okay";
				phys = <&a3700_comphy 2 COMPHY_SATA0>;
		};

	(2) Examples with complex option of comphy description:
		(2.1)	emac2: mac2 {
				phys = <&comphy0 0 COMPHY_DEF(COMPHY_SGMII_MODE,
							      COMPHY_UNIT_ID1,
							      COMPHY_SPEED_1_25G,
							      COMPHY_POLARITY_RXD_INVERT)>;
				phy-names = "comphy";
			};

			Explain for above SGMII example:
			- phy handler is comphy0
			- the SGMII interface uses lane 0 of comphy
			- COMPHY description:
				- the comphy works at SGMII mode
				- the unit index of the sata interface is 1
				- the comphy speed is 1.25G (network speed is 1Gbps)
				- the comphy has rx polarity inverted

		(2.2)	emac0_1: mac0 {
				phy-mode = "sfi";
		                phys = <&comphy0 2 COMPHY_DEF(COMPHY_SFI_MODE,
							      COMPHY_UNIT_ID0,
							      COMPHY_SPEED_10_3125G,
							      COMPHY_POLARITY_NO_INVERT)>;
				phy-names = "comphy";
			};

			Explain for above SFI example:
			- phy handler is comphy0
			- the SFI interface uses lane 2 of comphy
			- COMPHY description:
				- the comphy works at SFI mode
				- the unit index of the sata interface is 0
				- the speed is 10.3125G (network speed is 10Gbps)
				- the comphy has no polarity invertion


