Skip to contentSkip to conversation

phy: marvell: cp110: varius comphy updates

PATCH New igall at marvell.com 2 participants 28 messages Apr 24, 2017 – May 9, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover phy: marvell: cp110: varius comphy updates

From: Igal Liberman <[email protected]>

This patchset improves Marvell A70x0/80x0 comphy driver:
- Improve comphy electrical parameters
- New modes
- Style
- Bug fixes

v1 --> v2:
- update commit messages
- remove change-id
Igal Liberman (5):
fix: phy: marvell: cp110: sata: update analog parameters according to
latest ETP
phy: marvell: cp110: add 5G XFI mode
fix: phy: marvell: cp110: sfi: update analog parameters according to
latest ETP
fix: phy: marvell: cp110: rename comphy_index to cp_index
fix: phy: marvell: cp110: pcie: update analog parameters according to
latest ETP

Stefan Roese (8):
phy: marvell: Replace PHY_TYPE_KR with PHY_TYPE_SFI
phy: marvell: cp110: add support for end point configuration
phy: marvell: cp110: update utmi phy connection type
phy: marvell: add IGNORE COMPHY type
fix: phy: marvell: cp110: fix the KR/SFI line 4 selector
fix: phy: marvell: cp110: update comphy selector option
fix: phy: marvell: cp110: fix comphy lane 4 selection options
phy: marvell: print comphy status even when it's disconnected

 arch/arm/dts/armada-7040-db.dts          |   2 +-
 arch/arm/dts/armada-8040-db.dts          |   8 +-
 arch/arm/dts/armada-8040-mcbin.dts       |  14 +-
 arch/arm/dts/armada-cp110-master.dtsi    |   4 +-
 arch/arm/dts/armada-cp110-slave.dtsi     |   2 +-
 drivers/phy/marvell/comphy.h             |   3 +-
 drivers/phy/marvell/comphy_core.c        |  15 +-
 drivers/phy/marvell/comphy_cp110.c       | 449 +++++++++++++++++++++++++++----
 drivers/phy/marvell/comphy_hpipe.h       | 277 +++++++++++++++++--
 drivers/phy/marvell/comphy_mux.c         |   7 +
 include/dt-bindings/comphy/comphy_data.h |  20 +-
 11 files changed, 689 insertions(+), 112 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/13 phy: marvell: Replace PHY_TYPE_KR with PHY_TYPE_SFI

From: Stefan Roese <[email protected]>

Use correct naming as done in the latest Marvell U-Boot version as well.

---
 arch/arm/dts/armada-8040-db.dts          |  8 ++++----
 arch/arm/dts/armada-8040-mcbin.dts       | 10 +++++-----
 drivers/phy/marvell/comphy_core.c        |  2 +-
 drivers/phy/marvell/comphy_cp110.c       | 18 +++++++++---------
 include/dt-bindings/comphy/comphy_data.h |  2 +-
 5 files changed, 20 insertions(+), 20 deletions(-)
arch/arm/dts/armada-8040-db.dts +4 -4
index f1f196f..76fd004 100644
@@ -205,7 +205,7 @@
 	 * Serdes Configuration:
 	 * Lane 0: SGMII2
 	 * Lane 1: USB3_HOST0
-	 * Lane 2: KR (10G)
+	 * Lane 2: SFI (10G)
 	 * Lane 3: SATA1
 	 * Lane 4: USB3_HOST1
 	 * Lane 5: PEX2x1
@@ -220,7 +220,7 @@
 	};
 
 	phy2 {
-		phy-type = <PHY_TYPE_KR>;
+		phy-type = <PHY_TYPE_SFI>;
 	};
 
 	phy3 {
@@ -241,7 +241,7 @@
 	 * Serdes Configuration:
 	 * Lane 0: SGMII2
 	 * Lane 1: USB3_HOST0
-	 * Lane 2: KR (10G)
+	 * Lane 2: SFI (10G)
 	 * Lane 3: SATA1
 	 * Lane 4: Unconnected
 	 * Lane 5: PEX2x1
@@ -256,7 +256,7 @@
 	};
 
 	phy2 {
-		phy-type = <PHY_TYPE_KR>;
+		phy-type = <PHY_TYPE_SFI>;
 	};
 
 	phy3 {
arch/arm/dts/armada-8040-mcbin.dts +5 -5
index e42b092..dde495a 100644
@@ -99,7 +99,7 @@
 	 * [54] 2.5G SFP LOS
 	 * [55] Micro SD card detect
 	 * [56-61] Micro SD
-	 * [62] CP1 KR SFP FAULT
+	 * [62] CP1 SFI SFP FAULT
 	 */
 		/*   0    1    2    3    4    5    6    7    8    9 */
 	pin-func = < 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
@@ -163,7 +163,7 @@
 	 * Lane 1: PCIe0 (x4)
 	 * Lane 2: PCIe0 (x4)
 	 * Lane 3: PCIe0 (x4)
-	 * Lane 4: KR (10G)
+	 * Lane 4: SFI (10G)
 	 * Lane 5: SATA1
 	 */
 	phy0 {
@@ -179,7 +179,7 @@
 		phy-type = <PHY_TYPE_PEX0>;
 	};
 	phy4 {
-		phy-type = <PHY_TYPE_KR>;
+		phy-type = <PHY_TYPE_SFI>;
 	};
 	phy5 {
 		phy-type = <PHY_TYPE_SATA1>;
@@ -268,7 +268,7 @@
 	 * Lane 1: SATA 0
 	 * Lane 2: USB HOST 0
 	 * Lane 3: SATA1
-	 * Lane 4: KR (10G)
+	 * Lane 4: SFI (10G)
 	 * Lane 5: SGMII3
 	 */
 	phy0 {
@@ -285,7 +285,7 @@
 		phy-type = <PHY_TYPE_SATA1>;
 	};
 	phy4 {
-		phy-type = <PHY_TYPE_KR>;
+		phy-type = <PHY_TYPE_SFI>;
 	};
 	phy5 {
 		phy-type = <PHY_TYPE_SGMII3>;
drivers/phy/marvell/comphy_core.c +1 -1
index caa1928..ac084a6 100644
@@ -37,7 +37,7 @@ static char *get_type_string(u32 type)
 				"SGMII1", "SGMII2", "SGMII3", "QSGMII",
 				"USB3_HOST0", "USB3_HOST1", "USB3_DEVICE",
 				"XAUI0", "XAUI1", "XAUI2", "XAUI3",
-				"RXAUI0", "RXAUI1", "KR"};
+				"RXAUI0", "RXAUI1", "SFI"};
 
 	if (type < 0 || type > PHY_TYPE_MAX)
 		return "invalid";
drivers/phy/marvell/comphy_cp110.c +9 -9
index 25c067d..cd3cf96 100644
@@ -34,7 +34,7 @@ struct utmi_phy_data {
  * PIPE selector include USB and PCIe options.
  * PHY selector include the Ethernet and SATA options, every Ethernet
  * option has different options, for example: serdes lane2 had option
- * Eth_port_0 that include (SGMII0, XAUI0, RXAUI0, KR)
+ * Eth_port_0 that include (SGMII0, XAUI0, RXAUI0, SFI)
  */
 struct comphy_mux_data cp110_comphy_phy_mux_data[] = {
 	{4, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 0 */
@@ -43,13 +43,13 @@ struct comphy_mux_data cp110_comphy_phy_mux_data[] = {
 	     {PHY_TYPE_XAUI3, 0x1}, {PHY_TYPE_SATA0, 0x4} } },
 	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x1}, /* Lane 2 */
 	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1},
-	     {PHY_TYPE_KR, 0x1}, {PHY_TYPE_SATA0, 0x4} } },
+	     {PHY_TYPE_SFI, 0x1}, {PHY_TYPE_SATA0, 0x4} } },
 	{8, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x1}, /* Lane 3 */
 	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1},
-	     {PHY_TYPE_KR, 0x1}, {PHY_TYPE_XAUI1, 0x1},
+	     {PHY_TYPE_SFI, 0x1}, {PHY_TYPE_XAUI1, 0x1},
 	     {PHY_TYPE_RXAUI1, 0x1}, {PHY_TYPE_SATA1, 0x4} } },
 	{7, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x2}, /* Lane 4 */
-	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1}, {PHY_TYPE_KR, 0x1},
+	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1}, {PHY_TYPE_SFI, 0x1},
 	     {PHY_TYPE_SGMII2, 0x1}, {PHY_TYPE_XAUI2, 0x1} } },
 	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_XAUI1, 0x1}, /* Lane 5 */
 	     {PHY_TYPE_RXAUI1, 0x1}, {PHY_TYPE_SGMII3, 0x1},
@@ -907,8 +907,8 @@ static int comphy_sgmii_power_up(u32 lane, u32 sgmii_speed,
 	return ret;
 }
 
-static int comphy_kr_power_up(u32 lane, void __iomem *hpipe_base,
-			      void __iomem *comphy_base)
+static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
+			       void __iomem *comphy_base)
 {
 	u32 mask, data, ret = 1;
 	void __iomem *hpipe_addr = HPIPE_ADDR(hpipe_base, lane);
@@ -1696,9 +1696,9 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 				lane, ptr_comphy_map->speed, hpipe_base_addr,
 				comphy_base_addr);
 			break;
-		case PHY_TYPE_KR:
-			ret = comphy_kr_power_up(lane, hpipe_base_addr,
-						 comphy_base_addr);
+		case PHY_TYPE_SFI:
+			ret = comphy_sfi_power_up(lane, hpipe_base_addr,
+						  comphy_base_addr);
 			break;
 		case PHY_TYPE_RXAUI0:
 		case PHY_TYPE_RXAUI1:
include/dt-bindings/comphy/comphy_data.h +1 -1
index a3a6b40..8fd578a 100644
@@ -42,7 +42,7 @@
 #define PHY_TYPE_XAUI3			20
 #define PHY_TYPE_RXAUI0			21
 #define PHY_TYPE_RXAUI1			22
-#define PHY_TYPE_KR			23
+#define PHY_TYPE_SFI			23
 #define PHY_TYPE_MAX			24
 #define PHY_TYPE_INVALID		0xff
 
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 2/13 phy: marvell: cp110: add support for end point configuration

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

The serdes was always configured in root complex mode. this patch add new entry in device tree (per serdes) which indicates whether the serdes is in end point mode. if so, it skips the root complex configuration.

---
 drivers/phy/marvell/comphy.h       |  1 +
 drivers/phy/marvell/comphy_core.c  |  2 ++
 drivers/phy/marvell/comphy_cp110.c | 16 ++++++++++------
 3 files changed, 13 insertions(+), 6 deletions(-)
