[PATCH 13/14] phy: cadence-torrent: Add debug information for PHY configuration

Swapnil Jakhade sjakhade at cadence.com
Fri Apr 9 06:34:15 BST 2021


Display information in probe regarding PHY configuration parameters like
single link or multilink protocol information along with number of lanes
used for each protocol link.

Signed-off-by: Swapnil Jakhade <sjakhade at cadence.com>
---
 drivers/phy/cadence/phy-cadence-torrent.c | 32 +++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index bf37569c6c51..39145e56e061 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -574,6 +574,24 @@ static const struct coefficients vltg_coeff[4][4] = {
 	}
 };
 
+static const char *cdns_torrent_get_phy_type(enum cdns_torrent_phy_type phy_type)
+{
+	switch (phy_type) {
+	case TYPE_DP:
+		return "DisplayPort";
+	case TYPE_PCIE:
+		return "PCIe";
+	case TYPE_SGMII:
+		return "SGMII";
+	case TYPE_QSGMII:
+		return "QSGMII";
+	case TYPE_USB:
+		return "USB";
+	default:
+		return "None";
+	}
+}
+
 /*
  * Set registers responsible for enabling and configuring SSC, with second and
  * third register values provided by parameters.
@@ -2504,8 +2522,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev)
 				init_dp_regmap++;
 			}
 
-			dev_info(dev, "%d lanes, max bit rate %d.%03d Gbps\n",
-				 cdns_phy->phys[node].num_lanes,
+			dev_info(dev, "DP max bit rate %d.%03d Gbps\n",
 				 cdns_phy->max_bit_rate / 1000,
 				 cdns_phy->max_bit_rate % 1000);
 
@@ -2539,6 +2556,17 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev)
 		goto put_lnk_rst;
 	}
 
+	if (cdns_phy->nsubnodes > 1)
+		dev_info(dev, "%s (%d lanes) & %s (%d lanes)",
+			 cdns_torrent_get_phy_type(cdns_phy->phys[0].phy_type),
+			 cdns_phy->phys[0].num_lanes,
+			 cdns_torrent_get_phy_type(cdns_phy->phys[1].phy_type),
+			 cdns_phy->phys[1].num_lanes);
+	else
+		dev_info(dev, "%s (%d lanes)",
+			 cdns_torrent_get_phy_type(cdns_phy->phys[0].phy_type),
+			 cdns_phy->phys[0].num_lanes);
+
 	return 0;
 
 put_child:
-- 
2.26.1




More information about the linux-phy mailing list