drivers/phy/marvell/comphy.h +1 -0
index 0a15692..8b05757 100644
@@ -86,6 +86,7 @@ struct comphy_map {
 	u32 speed;
 	u32 invert;
 	bool clk_src;
+	bool end_point;
 };
 
 struct chip_serdes_phy_config {
drivers/phy/marvell/comphy_core.c +2 -0
index ac084a6..db23bef 100644
@@ -166,6 +166,8 @@ static int comphy_probe(struct udevice *dev)
 			blob, subnode, "phy-invert", PHY_POLARITY_NO_INVERT);
 		comphy_map_data[lane].clk_src = fdtdec_get_bool(blob, subnode,
 								"clk-src");
+		comphy_map_data[lane].end_point = fdtdec_get_bool(blob, subnode,
+								  "end_point");
 		if (comphy_map_data[lane].type == PHY_TYPE_INVALID) {
 			printf("no phy type for lane %d, setting lane as unconnected\n",
 			       lane + 1);
drivers/phy/marvell/comphy_cp110.c +10 -6
index cd3cf96..70554fe 100644
@@ -87,8 +87,8 @@ static u32 polling_with_timeout(void __iomem *addr, u32 val,
 	return 0;
 }
 
-static int comphy_pcie_power_up(u32 lane, u32 pcie_width,
-				bool clk_src, void __iomem *hpipe_base,
+static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
+				bool is_end_point, void __iomem *hpipe_base,
 				void __iomem *comphy_base)
 {
 	u32 mask, data, ret = 1;
@@ -109,6 +109,7 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width,
 	 * and SerDes Lane 0 got PCIe ref-clock #0
 	 */
 	debug("PCIe clock = %x\n", pcie_clk);
+	debug("PCIe RC    = %d\n", !is_end_point);
 	debug("PCIe width = %d\n", pcie_width);
 
 	/* enable PCIe by4 and by2 */
@@ -384,10 +385,12 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width,
 	data |= 0x1 << HPIPE_G3_FFE_LOAD_RES_LEVEL_OFFSET;
 	reg_set(hpipe_addr + HPIPE_G3_SETTING_3_REG, data, mask);
 
-	/* Set phy in root complex mode */
-	mask = HPIPE_CFG_PHY_RC_EP_MASK;
-	data = 0x1 << HPIPE_CFG_PHY_RC_EP_OFFSET;
-	reg_set(hpipe_addr + HPIPE_LANE_EQU_CONFIG_0_REG, data, mask);
+	if (!is_end_point) {
+		/* Set phy in root complex mode */
+		mask = HPIPE_CFG_PHY_RC_EP_MASK;
+		data = 0x1 << HPIPE_CFG_PHY_RC_EP_OFFSET;
+		reg_set(hpipe_addr + HPIPE_LANE_EQU_CONFIG_0_REG, data, mask);
+	}
 
 	debug("stage: Comphy power up\n");
 
@@ -1667,6 +1670,7 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 		case PHY_TYPE_PEX3:
 			ret = comphy_pcie_power_up(
 				lane, pcie_width, ptr_comphy_map->clk_src,
+				serdes_map->end_point,
 				hpipe_base_addr, comphy_base_addr);
 			break;
 		case PHY_TYPE_SATA0:
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 3/13 phy: marvell: cp110: update utmi phy connection type

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

UTMI_PHY_TO_USB_HOST was used in USB3 UTMI dts node only, but there will be USB2 UTMI dts node for some SoCs that have got USB2 controller, so rename TO_USB_HOST to TO_USB3_HOST to distinguish TO_USB2_HOST in later on patches.

---
 arch/arm/dts/armada-cp110-master.dtsi    | 4 ++--
 arch/arm/dts/armada-cp110-slave.dtsi     | 2 +-
 drivers/phy/marvell/comphy_cp110.c       | 5 +++--
 include/dt-bindings/comphy/comphy_data.h | 6 +++---
 4 files changed, 9 insertions(+), 8 deletions(-)
arch/arm/dts/armada-cp110-master.dtsi +2 -2
index 229046f..b6c7dc5 100644
@@ -253,7 +253,7 @@
 				reg = <0x580000 0x1000>,	/* utmi-unit */
 				      <0x440420 0x4>,		/* usb-cfg */
 				      <0x440440 0x4>;		/* utmi-cfg */
-				utmi-port = <UTMI_PHY_TO_USB_HOST0>;
+				utmi-port = <UTMI_PHY_TO_USB3_HOST0>;
 				status = "disabled";
 			};
 
@@ -262,7 +262,7 @@
 				reg = <0x581000 0x1000>,	/* utmi-unit */
 				      <0x440420 0x4>,		/* usb-cfg */
 				      <0x440444 0x4>;		/* utmi-cfg */
-				utmi-port = <UTMI_PHY_TO_USB_HOST1>;
+				utmi-port = <UTMI_PHY_TO_USB3_HOST1>;
 				status = "disabled";
 			};
 
arch/arm/dts/armada-cp110-slave.dtsi +1 -1
index 5876391..0cdb3d3 100644
@@ -254,7 +254,7 @@
 				reg = <0x580000 0x1000>,	/* utmi-unit */
 				      <0x440420 0x4>,		/* usb-cfg */
 				      <0x440440 0x4>;		/* utmi-cfg */
-				utmi-port = <UTMI_PHY_TO_USB_HOST0>;
+				utmi-port = <UTMI_PHY_TO_USB3_HOST0>;
 				status = "disabled";
 			};
 		};
drivers/phy/marvell/comphy_cp110.c +3 -2
index 70554fe..8bec0ab 100644
@@ -1304,7 +1304,7 @@ static void comphy_utmi_power_down(u32 utmi_index, void __iomem *utmi_base_addr,
 	 * If UTMI connected to USB Device, configure mux prior to PHY init
 	 * (Device can be connected to UTMI0 or to UTMI1)
 	 */
-	if (utmi_phy_port == UTMI_PHY_TO_USB_DEVICE0) {
+	if (utmi_phy_port == UTMI_PHY_TO_USB3_DEVICE0) {
 		debug("stage:  UTMI %d - Enable Device mode and configure UTMI mux\n",
 		      utmi_index);
 		/* USB3 Device UTMI enable */
@@ -1496,7 +1496,8 @@ static void comphy_utmi_phy_init(u32 utmi_phy_count,
 			continue;
 		}
 		printf("UTMI PHY %d initialized to ", i);
-		if (cp110_utmi_data[i].utmi_phy_port == UTMI_PHY_TO_USB_DEVICE0)
+		if (cp110_utmi_data[i].utmi_phy_port ==
+		    UTMI_PHY_TO_USB3_DEVICE0)
 			printf("USB Device\n");
 		else
 			printf("USB Host%d\n",
include/dt-bindings/comphy/comphy_data.h +3 -3
index 8fd578a..d127388 100644
@@ -52,9 +52,9 @@
 #define PHY_POLARITY_ALL_INVERT		\
 	(PHY_POLARITY_TXD_INVERT | PHY_POLARITY_RXD_INVERT)
 
-#define UTMI_PHY_TO_USB_HOST0		0
-#define UTMI_PHY_TO_USB_HOST1		1
-#define UTMI_PHY_TO_USB_DEVICE0		2
+#define UTMI_PHY_TO_USB3_HOST0		0
+#define UTMI_PHY_TO_USB3_HOST1		1
+#define UTMI_PHY_TO_USB3_DEVICE0	2
 #define UTMI_PHY_INVALID		0xff
 
 #endif /* _COMPHY_DATA_H_ */
Signature · 1 line
2.7.4
#7 lore raw

PATCH v2 4/13 phy: marvell: add IGNORE COMPHY type

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

This type tells u-boot to preserve the COMPHY settings as is it is usefull in situations where the COMPHY was initialized by earlier firmware.
Note that IGNORE is different from UNCONNECTED since setting UNCONNECTED type will disconnect the COMPHY in the COMPHY MUX which is a desired behaviour

---
 drivers/phy/marvell/comphy_core.c        | 2 +-
 drivers/phy/marvell/comphy_cp110.c       | 1 +
 drivers/phy/marvell/comphy_mux.c         | 7 +++++++
 include/dt-bindings/comphy/comphy_data.h | 3 ++-
 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/phy/marvell/comphy_core.c +1 -1
index db23bef..23e8c4b 100644
@@ -37,7 +37,7 @@ static char *get_type_string(u32 type)
 				"SGMII1", "SGMII2", "SGMII3", "QSGMII",
 				"USB3_HOST0", "USB3_HOST1", "USB3_DEVICE",
 				"XAUI0", "XAUI1", "XAUI2", "XAUI3",
-				"RXAUI0", "RXAUI1", "SFI"};
+				"RXAUI0", "RXAUI1", "SFI", "IGNORE"};
 
 	if (type < 0 || type > PHY_TYPE_MAX)
 		return "invalid";
drivers/phy/marvell/comphy_cp110.c +1 -0
index 8bec0ab..499aa68 100644
@@ -1663,6 +1663,7 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 		}
 		switch (ptr_comphy_map->type) {
 		case PHY_TYPE_UNCONNECTED:
+		case PHY_TYPE_IGNORE:
 			continue;
 			break;
 		case PHY_TYPE_PEX0:
drivers/phy/marvell/comphy_mux.c +7 -0
index 1dc7426..b036fb1 100644
@@ -27,6 +27,10 @@ static void comphy_mux_check_config(struct comphy_mux_data *mux_data,
 
 	for (lane = 0; lane < comphy_max_lanes;
 	     lane++, comphy_map_data++, mux_data++) {
+		/* Don't check ignored COMPHYs */
+		if (comphy_map_data->type == PHY_TYPE_IGNORE)
+			continue;
+
 		mux_opt = mux_data->mux_values;
 		for (opt = 0, valid = 0; opt < mux_data->max_lane_values;
 		     opt++, mux_opt++) {
@@ -83,6 +87,9 @@ static void comphy_mux_reg_write(struct comphy_mux_data *mux_data,
 
 	for (lane = 0; lane < comphy_max_lanes;
 	     lane++, comphy_map_data++, mux_data++) {
+		if (comphy_map_data->type == PHY_TYPE_IGNORE)
+			continue;
+
 		offset = lane * bitcount;
 		mask = (((1 << bitcount) - 1) << offset);
 		value = (comphy_mux_get_mux_value(mux_data,
include/dt-bindings/comphy/comphy_data.h +2 -1
index d127388..5eb32ef 100644
@@ -43,7 +43,8 @@
 #define PHY_TYPE_RXAUI0			21
 #define PHY_TYPE_RXAUI1			22
 #define PHY_TYPE_SFI			23
-#define PHY_TYPE_MAX			24
+#define PHY_TYPE_IGNORE			24
+#define PHY_TYPE_MAX			25
 #define PHY_TYPE_INVALID		0xff
 
 #define PHY_POLARITY_NO_INVERT		0
Signature · 1 line
2.7.4
#9 lore raw

PATCH v2 5/13 fix: phy: marvell: cp110: fix the KR/SFI line 4 selector

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

This patch fixes the following:
1. KR/SFI on lane #4 mux selector is 0x2 and not 0x1
2. Comment typo

---
 drivers/phy/marvell/comphy_cp110.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/marvell/comphy_cp110.c +2 -2
index 499aa68..e90a913 100644
@@ -49,7 +49,7 @@ struct comphy_mux_data cp110_comphy_phy_mux_data[] = {
 	     {PHY_TYPE_SFI, 0x1}, {PHY_TYPE_XAUI1, 0x1},
 	     {PHY_TYPE_RXAUI1, 0x1}, {PHY_TYPE_SATA1, 0x4} } },
 	{7, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x2}, /* Lane 4 */
-	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1}, {PHY_TYPE_SFI, 0x1},
+	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1}, {PHY_TYPE_SFI, 0x2},
 	     {PHY_TYPE_SGMII2, 0x1}, {PHY_TYPE_XAUI2, 0x1} } },
 	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_XAUI1, 0x1}, /* Lane 5 */
 	     {PHY_TYPE_RXAUI1, 0x1}, {PHY_TYPE_SGMII3, 0x1},
@@ -1718,7 +1718,7 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 		}
 		if (ret == 0) {
 			/*
-			 * If interface wans't initialiuzed, set the lane to
+			 * If interface wans't initialized, set the lane to
 			 * PHY_TYPE_UNCONNECTED state.
 			 */
 			ptr_comphy_map->type = PHY_TYPE_UNCONNECTED;
Signature · 1 line
2.7.4
#11 lore raw

PATCH v2 6/13 fix: phy: marvell: cp110: sata: update analog parameters according to latest ETP

In reply to igall at marvell.com

From: Igal Liberman <[email protected]>

Add SATA analog parameters initialization values according to latest ETP.

---
 drivers/phy/marvell/comphy_cp110.c | 188 ++++++++++++++++++++++++++++++++++---
 drivers/phy/marvell/comphy_hpipe.h | 179 +++++++++++++++++++++++++++++++----
 2 files changed, 336 insertions(+), 31 deletions(-)
drivers/phy/marvell/comphy_cp110.c +177 -11
index e90a913..a4dddb8 100644
@@ -360,15 +360,15 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
 	reg_set(hpipe_addr + HPIPE_DFE_REG0,  data, mask);
 
 	/* Configure initial and final coefficient value for receiver */
-	mask = HPIPE_G3_RX_SELMUPI_MASK;
-	data = 0x1 << HPIPE_G3_RX_SELMUPI_OFFSET;
+	mask = HPIPE_G3_SET_1_G3_RX_SELMUPI_MASK;
+	data = 0x1 << HPIPE_G3_SET_1_G3_RX_SELMUPI_OFFSET;
 
-	mask |= HPIPE_G3_RX_SELMUPF_MASK;
-	data |= 0x1 << HPIPE_G3_RX_SELMUPF_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_RX_SELMUPF_MASK;
+	data |= 0x1 << HPIPE_G3_SET_1_G3_RX_SELMUPF_OFFSET;
 
-	mask |= HPIPE_G3_SETTING_BIT_MASK;
-	data |= 0x0 << HPIPE_G3_SETTING_BIT_OFFSET;
-	reg_set(hpipe_addr + HPIPE_G3_SETTINGS_1_REG,  data, mask);
+	mask |= HPIPE_G3_SET_1_G3_SAMPLER_INPAIRX2_EN_MASK;
+	data |= 0x0 << HPIPE_G3_SET_1_G3_SAMPLER_INPAIRX2_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G3_SET_1_REG,  data, mask);
 
 	/* Trigger sampler enable pulse */
 	mask = HPIPE_SMAPLER_MASK;
@@ -693,10 +693,176 @@ static int comphy_sata_power_up(u32 lane, void __iomem *hpipe_base,
 		0x2 << HPIPE_LOOPBACK_SEL_OFFSET, HPIPE_LOOPBACK_SEL_MASK);
 
 	debug("stage: Analog paramters from ETP(HW)\n");
-	/*
-	 * TODO: Set analog paramters from ETP(HW) - for now use the
-	 * default datas
-	 */
+	/* Set analog parameters from ETP(HW) */
+	/* G1 settings */
+	mask = HPIPE_G1_SET_1_G1_RX_SELMUPI_MASK;
+	data = 0x0 << HPIPE_G1_SET_1_G1_RX_SELMUPI_OFFSET;
+	mask |= HPIPE_G1_SET_1_G1_RX_SELMUPP_MASK;
+	data |= 0x1 << HPIPE_G1_SET_1_G1_RX_SELMUPP_OFFSET;
+	mask |= HPIPE_G1_SET_1_G1_RX_SELMUFI_MASK;
+	data |= 0x0 << HPIPE_G1_SET_1_G1_RX_SELMUFI_OFFSET;
+	mask |= HPIPE_G1_SET_1_G1_RX_SELMUFF_MASK;
+	data |= 0x3 << HPIPE_G1_SET_1_G1_RX_SELMUFF_OFFSET;
+	mask |= HPIPE_G1_SET_1_G1_RX_DIGCK_DIV_MASK;
+	data |= 0x1 << HPIPE_G1_SET_1_G1_RX_DIGCK_DIV_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G1_SET_1_REG, data, mask);
+
+	mask = HPIPE_G1_SETTINGS_3_G1_FFE_CAP_SEL_MASK;
+	data = 0xf << HPIPE_G1_SETTINGS_3_G1_FFE_CAP_SEL_OFFSET;
+	mask |= HPIPE_G1_SETTINGS_3_G1_FFE_RES_SEL_MASK;
+	data |= 0x2 << HPIPE_G1_SETTINGS_3_G1_FFE_RES_SEL_OFFSET;
+	mask |= HPIPE_G1_SETTINGS_3_G1_FFE_SETTING_FORCE_MASK;
+	data |= 0x1 << HPIPE_G1_SETTINGS_3_G1_FFE_SETTING_FORCE_OFFSET;
+	mask |= HPIPE_G1_SETTINGS_3_G1_FFE_DEG_RES_LEVEL_MASK;
+	data |= 0x1 << HPIPE_G1_SETTINGS_3_G1_FFE_DEG_RES_LEVEL_OFFSET;
+	mask |= HPIPE_G1_SETTINGS_3_G1_FFE_LOAD_RES_LEVEL_MASK;
+	data |= 0x1 << HPIPE_G1_SETTINGS_3_G1_FFE_LOAD_RES_LEVEL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G1_SETTINGS_3_REG, data, mask);
+
+	/* G2 settings */
+	mask = HPIPE_G2_SET_1_G2_RX_SELMUPI_MASK;
+	data = 0x0 << HPIPE_G2_SET_1_G2_RX_SELMUPI_OFFSET;
+	mask |= HPIPE_G2_SET_1_G2_RX_SELMUPP_MASK;
+	data |= 0x1 << HPIPE_G2_SET_1_G2_RX_SELMUPP_OFFSET;
+	mask |= HPIPE_G2_SET_1_G2_RX_SELMUFI_MASK;
+	data |= 0x0 << HPIPE_G2_SET_1_G2_RX_SELMUFI_OFFSET;
+	mask |= HPIPE_G2_SET_1_G2_RX_SELMUFF_MASK;
+	data |= 0x3 << HPIPE_G2_SET_1_G2_RX_SELMUFF_OFFSET;
+	mask |= HPIPE_G2_SET_1_G2_RX_DIGCK_DIV_MASK;
+	data |= 0x1 << HPIPE_G2_SET_1_G2_RX_DIGCK_DIV_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G2_SET_1_REG, data, mask);
+
+	/* G3 settings */
+	mask = HPIPE_G3_SET_1_G3_RX_SELMUPI_MASK;
+	data = 0x2 << HPIPE_G3_SET_1_G3_RX_SELMUPI_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_RX_SELMUPF_MASK;
+	data |= 0x2 << HPIPE_G3_SET_1_G3_RX_SELMUPF_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_RX_SELMUFI_MASK;
+	data |= 0x3 << HPIPE_G3_SET_1_G3_RX_SELMUFI_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_RX_SELMUFF_MASK;
+	data |= 0x3 << HPIPE_G3_SET_1_G3_RX_SELMUFF_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_RX_DFE_EN_MASK;
+	data |= 0x1 << HPIPE_G3_SET_1_G3_RX_DFE_EN_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_RX_DIGCK_DIV_MASK;
+	data |= 0x2 << HPIPE_G3_SET_1_G3_RX_DIGCK_DIV_OFFSET;
+	mask |= HPIPE_G3_SET_1_G3_SAMPLER_INPAIRX2_EN_MASK;
+	data |= 0x0 << HPIPE_G3_SET_1_G3_SAMPLER_INPAIRX2_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G3_SET_1_REG, data, mask);
+
+	/* DTL Control */
+	mask = HPIPE_PWR_CTR_DTL_SQ_DET_EN_MASK;
+	data = 0x1 << HPIPE_PWR_CTR_DTL_SQ_DET_EN_OFFSET;
+	mask |= HPIPE_PWR_CTR_DTL_SQ_PLOOP_EN_MASK;
+	data |= 0x1 << HPIPE_PWR_CTR_DTL_SQ_PLOOP_EN_OFFSET;
+	mask |= HPIPE_PWR_CTR_DTL_FLOOP_EN_MASK;
+	data |= 0x1 << HPIPE_PWR_CTR_DTL_FLOOP_EN_OFFSET;
+	mask |= HPIPE_PWR_CTR_DTL_CLAMPING_SEL_MASK;
+	data |= 0x1 << HPIPE_PWR_CTR_DTL_CLAMPING_SEL_OFFSET;
+	mask |= HPIPE_PWR_CTR_DTL_INTPCLK_DIV_FORCE_MASK;
+	data |= 0x1 << HPIPE_PWR_CTR_DTL_INTPCLK_DIV_FORCE_OFFSET;
+	mask |= HPIPE_PWR_CTR_DTL_CLK_MODE_MASK;
+	data |= 0x1 << HPIPE_PWR_CTR_DTL_CLK_MODE_OFFSET;
+	mask |= HPIPE_PWR_CTR_DTL_CLK_MODE_FORCE_MASK;
+	data |= 0x1 << HPIPE_PWR_CTR_DTL_CLK_MODE_FORCE_OFFSET;
+	reg_set(hpipe_addr + HPIPE_PWR_CTR_DTL_REG, data, mask);
+
+	/* Trigger sampler enable pulse (by toggleing the bit) */
+	mask = HPIPE_SMAPLER_MASK;
+	data = 0x1 << HPIPE_SMAPLER_OFFSET;
+	reg_set(hpipe_addr + HPIPE_SAMPLER_N_PROC_CALIB_CTRL_REG, data, mask);
+	mask = HPIPE_SMAPLER_MASK;
+	data = 0x0 << HPIPE_SMAPLER_OFFSET;
+	reg_set(hpipe_addr + HPIPE_SAMPLER_N_PROC_CALIB_CTRL_REG, data, mask);
+
+	/* VDD Calibration Control 3 */
+	mask = HPIPE_EXT_SELLV_RXSAMPL_MASK;
+	data = 0x10 << HPIPE_EXT_SELLV_RXSAMPL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_VDD_CAL_CTRL_REG, data, mask);
+
+	/* DFE Resolution Control */
+	mask = HPIPE_DFE_RES_FORCE_MASK;
+	data = 0x1 << HPIPE_DFE_RES_FORCE_OFFSET;
+	reg_set(hpipe_addr + HPIPE_DFE_REG0, data, mask);
+
+	/* DFE F3-F5 Coefficient Control */
+	mask = HPIPE_DFE_F3_F5_DFE_EN_MASK;
+	data = 0x0 << HPIPE_DFE_F3_F5_DFE_EN_OFFSET;
+	mask |= HPIPE_DFE_F3_F5_DFE_CTRL_MASK;
+	data = 0x0 << HPIPE_DFE_F3_F5_DFE_CTRL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_DFE_F3_F5_REG, data, mask);
+
+	/* G3 Setting 3 */
+	mask = HPIPE_G3_FFE_CAP_SEL_MASK;
+	data = 0xf << HPIPE_G3_FFE_CAP_SEL_OFFSET;
+	mask |= HPIPE_G3_FFE_RES_SEL_MASK;
+	data |= 0x4 << HPIPE_G3_FFE_RES_SEL_OFFSET;
+	mask |= HPIPE_G3_FFE_SETTING_FORCE_MASK;
+	data |= 0x1 << HPIPE_G3_FFE_SETTING_FORCE_OFFSET;
+	mask |= HPIPE_G3_FFE_DEG_RES_LEVEL_MASK;
+	data |= 0x1 << HPIPE_G3_FFE_DEG_RES_LEVEL_OFFSET;
+	mask |= HPIPE_G3_FFE_LOAD_RES_LEVEL_MASK;
+	data |= 0x3 << HPIPE_G3_FFE_LOAD_RES_LEVEL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G3_SETTING_3_REG, data, mask);
+
+	/* G3 Setting 4 */
+	mask = HPIPE_G3_DFE_RES_MASK;
+	data = 0x2 << HPIPE_G3_DFE_RES_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G3_SETTING_4_REG, data, mask);
+
+	/* Offset Phase Control */
+	mask = HPIPE_OS_PH_OFFSET_MASK;
+	data = 0x5c << HPIPE_OS_PH_OFFSET_OFFSET;
+	mask |= HPIPE_OS_PH_OFFSET_FORCE_MASK;
+	data |= 0x1 << HPIPE_OS_PH_OFFSET_FORCE_OFFSET;
+	reg_set(hpipe_addr + HPIPE_PHASE_CONTROL_REG, data, mask);
+	mask = HPIPE_OS_PH_VALID_MASK;
+	data = 0x1 << HPIPE_OS_PH_VALID_OFFSET;
+	reg_set(hpipe_addr + HPIPE_PHASE_CONTROL_REG, data, mask);
+	mask = HPIPE_OS_PH_VALID_MASK;
+	data = 0x0 << HPIPE_OS_PH_VALID_OFFSET;
+	reg_set(hpipe_addr + HPIPE_PHASE_CONTROL_REG, data, mask);
+
+	/* Set G1 TX amplitude and TX post emphasis value */
+	mask = HPIPE_G1_SET_0_G1_TX_AMP_MASK;
+	data = 0x8 << HPIPE_G1_SET_0_G1_TX_AMP_OFFSET;
+	mask |= HPIPE_G1_SET_0_G1_TX_AMP_ADJ_MASK;
+	data |= 0x1 << HPIPE_G1_SET_0_G1_TX_AMP_ADJ_OFFSET;
+	mask |= HPIPE_G1_SET_0_G1_TX_EMPH1_MASK;
+	data |= 0x1 << HPIPE_G1_SET_0_G1_TX_EMPH1_OFFSET;
+	mask |= HPIPE_G1_SET_0_G1_TX_EMPH1_EN_MASK;
+	data |= 0x1 << HPIPE_G1_SET_0_G1_TX_EMPH1_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G1_SET_0_REG, data, mask);
+
+	/* Set G2 TX amplitude and TX post emphasis value */
+	mask = HPIPE_G2_SET_0_G2_TX_AMP_MASK;
+	data = 0xa << HPIPE_G2_SET_0_G2_TX_AMP_OFFSET;
+	mask |= HPIPE_G2_SET_0_G2_TX_AMP_ADJ_MASK;
+	data |= 0x1 << HPIPE_G2_SET_0_G2_TX_AMP_ADJ_OFFSET;
+	mask |= HPIPE_G2_SET_0_G2_TX_EMPH1_MASK;
+	data |= 0x2 << HPIPE_G2_SET_0_G2_TX_EMPH1_OFFSET;
+	mask |= HPIPE_G2_SET_0_G2_TX_EMPH1_EN_MASK;
+	data |= 0x1 << HPIPE_G2_SET_0_G2_TX_EMPH1_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G2_SET_0_REG, data, mask);
+
+	/* Set G3 TX amplitude and TX post emphasis value */
+	mask = HPIPE_G3_SET_0_G3_TX_AMP_MASK;
+	data = 0xe << HPIPE_G3_SET_0_G3_TX_AMP_OFFSET;
+	mask |= HPIPE_G3_SET_0_G3_TX_AMP_ADJ_MASK;
+	data |= 0x1 << HPIPE_G3_SET_0_G3_TX_AMP_ADJ_OFFSET;
+	mask |= HPIPE_G3_SET_0_G3_TX_EMPH1_MASK;
+	data |= 0x6 << HPIPE_G3_SET_0_G3_TX_EMPH1_OFFSET;
+	mask |= HPIPE_G3_SET_0_G3_TX_EMPH1_EN_MASK;
+	data |= 0x1 << HPIPE_G3_SET_0_G3_TX_EMPH1_EN_OFFSET;
+	mask |= HPIPE_G3_SET_0_G3_TX_SLEW_RATE_SEL_MASK;
+	data |= 0x4 << HPIPE_G3_SET_0_G3_TX_SLEW_RATE_SEL_OFFSET;
+	mask |= HPIPE_G3_SET_0_G3_TX_SLEW_CTRL_EN_MASK;
+	data |= 0x0 << HPIPE_G3_SET_0_G3_TX_SLEW_CTRL_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G3_SET_0_REG, data, mask);
+
+	/* SERDES External Configuration 2 register */
+	mask = SD_EXTERNAL_CONFIG2_SSC_ENABLE_MASK;
+	data = 0x1 << SD_EXTERNAL_CONFIG2_SSC_ENABLE_OFFSET;
+	reg_set(sd_ip_addr + SD_EXTERNAL_CONFIG2_REG, data, mask);
 
 	/* DFE reset sequence */
 	reg_set(hpipe_addr + HPIPE_PWR_CTR_REG,
drivers/phy/marvell/comphy_hpipe.h +159 -20

230 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw

PATCH v2 7/13 fix: phy: marvell: cp110: update comphy selector option

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

Align PHY selectors register with Armada-CP-110 functional SPEC update all relevant device trees with this change.

---
 arch/arm/dts/armada-7040-db.dts    |  2 +-
 arch/arm/dts/armada-8040-mcbin.dts |  4 ++--
 drivers/phy/marvell/comphy_cp110.c | 29 +++++++++++++----------------
 3 files changed, 16 insertions(+), 19 deletions(-)
arch/arm/dts/armada-7040-db.dts +1 -1
index 84e0dbd..5fa2876 100644
@@ -158,7 +158,7 @@
 
 &cpm_comphy {
 	phy0 {
-		phy-type = <PHY_TYPE_SGMII2>;
+		phy-type = <PHY_TYPE_SGMII1>;
 		phy-speed = <PHY_SPEED_1_25G>;
 	};
 
arch/arm/dts/armada-8040-mcbin.dts +2 -2
index dde495a..991ddc0 100644
@@ -264,7 +264,7 @@
 &cps_comphy {
 	/*
 	 * CP1 Serdes Configuration:
-	 * Lane 0: SGMII2
+	 * Lane 0: SGMII1
 	 * Lane 1: SATA 0
 	 * Lane 2: USB HOST 0
 	 * Lane 3: SATA1
@@ -272,7 +272,7 @@
 	 * Lane 5: SGMII3
 	 */
 	phy0 {
-		phy-type = <PHY_TYPE_SGMII2>;
+		phy-type = <PHY_TYPE_SGMII1>;
 		phy-speed = <PHY_SPEED_1_25G>;
 	};
 	phy1 {
drivers/phy/marvell/comphy_cp110.c +13 -16
index a4dddb8..6a6083b 100644
@@ -37,23 +37,20 @@ struct utmi_phy_data {
  * Eth_port_0 that include (SGMII0, XAUI0, RXAUI0, SFI)
  */
 struct comphy_mux_data cp110_comphy_phy_mux_data[] = {
-	{4, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 0 */
-	     {PHY_TYPE_XAUI2, 0x1}, {PHY_TYPE_SATA1, 0x4} } },
-	{4, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII3, 0x1}, /* Lane 1 */
-	     {PHY_TYPE_XAUI3, 0x1}, {PHY_TYPE_SATA0, 0x4} } },
+	{4, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII1, 0x1}, /* Lane 0 */
+	     {PHY_TYPE_SATA1, 0x4} } },
+	{4, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 1 */
+	     {PHY_TYPE_SATA0, 0x4} } },
 	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x1}, /* Lane 2 */
-	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1},
-	     {PHY_TYPE_SFI, 0x1}, {PHY_TYPE_SATA0, 0x4} } },
-	{8, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x1}, /* Lane 3 */
-	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1},
-	     {PHY_TYPE_SFI, 0x1}, {PHY_TYPE_XAUI1, 0x1},
-	     {PHY_TYPE_RXAUI1, 0x1}, {PHY_TYPE_SATA1, 0x4} } },
-	{7, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x2}, /* Lane 4 */
-	     {PHY_TYPE_XAUI0, 0x1}, {PHY_TYPE_RXAUI0, 0x1}, {PHY_TYPE_SFI, 0x2},
-	     {PHY_TYPE_SGMII2, 0x1}, {PHY_TYPE_XAUI2, 0x1} } },
-	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_XAUI1, 0x1}, /* Lane 5 */
-	     {PHY_TYPE_RXAUI1, 0x1}, {PHY_TYPE_SGMII3, 0x1},
-	     {PHY_TYPE_XAUI3, 0x1}, {PHY_TYPE_SATA1, 0x4} } },
+	     {PHY_TYPE_RXAUI0, 0x1}, {PHY_TYPE_SFI, 0x1},
+	     {PHY_TYPE_SATA0, 0x4} } },
+	{8, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_RXAUI1, 0x1}, /* Lane 3 */
+	     {PHY_TYPE_SGMII1, 0x2}, {PHY_TYPE_SATA1, 0x4} } },
+	{7, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 4 */
+	     {PHY_TYPE_RXAUI0, 0x2}, {PHY_TYPE_SFI, 0x2},
+	     {PHY_TYPE_SGMII1, 0x2} } },
+	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 5 */
+	     {PHY_TYPE_RXAUI1, 0x2}, {PHY_TYPE_SATA1, 0x4} } },
 };
 
 struct comphy_mux_data cp110_comphy_pipe_mux_data[] = {
Signature · 1 line
2.7.4
#15 lore raw

PATCH v2 8/13 phy: marvell: cp110: add 5G XFI mode

In reply to igall at marvell.com

From: Igal Liberman <[email protected]>

This patch adds the option to configure a comphy to 5G XFI mode.

In order to configure the comphy to 5G XFI, update the comphy node in the device-tree:

	phy2 {
		phy-type = <PHY_TYPE_SFI>;
		phy-speed = <PHY_SPEED_5_15625G>;
	};
---
 drivers/phy/marvell/comphy_cp110.c       | 44 +++++++++++++++++++++++++++-----
 drivers/phy/marvell/comphy_hpipe.h       | 14 ++++++++++
 include/dt-bindings/comphy/comphy_data.h |  9 ++++---
 3 files changed, 56 insertions(+), 11 deletions(-)
drivers/phy/marvell/comphy_cp110.c +37 -7
index 6a6083b..056de83 100644
@@ -1074,7 +1074,7 @@ static int comphy_sgmii_power_up(u32 lane, u32 sgmii_speed,
 }
 
 static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
-			       void __iomem *comphy_base)
+			       void __iomem *comphy_base, u32 speed)
 {
 	u32 mask, data, ret = 1;
 	void __iomem *hpipe_addr = HPIPE_ADDR(hpipe_base, lane);
@@ -1129,7 +1129,9 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 	debug("stage: Comphy configuration\n");
 	/* set reference clock */
 	mask = HPIPE_MISC_ICP_FORCE_MASK;
-	data = 0x1 << HPIPE_MISC_ICP_FORCE_OFFSET;
+	data = (speed == PHY_SPEED_5_15625G) ?
+		(0x0 << HPIPE_MISC_ICP_FORCE_OFFSET) :
+		(0x1 << HPIPE_MISC_ICP_FORCE_OFFSET);
 	mask |= HPIPE_MISC_REFCLK_SEL_MASK;
 	data |= 0x0 << HPIPE_MISC_REFCLK_SEL_OFFSET;
 	reg_set(hpipe_addr + HPIPE_MISC_REG, data, mask);
@@ -1154,6 +1156,19 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 	data = 0x1 << HPIPE_PWR_CTR_DTL_FLOOP_EN_OFFSET;
 	reg_set(hpipe_addr + HPIPE_PWR_CTR_DTL_REG, data, mask);
 
+	/* Transmitter/Receiver Speed Divider Force */
+	if (speed == PHY_SPEED_5_15625G) {
+		mask = HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_MASK;
+		data = 1 << HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_OFFSET;
+		mask |= HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_FORCE_MASK;
+		data |= 1 << HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_FORCE_OFFSET;
+		mask |= HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_MASK;
+		data |= 1 << HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_OFFSET;
+		mask |= HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_MASK;
+		data |= 1 << HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_OFFSET;
+		reg_set(hpipe_addr + HPIPE_SPD_DIV_FORCE_REG, data, mask);
+	}
+
 	/* Set analog paramters from ETP(HW) */
 	debug("stage: Analog paramters from ETP(HW)\n");
 	/* SERDES External Configuration 2 */
@@ -1165,10 +1180,15 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 	data = 0x1 << HPIPE_DFE_RES_FORCE_OFFSET;
 	reg_set(hpipe_addr + HPIPE_DFE_REG0, data, mask);
 	/* 0xd-G1_Setting_0 */
-	mask = HPIPE_G1_SET_0_G1_TX_AMP_MASK;
-	data = 0x1c << HPIPE_G1_SET_0_G1_TX_AMP_OFFSET;
-	mask |= HPIPE_G1_SET_0_G1_TX_EMPH1_MASK;
-	data |= 0xe << HPIPE_G1_SET_0_G1_TX_EMPH1_OFFSET;
+	if (speed == PHY_SPEED_5_15625G) {
+		mask = HPIPE_G1_SET_0_G1_TX_EMPH1_MASK;
+		data = 0x6 << HPIPE_G1_SET_0_G1_TX_EMPH1_OFFSET;
+	} else {
+		mask = HPIPE_G1_SET_0_G1_TX_AMP_MASK;
+		data = 0x1c << HPIPE_G1_SET_0_G1_TX_AMP_OFFSET;
+		mask |= HPIPE_G1_SET_0_G1_TX_EMPH1_MASK;
+		data |= 0xe << HPIPE_G1_SET_0_G1_TX_EMPH1_OFFSET;
+	}
 	reg_set(hpipe_addr + HPIPE_G1_SET_0_REG, data, mask);
 	/* Genration 1 setting 2 (G1_Setting_2) */
 	mask = HPIPE_G1_SET_2_G1_TX_EMPH0_MASK;
@@ -1214,6 +1234,15 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 	/* Genration 1 setting 3 (G1_Setting_3) */
 	mask = HPIPE_G1_SETTINGS_3_G1_FBCK_SEL_MASK;
 	data = 0x1 << HPIPE_G1_SETTINGS_3_G1_FBCK_SEL_OFFSET;
+	if (speed == PHY_SPEED_5_15625G) {
+		/* Force FFE (Feed Forward Equalization) to 5G */
+		mask |= HPIPE_G1_SETTINGS_3_G1_FFE_CAP_SEL_MASK;
+		data |= 0xf << HPIPE_G1_SETTINGS_3_G1_FFE_CAP_SEL_OFFSET;
+		mask |= HPIPE_G1_SETTINGS_3_G1_FFE_RES_SEL_MASK;
+		data |= 0x4 << HPIPE_G1_SETTINGS_3_G1_FFE_RES_SEL_OFFSET;
+		mask |= HPIPE_G1_SETTINGS_3_G1_FFE_SETTING_FORCE_MASK;
+		data |= 0x1 << HPIPE_G1_SETTINGS_3_G1_FFE_SETTING_FORCE_OFFSET;
+	}
 	reg_set(hpipe_addr + HPIPE_G1_SETTINGS_3_REG, data, mask);
 
 	debug("stage: RFU configurations- Power Up PLL,Tx,Rx\n");
@@ -1867,7 +1896,8 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 			break;
 		case PHY_TYPE_SFI:
 			ret = comphy_sfi_power_up(lane, hpipe_base_addr,
-						  comphy_base_addr);
+						  comphy_base_addr,
+						  ptr_comphy_map->speed);
 			break;
 		case PHY_TYPE_RXAUI0:
 		case PHY_TYPE_RXAUI1:
drivers/phy/marvell/comphy_hpipe.h +14 -0
index 1857ffd..1e294fb 100644
@@ -300,6 +300,20 @@
 #define HPIPE_PWR_CTR_SFT_RST_MASK		\
 	(0x1 << HPIPE_PWR_CTR_SFT_RST_OFFSET)
 
+#define HPIPE_SPD_DIV_FORCE_REG				0x154
+#define HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_OFFSET		8
+#define HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_MASK		\
+	(0x3 << HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_OFFSET)
+#define HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_FORCE_OFFSET	10
+#define HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_FORCE_MASK	\
+	(0x1 << HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_FORCE_OFFSET)
+#define HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_OFFSET		13
+#define HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_MASK		\
+	(0x3 << HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_OFFSET)
+#define HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_OFFSET	15
+#define HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_MASK	\
+	(0x1 << HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_OFFSET)
+
 #define HPIPE_PLLINTP_REG1			0x150
 
 #define HPIPE_SAMPLER_N_PROC_CALIB_CTRL_REG	0x16C
include/dt-bindings/comphy/comphy_data.h +5 -4
index 5eb32ef..0983116 100644
@@ -13,10 +13,11 @@
 #define PHY_SPEED_3G			3
 #define PHY_SPEED_3_125G		4
 #define PHY_SPEED_5G			5
-#define PHY_SPEED_6G			6
-#define PHY_SPEED_6_25G			7
-#define PHY_SPEED_10_3125G		8
-#define PHY_SPEED_MAX			9
+#define PHY_SPEED_5_15625G		6
+#define PHY_SPEED_6G			7
+#define PHY_SPEED_6_25G			8
+#define PHY_SPEED_10_3125G		9
+#define PHY_SPEED_MAX			10
 #define PHY_SPEED_INVALID		0xff
 
 #define PHY_TYPE_UNCONNECTED		0
Signature · 1 line
2.7.4
#17 lore raw

PATCH v2 9/13 fix: phy: marvell: cp110: fix comphy lane 4 selection options

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

The comphy configuration is incorrect. Set the correct values for SGMII.

In addition, remove xaui from the comment as it is not supported.

---
 drivers/phy/marvell/comphy_cp110.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/marvell/comphy_cp110.c +3 -3
index 056de83..8ea5df2 100644
@@ -34,7 +34,7 @@ struct utmi_phy_data {
  * PIPE selector include USB and PCIe options.
  * PHY selector include the Ethernet and SATA options, every Ethernet
  * option has different options, for example: serdes lane2 had option
- * Eth_port_0 that include (SGMII0, XAUI0, RXAUI0, SFI)
+ * Eth_port_0 that include (SGMII0, RXAUI0, SFI)
  */
 struct comphy_mux_data cp110_comphy_phy_mux_data[] = {
 	{4, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII1, 0x1}, /* Lane 0 */
@@ -46,9 +46,9 @@ struct comphy_mux_data cp110_comphy_phy_mux_data[] = {
 	     {PHY_TYPE_SATA0, 0x4} } },
 	{8, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_RXAUI1, 0x1}, /* Lane 3 */
 	     {PHY_TYPE_SGMII1, 0x2}, {PHY_TYPE_SATA1, 0x4} } },
-	{7, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 4 */
+	{7, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII0, 0x2}, /* Lane 4 */
 	     {PHY_TYPE_RXAUI0, 0x2}, {PHY_TYPE_SFI, 0x2},
-	     {PHY_TYPE_SGMII1, 0x2} } },
+	     {PHY_TYPE_SGMII1, 0x1} } },
 	{6, {{PHY_TYPE_UNCONNECTED, 0x0}, {PHY_TYPE_SGMII2, 0x1}, /* Lane 5 */
 	     {PHY_TYPE_RXAUI1, 0x2}, {PHY_TYPE_SATA1, 0x4} } },
 };
Signature · 1 line
2.7.4
#19 lore raw

PATCH v2 10/13 phy: marvell: print comphy status even when it's disconnected

In reply to igall at marvell.com

From: Stefan Roese <[email protected]>

since now the COMPHY can also be ignored, we must know the state of the COMPHY. we cannot assume anymore that a missing COMPHY is unconnected.

---
 drivers/phy/marvell/comphy_core.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/phy/marvell/comphy_core.c +0 -3
index 23e8c4b..d7b02f4 100644
@@ -90,9 +90,6 @@ void comphy_print(struct chip_serdes_phy_config *chip_cfg,
 
 	for (lane = 0; lane < chip_cfg->comphy_lanes_count;
 	     lane++, comphy_map_data++) {
-		if (comphy_map_data->type == PHY_TYPE_UNCONNECTED)
-			continue;
-
 		if (comphy_map_data->speed == PHY_SPEED_INVALID) {
 			printf("Comphy-%d: %-13s\n", lane,
 			       get_type_string(comphy_map_data->type));
Signature · 1 line
2.7.4
#21 lore raw

PATCH v2 11/13 fix: phy: marvell: cp110: sfi: update analog parameters according to latest ETP

In reply to igall at marvell.com

From: Igal Liberman <[email protected]>

Add SFI analog parameters initialization values according to latest ETP.

---
 drivers/phy/marvell/comphy_cp110.c | 88 +++++++++++++++++++++++++++++++++++---
 drivers/phy/marvell/comphy_hpipe.h | 40 +++++++++++++++++
 2 files changed, 121 insertions(+), 7 deletions(-)
drivers/phy/marvell/comphy_cp110.c +81 -7
index 8ea5df2..21de90c 100644
@@ -1166,8 +1166,11 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 		data |= 1 << HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_OFFSET;
 		mask |= HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_MASK;
 		data |= 1 << HPIPE_SPD_DIV_FORCE_TX_SPD_DIV_FORCE_OFFSET;
-		reg_set(hpipe_addr + HPIPE_SPD_DIV_FORCE_REG, data, mask);
+	} else {
+		mask = HPIPE_TXDIGCK_DIV_FORCE_MASK;
+		data = 0x1 << HPIPE_TXDIGCK_DIV_FORCE_OFFSET;
 	}
+	reg_set(hpipe_addr + HPIPE_SPD_DIV_FORCE_REG, data, mask);
 
 	/* Set analog paramters from ETP(HW) */
 	debug("stage: Analog paramters from ETP(HW)\n");
@@ -1213,13 +1216,27 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 	data = 0 << HPIPE_CAL_REG_1_EXT_TXIMP_OFFSET;
 	reg_set(hpipe_addr + HPIPE_G1_SETTING_5_REG, data, mask);
 	/* 0xE-G1_Setting_1 */
-	mask = HPIPE_G1_SET_1_G1_RX_SELMUPI_MASK;
-	data = 0x1 << HPIPE_G1_SET_1_G1_RX_SELMUPI_OFFSET;
-	mask |= HPIPE_G1_SET_1_G1_RX_SELMUPP_MASK;
-	data |= 0x1 << HPIPE_G1_SET_1_G1_RX_SELMUPP_OFFSET;
-	mask |= HPIPE_G1_SET_1_G1_RX_DFE_EN_MASK;
-	data |= 0x1 << HPIPE_G1_SET_1_G1_RX_DFE_EN_OFFSET;
+	mask = HPIPE_G1_SET_1_G1_RX_DFE_EN_MASK;
+	data = 0x1 << HPIPE_G1_SET_1_G1_RX_DFE_EN_OFFSET;
+	if (speed == PHY_SPEED_5_15625G) {
+		mask |= HPIPE_G1_SET_1_G1_RX_SELMUPI_MASK;
+		data |= 0x1 << HPIPE_G1_SET_1_G1_RX_SELMUPI_OFFSET;
+		mask |= HPIPE_G1_SET_1_G1_RX_SELMUPP_MASK;
+		data |= 0x1 << HPIPE_G1_SET_1_G1_RX_SELMUPP_OFFSET;
+	} else {
+		mask |= HPIPE_G1_SET_1_G1_RX_SELMUPI_MASK;
+		data |= 0x2 << HPIPE_G1_SET_1_G1_RX_SELMUPI_OFFSET;
+		mask |= HPIPE_G1_SET_1_G1_RX_SELMUPP_MASK;
+		data |= 0x2 << HPIPE_G1_SET_1_G1_RX_SELMUPP_OFFSET;
+		mask |= HPIPE_G1_SET_1_G1_RX_SELMUFI_MASK;
+		data |= 0x0 << HPIPE_G1_SET_1_G1_RX_SELMUFI_OFFSET;
+		mask |= HPIPE_G1_SET_1_G1_RX_SELMUFF_MASK;
+		data |= 0x1 << HPIPE_G1_SET_1_G1_RX_SELMUFF_OFFSET;
+		mask |= HPIPE_G1_SET_1_G1_RX_DIGCK_DIV_MASK;
+		data |= 0x3 << HPIPE_G1_SET_1_G1_RX_DIGCK_DIV_OFFSET;
+	}
 	reg_set(hpipe_addr + HPIPE_G1_SET_1_REG, data, mask);
+
 	/* 0xA-DFE_Reg3 */
 	mask = HPIPE_DFE_F3_F5_DFE_EN_MASK;
 	data = 0x0 << HPIPE_DFE_F3_F5_DFE_EN_OFFSET;
@@ -1245,6 +1262,63 @@ static int comphy_sfi_power_up(u32 lane, void __iomem *hpipe_base,
 	}
 	reg_set(hpipe_addr + HPIPE_G1_SETTINGS_3_REG, data, mask);
 
+	/* Connfigure RX training timer */
+	mask = HPIPE_RX_TRAIN_TIMER_MASK;
+	data = 0x13 << HPIPE_RX_TRAIN_TIMER_OFFSET;
+	reg_set(hpipe_addr + HPIPE_TX_TRAIN_CTRL_5_REG, data, mask);
+
+	/* Enable TX train peak to peak hold */
+	mask = HPIPE_TX_TRAIN_P2P_HOLD_MASK;
+	data = 0x1 << HPIPE_TX_TRAIN_P2P_HOLD_OFFSET;
+	reg_set(hpipe_addr + HPIPE_TX_TRAIN_CTRL_0_REG, data, mask);
+
+	/* Configure TX preset index */
+	mask = HPIPE_TX_PRESET_INDEX_MASK;
+	data = 0x2 << HPIPE_TX_PRESET_INDEX_OFFSET;
+	reg_set(hpipe_addr + HPIPE_TX_PRESET_INDEX_REG, data, mask);
+
+	/* Disable pattern lock lost timeout */
+	mask = HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_MASK;
+	data = 0x0 << HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_FRAME_DETECT_CTRL_3_REG, data, mask);
+
+	/* Configure TX training pattern and TX training 16bit auto */
+	mask = HPIPE_TX_TRAIN_16BIT_AUTO_EN_MASK;
+	data = 0x1 << HPIPE_TX_TRAIN_16BIT_AUTO_EN_OFFSET;
+	mask |= HPIPE_TX_TRAIN_PAT_SEL_MASK;
+	data |= 0x1 << HPIPE_TX_TRAIN_PAT_SEL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_TX_TRAIN_REG, data, mask);
+
+	/* Configure Training patten number */
+	mask = HPIPE_TRAIN_PAT_NUM_MASK;
+	data = 0x88 << HPIPE_TRAIN_PAT_NUM_OFFSET;
+	reg_set(hpipe_addr + HPIPE_FRAME_DETECT_CTRL_0_REG, data, mask);
+
+	/* Configure differencial manchester encoter to ethernet mode */
+	mask = HPIPE_DME_ETHERNET_MODE_MASK;
+	data = 0x1 << HPIPE_DME_ETHERNET_MODE_OFFSET;
+	reg_set(hpipe_addr + HPIPE_DME_REG, data, mask);
+
+	/* Configure VDD Continuous Calibration */
+	mask = HPIPE_CAL_VDD_CONT_MODE_MASK;
+	data = 0x1 << HPIPE_CAL_VDD_CONT_MODE_OFFSET;
+	reg_set(hpipe_addr + HPIPE_VDD_CAL_0_REG, data, mask);
+
+	/* Trigger sampler enable pulse (by toggleing the bit) */
+	mask = HPIPE_RX_SAMPLER_OS_GAIN_MASK;
+	data = 0x3 << HPIPE_RX_SAMPLER_OS_GAIN_OFFSET;
+	mask |= HPIPE_SMAPLER_MASK;
+	data |= 0x1 << HPIPE_SMAPLER_OFFSET;
+	reg_set(hpipe_addr + HPIPE_SAMPLER_N_PROC_CALIB_CTRL_REG, data, mask);
+	mask = HPIPE_SMAPLER_MASK;
+	data = 0x0 << HPIPE_SMAPLER_OFFSET;
+	reg_set(hpipe_addr + HPIPE_SAMPLER_N_PROC_CALIB_CTRL_REG, data, mask);
+
+	/* Set External RX Regulator Control */
+	mask = HPIPE_EXT_SELLV_RXSAMPL_MASK;
+	data = 0x1A << HPIPE_EXT_SELLV_RXSAMPL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_VDD_CAL_CTRL_REG, data, mask);
+
 	debug("stage: RFU configurations- Power Up PLL,Tx,Rx\n");
 	/* SERDES External Configuration */
 	mask = SD_EXTERNAL_CONFIG0_SD_PU_PLL_MASK;
drivers/phy/marvell/comphy_hpipe.h +40 -0
index 1e294fb..5edd0ad 100644
@@ -254,6 +254,11 @@
 #define HPIPE_EXT_SELLV_RXSAMPL_MASK		\
 	(0x1f << HPIPE_EXT_SELLV_RXSAMPL_OFFSET)
 
+#define HPIPE_VDD_CAL_0_REG			0x108
+#define HPIPE_CAL_VDD_CONT_MODE_OFFSET		15
+#define HPIPE_CAL_VDD_CONT_MODE_MASK		\
+	(0x1 << HPIPE_CAL_VDD_CONT_MODE_OFFSET)
+
 #define HPIPE_PCIE_REG0                         0x120
 #define HPIPE_PCIE_IDLE_SYNC_OFFSET		12
 #define HPIPE_PCIE_IDLE_SYNC_MASK		\
@@ -301,6 +306,9 @@
 	(0x1 << HPIPE_PWR_CTR_SFT_RST_OFFSET)
 
 #define HPIPE_SPD_DIV_FORCE_REG				0x154
+#define HPIPE_TXDIGCK_DIV_FORCE_OFFSET			7
+#define HPIPE_TXDIGCK_DIV_FORCE_MASK			\
+	(0x1 << HPIPE_TXDIGCK_DIV_FORCE_OFFSET)
 #define HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_OFFSET		8
 #define HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_MASK		\
 	(0x3 << HPIPE_SPD_DIV_FORCE_RX_SPD_DIV_OFFSET)
@@ -317,6 +325,9 @@
 #define HPIPE_PLLINTP_REG1			0x150
 
 #define HPIPE_SAMPLER_N_PROC_CALIB_CTRL_REG	0x16C
+#define HPIPE_RX_SAMPLER_OS_GAIN_OFFSET		6
+#define HPIPE_RX_SAMPLER_OS_GAIN_MASK		\
+	(0x3 << HPIPE_RX_SAMPLER_OS_GAIN_OFFSET)
 #define HPIPE_SMAPLER_OFFSET			12
 #define HPIPE_SMAPLER_MASK			\
 	(0x1 << HPIPE_SMAPLER_OFFSET)
@@ -363,6 +374,21 @@
 #define HPIPE_OS_PH_VALID_MASK			\
 	(0x1 << HPIPE_OS_PH_VALID_OFFSET)
 
+#define HPIPE_FRAME_DETECT_CTRL_0_REG			0x214
+#define HPIPE_TRAIN_PAT_NUM_OFFSET			0x7
+#define HPIPE_TRAIN_PAT_NUM_MASK			\
+	(0x1FF << HPIPE_TRAIN_PAT_NUM_OFFSET)
+
+#define HPIPE_FRAME_DETECT_CTRL_3_REG			0x220
+#define HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_OFFSET	12
+#define HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_MASK		\
+	(0x1 << HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_OFFSET)
+
+#define HPIPE_DME_REG					0x228
+#define HPIPE_DME_ETHERNET_MODE_OFFSET			7
+#define HPIPE_DME_ETHERNET_MODE_MASK			\
+	(0x1 << HPIPE_DME_ETHERNET_MODE_OFFSET)
+
 #define HPIPE_TX_TRAIN_CTRL_0_REG		0x268
 #define HPIPE_TX_TRAIN_P2P_HOLD_OFFSET		15
 #define HPIPE_TX_TRAIN_P2P_HOLD_MASK		\
@@ -388,6 +414,9 @@
 #define HPIPE_PCIE_REG3				0x290
 
 #define HPIPE_TX_TRAIN_CTRL_5_REG		0x2A4
+#define HPIPE_RX_TRAIN_TIMER_OFFSET		0
+#define HPIPE_RX_TRAIN_TIMER_MASK		\
+	(0x3ff << HPIPE_RX_TRAIN_TIMER_OFFSET)
 #define HPIPE_TX_TRAIN_START_SQ_EN_OFFSET	11
 #define HPIPE_TX_TRAIN_START_SQ_EN_MASK		\
 	(0x1 << HPIPE_TX_TRAIN_START_SQ_EN_OFFSET)
@@ -408,6 +437,12 @@
 #define HPIPE_TX_TRAIN_COE_FM_PIN_PCIE3_OFFSET	7
 #define HPIPE_TX_TRAIN_COE_FM_PIN_PCIE3_MASK	\
 	(0x1 << HPIPE_TX_TRAIN_COE_FM_PIN_PCIE3_OFFSET)
+#define HPIPE_TX_TRAIN_16BIT_AUTO_EN_OFFSET	8
+#define HPIPE_TX_TRAIN_16BIT_AUTO_EN_MASK	\
+	(0x1 << HPIPE_TX_TRAIN_16BIT_AUTO_EN_OFFSET)
+#define HPIPE_TX_TRAIN_PAT_SEL_OFFSET		9
+#define HPIPE_TX_TRAIN_PAT_SEL_MASK		\
+	(0x1 << HPIPE_TX_TRAIN_PAT_SEL_OFFSET)
 
 #define HPIPE_TX_TRAIN_CTRL_11_REG		0x438
 #define HPIPE_TX_STATUS_CHECK_MODE_OFFSET	6
@@ -470,6 +505,11 @@
 #define HPIPE_G3_DFE_RES_MASK			\
 	(0x3 << HPIPE_G3_DFE_RES_OFFSET)
 
+#define HPIPE_TX_PRESET_INDEX_REG		0x468
+#define HPIPE_TX_PRESET_INDEX_OFFSET		0
+#define HPIPE_TX_PRESET_INDEX_MASK		\
+	(0xf << HPIPE_TX_PRESET_INDEX_OFFSET)
+
 #define HPIPE_DFE_CTRL_28_REG			0x49C
 #define HPIPE_DFE_CTRL_28_PIPE4_OFFSET		7
 #define HPIPE_DFE_CTRL_28_PIPE4_MASK		\
Signature · 1 line
2.7.4
#23 lore raw

PATCH v2 12/13 fix: phy: marvell: cp110: rename comphy_index to cp_index

In reply to igall at marvell.com

From: Igal Liberman <[email protected]>

No functional change.
The variable name "comphy_index" is misleading, it represents cp index and not comphy index.

---
 drivers/phy/marvell/comphy.h       | 2 +-
 drivers/phy/marvell/comphy_core.c  | 8 ++++----
 drivers/phy/marvell/comphy_cp110.c | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/phy/marvell/comphy.h +1 -1
index 8b05757..c9b94a4 100644
@@ -97,7 +97,7 @@ struct chip_serdes_phy_config {
 	void __iomem *hpipe3_base_addr;
 	u32 comphy_lanes_count;
 	u32 comphy_mux_bitcount;
-	u32 comphy_index;
+	u32 cp_index;
 };
 
 /* Register helper functions */
drivers/phy/marvell/comphy_core.c +4 -4
index d7b02f4..1cf0821 100644
@@ -173,13 +173,13 @@ static int comphy_probe(struct udevice *dev)
 		lane++;
 	}
 
-	/* Save comphy index for MultiCP devices (A8K) */
-	chip_cfg->comphy_index = dev->seq;
+	/* Save CP index for MultiCP devices (A8K) */
+	chip_cfg->cp_index = dev->seq;
 	/* PHY power UP sequence */
 	chip_cfg->ptr_comphy_chip_init(chip_cfg, comphy_map_data);
 	/* PHY print SerDes status */
 	if (of_machine_is_compatible("marvell,armada8040"))
-		printf("Comphy chip #%d:\n", chip_cfg->comphy_index);
+		printf("Comphy chip #%d:\n", chip_cfg->cp_index);
 	comphy_print(chip_cfg, comphy_map_data);
 
 	/*
@@ -188,7 +188,7 @@ static int comphy_probe(struct udevice *dev)
 	if (of_machine_is_compatible("marvell,armada8040"))
 		last_idx = 1;
 
-	if (chip_cfg->comphy_index == last_idx) {
+	if (chip_cfg->cp_index == last_idx) {
 		/* Initialize dedicated PHYs (not muxed SerDes lanes) */
 		comphy_dedicated_phys_init();
 	}
drivers/phy/marvell/comphy_cp110.c +3 -3
index 21de90c..df60571 100644
@@ -582,7 +582,7 @@ static int comphy_usb3_power_up(u32 lane, void __iomem *hpipe_base,
 }
 
 static int comphy_sata_power_up(u32 lane, void __iomem *hpipe_base,
-				void __iomem *comphy_base, int comphy_index)
+				void __iomem *comphy_base, int cp_index)
 {
 	u32 mask, data, i, ret = 1;
 	void __iomem *hpipe_addr = HPIPE_ADDR(hpipe_base, lane);
@@ -601,7 +601,7 @@ static int comphy_sata_power_up(u32 lane, void __iomem *hpipe_base,
 	 * In order to parse each CPs SATA node, fdt_node_offset_by_compatible
 	 * must be called again (according to the CP id)
 	 */
-	for (i = 0; i < (comphy_index + 1); i++)
+	for (i = 0; i < (cp_index + 1); i++)
 		sata_node = fdt_node_offset_by_compatible(
 			gd->fdt_blob, sata_node, "marvell,armada-8k-ahci");
 
@@ -1947,7 +1947,7 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 		case PHY_TYPE_SATA3:
 			ret = comphy_sata_power_up(
 				lane, hpipe_base_addr, comphy_base_addr,
-				ptr_chip_cfg->comphy_index);
+				ptr_chip_cfg->cp_index);
 			break;
 		case PHY_TYPE_USB3_HOST0:
 		case PHY_TYPE_USB3_HOST1:
Signature · 1 line
2.7.4
#25 lore raw

PATCH v2 13/13 fix: phy: marvell: cp110: pcie: update analog parameters according to latest ETP

In reply to igall at marvell.com

From: Igal Liberman <[email protected]>

Add PCIE analog parameters initialization values according to latest ETP.

---
 drivers/phy/marvell/comphy_cp110.c | 66 ++++++++++++++++++++++++++++++++++++--
 drivers/phy/marvell/comphy_hpipe.h | 44 ++++++++++++++++++++++++-
 2 files changed, 106 insertions(+), 4 deletions(-)
drivers/phy/marvell/comphy_cp110.c +63 -3
index df60571..3ac405a 100644
@@ -232,6 +232,8 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
 		mask |= HPIPE_MISC_REFCLK_SEL_MASK;
 		data |= 0x1 << HPIPE_MISC_REFCLK_SEL_OFFSET;
 	}
+	mask |= HPIPE_MISC_ICP_FORCE_MASK;
+	data |= 0x1 << HPIPE_MISC_ICP_FORCE_OFFSET;
 	reg_set(hpipe_addr + HPIPE_MISC_REG, data, mask);
 	if (pcie_clk) { /* output */
 		/* Set reference frequcency select - 0x2 for 25MHz*/
@@ -267,6 +269,9 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
 	/* Set Maximal PHY Generation Setting(8Gbps) */
 	mask = HPIPE_INTERFACE_GEN_MAX_MASK;
 	data = 0x2 << HPIPE_INTERFACE_GEN_MAX_OFFSET;
+	/* Bypass frame detection and sync detection for RX DATA */
+	mask = HPIPE_INTERFACE_DET_BYPASS_MASK;
+	data = 0x1 << HPIPE_INTERFACE_DET_BYPASS_OFFSET;
 	/* Set Link Train Mode (Tx training control pins are used) */
 	mask |= HPIPE_INTERFACE_LINK_TRAIN_MASK;
 	data |= 0x1 << HPIPE_INTERFACE_LINK_TRAIN_OFFSET;
@@ -351,9 +356,9 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
 	data = 0x3 << HPIPE_G3_DFE_RES_OFFSET;
 	reg_set(hpipe_addr + HPIPE_G3_SETTING_4_REG, data, mask);
 
-	/* Force DFE resolution (use GEN table value) */
+	/* Use TX/RX training result for DFE */
 	mask = HPIPE_DFE_RES_FORCE_MASK;
-	data = 0x1 << HPIPE_DFE_RES_FORCE_OFFSET;
+	data = 0x0 << HPIPE_DFE_RES_FORCE_OFFSET;
 	reg_set(hpipe_addr + HPIPE_DFE_REG0,  data, mask);
 
 	/* Configure initial and final coefficient value for receiver */
@@ -379,9 +384,64 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
 	data = 0x1 << HPIPE_G3_FFE_DEG_RES_LEVEL_OFFSET;
 
 	mask |= HPIPE_G3_FFE_LOAD_RES_LEVEL_MASK;
-	data |= 0x1 << HPIPE_G3_FFE_LOAD_RES_LEVEL_OFFSET;
+	data |= 0x3 << HPIPE_G3_FFE_LOAD_RES_LEVEL_OFFSET;
 	reg_set(hpipe_addr + HPIPE_G3_SETTING_3_REG, data, mask);
 
+	/* Pattern lock lost timeout disable */
+	mask = HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_MASK;
+	data = 0x0 << HPIPE_PATTERN_LOCK_LOST_TIMEOUT_EN_OFFSET;
+	reg_set(hpipe_addr + HPIPE_FRAME_DETECT_CTRL_3_REG, data, mask);
+
+	/* Configure DFE adaptations */
+	mask = HPIPE_CDR_MAX_DFE_ADAPT_1_MASK;
+	data = 0x1 << HPIPE_CDR_MAX_DFE_ADAPT_1_OFFSET;
+	mask |= HPIPE_CDR_MAX_DFE_ADAPT_0_MASK;
+	data |= 0x0 << HPIPE_CDR_MAX_DFE_ADAPT_0_OFFSET;
+	mask |= HPIPE_CDR_RX_MAX_DFE_ADAPT_1_MASK;
+	data |= 0x0 << HPIPE_CDR_RX_MAX_DFE_ADAPT_1_OFFSET;
+	reg_set(hpipe_addr + HPIPE_CDR_CONTROL_REG, data, mask);
+	mask = HPIPE_DFE_TX_MAX_DFE_ADAPT_MASK;
+	data = 0x0 << HPIPE_DFE_TX_MAX_DFE_ADAPT_OFFSET;
+	reg_set(hpipe_addr + HPIPE_DFE_CONTROL_REG, data, mask);
+
+	/* Genration 2 setting 1*/
+	mask = HPIPE_G2_SET_1_G2_RX_SELMUPI_MASK;
+	data = 0x0 << HPIPE_G2_SET_1_G2_RX_SELMUPI_OFFSET;
+	mask |= HPIPE_G2_SET_1_G2_RX_SELMUPP_MASK;
+	data |= 0x1 << HPIPE_G2_SET_1_G2_RX_SELMUPP_OFFSET;
+	mask |= HPIPE_G2_SET_1_G2_RX_SELMUFI_MASK;
+	data |= 0x0 << HPIPE_G2_SET_1_G2_RX_SELMUFI_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G2_SET_1_REG, data, mask);
+
+	/* DFE enable */
+	mask = HPIPE_G2_DFE_RES_MASK;
+	data = 0x3 << HPIPE_G2_DFE_RES_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G2_SETTINGS_4_REG, data, mask);
+
+	/* Configure DFE Resolution */
+	mask = HPIPE_LANE_CFG4_DFE_EN_SEL_MASK;
+	data = 0x1 << HPIPE_LANE_CFG4_DFE_EN_SEL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_LANE_CFG4_REG, data, mask);
+
+	/* VDD calibration control */
+	mask = HPIPE_EXT_SELLV_RXSAMPL_MASK;
+	data = 0x16 << HPIPE_EXT_SELLV_RXSAMPL_OFFSET;
+	reg_set(hpipe_addr + HPIPE_VDD_CAL_CTRL_REG, data, mask);
+
+	/* Set PLL Charge-pump Current Control */
+	mask = HPIPE_G3_SETTING_5_G3_ICP_MASK;
+	data = 0x4 << HPIPE_G3_SETTING_5_G3_ICP_OFFSET;
+	reg_set(hpipe_addr + HPIPE_G3_SETTING_5_REG, data, mask);
+
+	/* Set lane rqualization remote setting */
+	mask = HPIPE_LANE_CFG_FOM_DIRN_OVERRIDE_MASK;
+	data = 0x1 << HPIPE_LANE_CFG_FOM_DIRN_OVERRIDE_OFFSET;
+	mask |= HPIPE_LANE_CFG_FOM_ONLY_MODE_MASK;
+	data |= 0x1 << HPIPE_LANE_CFG_FOM_ONLY_MODE_OFFFSET;
+	mask |= HPIPE_LANE_CFG_FOM_PRESET_VECTOR_MASK;
+	data |= 0x2 << HPIPE_LANE_CFG_FOM_PRESET_VECTOR_OFFSET;
+	reg_set(hpipe_addr + HPIPE_LANE_EQ_REMOTE_SETTING_REG, data, mask);
+
 	if (!is_end_point) {
 		/* Set phy in root complex mode */
 		mask = HPIPE_CFG_PHY_RC_EP_MASK;
drivers/phy/marvell/comphy_hpipe.h +43 -1

86 lines not on this page · raw message

Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 2/13 phy: marvell: cp110: add support for end point configuration

In reply to igall at marvell.com
Quoted 10 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

The serdes was always configured in root complex mode. this patch add new entry in device tree (per serdes) which indicates whether the serdes is in end point mode. if so, it skips the root complex configuration.

Thanks,
Stefan

#6 lore raw

PATCH v2 3/13 phy: marvell: cp110: update utmi phy connection type

In reply to igall at marvell.com
Quoted 9 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

UTMI_PHY_TO_USB_HOST was used in USB3 UTMI dts node only, but there will be USB2 UTMI dts node for some SoCs that have got USB2 controller, so rename TO_USB_HOST to TO_USB3_HOST to distinguish TO_USB2_HOST in later on patches.

Thanks,
Stefan

#8 lore raw

PATCH v2 4/13 phy: marvell: add IGNORE COMPHY type

In reply to igall at marvell.com
Quoted 9 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

This type tells u-boot to preserve the COMPHY settings as is it is usefull in situations where the COMPHY was initialized by earlier firmware.
Note that IGNORE is different from UNCONNECTED since setting UNCONNECTED type will disconnect the COMPHY in the COMPHY MUX which is a desired behaviour

Quoted 3 lines

Thanks,
Stefan

#10 lore raw

PATCH v2 5/13 fix: phy: marvell: cp110: fix the KR/SFI line 4 selector

In reply to igall at marvell.com
Quoted 9 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

This patch fixes the following:
1. KR/SFI on lane #4 mux selector is 0x2 and not 0x1
2. Comment typo

Thanks,
Stefan

#12 lore raw

PATCH v2 6/13 fix: phy: marvell: cp110: sata: update analog parameters according to latest ETP

In reply to igall at marvell.com
Quoted 8 lines · igall at marvell.com

From: Igal Liberman <[email protected]>

Add SATA analog parameters initialization values according to latest ETP.

Thanks,
Stefan

#14 lore raw

PATCH v2 7/13 fix: phy: marvell: cp110: update comphy selector option

In reply to igall at marvell.com
Quoted 8 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

Align PHY selectors register with Armada-CP-110 functional SPEC update all relevant device trees with this change.

Thanks,
Stefan

#16 lore raw

PATCH v2 8/13 phy: marvell: cp110: add 5G XFI mode

In reply to igall at marvell.com
Quoted 6 lines · igall at marvell.com

From: Igal Liberman <[email protected]>

This patch adds the option to configure a comphy to 5G XFI mode.

In order to configure the comphy to 5G XFI, update the comphy node in the device-tree:

Quoted 7 lines
	phy2 {
		phy-type = <PHY_TYPE_SFI>;
		phy-speed = <PHY_SPEED_5_15625G>;
	};

Thanks,
Stefan

#18 lore raw

PATCH v2 9/13 fix: phy: marvell: cp110: fix comphy lane 4 selection options

In reply to igall at marvell.com
Quoted 10 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

The comphy configuration is incorrect. Set the correct values for SGMII.

In addition, remove xaui from the comment as it is not supported.

Thanks,
Stefan

#20 lore raw

PATCH v2 10/13 phy: marvell: print comphy status even when it's disconnected

In reply to igall at marvell.com
Quoted 9 lines · igall at marvell.com

From: Stefan Roese <[email protected]>

since now the COMPHY can also be ignored, we must know the state of the COMPHY. we cannot assume anymore that a missing COMPHY is unconnected.

Thanks,
Stefan

#27 lore raw

v2 cover phy: marvell: cp110: varius comphy updates

In reply to igall at marvell.com
Quoted 31 lines · igall at marvell.com

From: Igal Liberman <[email protected]>

This patchset improves Marvell A70x0/80x0 comphy driver:
- Improve comphy electrical parameters
- New modes
- Style
- Bug fixes

v1 --> v2:
- update commit messages
- remove change-id
Igal Liberman (5):
fix: phy: marvell: cp110: sata: update analog parameters according to
latest ETP
phy: marvell: cp110: add 5G XFI mode
fix: phy: marvell: cp110: sfi: update analog parameters according to
latest ETP
fix: phy: marvell: cp110: rename comphy_index to cp_index
fix: phy: marvell: cp110: pcie: update analog parameters according to
latest ETP

Stefan Roese (8):
phy: marvell: Replace PHY_TYPE_KR with PHY_TYPE_SFI
phy: marvell: cp110: add support for end point configuration
phy: marvell: cp110: update utmi phy connection type
phy: marvell: add IGNORE COMPHY type
fix: phy: marvell: cp110: fix the KR/SFI line 4 selector
fix: phy: marvell: cp110: update comphy selector option
fix: phy: marvell: cp110: fix comphy lane 4 selection options
phy: marvell: print comphy status even when it's disconnected

Quoted 12 lines
 arch/arm/dts/armada-7040-db.dts          |   2 +-
 arch/arm/dts/armada-8040-db.dts          |   8 +-
 arch/arm/dts/armada-8040-mcbin.dts       |  14 +-
 arch/arm/dts/armada-cp110-master.dtsi    |   4 +-
 arch/arm/dts/armada-cp110-slave.dtsi     |   2 +-
 drivers/phy/marvell/comphy.h             |   3 +-
 drivers/phy/marvell/comphy_core.c        |  15 +-
 drivers/phy/marvell/comphy_cp110.c       | 449 +++++++++++++++++++++++++++----
 drivers/phy/marvell/comphy_hpipe.h       | 277 +++++++++++++++++--
 drivers/phy/marvell/comphy_mux.c         |   7 +
 include/dt-bindings/comphy/comphy_data.h |  20 +-
 11 files changed, 689 insertions(+), 112 deletions(-)

Whole series applied to u-boot-marvell/master.

Thanks,
Stefan