public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan+linaro@kernel.org>
To: Vinod Koul <vkoul@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH 14/17] phy: qcom-qmp-combo: consolidate lane config
Date: Tue, 20 Sep 2022 09:38:23 +0200	[thread overview]
Message-ID: <20220920073826.20811-15-johan+linaro@kernel.org> (raw)
In-Reply-To: <20220920073826.20811-1-johan+linaro@kernel.org>

For legacy reasons, there are two configuration parameters that appear
to describe the number of lanes a PHY has, even if "nlanes" was actually
used for a different purpose.

Replace them both with a new field simply named "lanes".

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 38 ++++++++---------------
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 08e96e383a29..417e0fcf1a9f 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -816,8 +816,7 @@ struct qmp_phy;
 struct qmp_phy_cfg {
 	/* phy-type - PCIE/UFS/USB */
 	unsigned int type;
-	/* number of lanes provided by phy */
-	int nlanes;
+	int lanes;
 
 	/* Init sequence for PHY blocks - serdes, tx, rx, pcs */
 	const struct qmp_phy_init_tbl *serdes_tbl;
@@ -879,8 +878,6 @@ struct qmp_phy_cfg {
 
 	/* true, if PHY has a separate DP_COM control block */
 	bool has_phy_dp_com_ctrl;
-	/* true, if PHY has secondary tx/rx lanes to be configured */
-	bool is_dual_lane_phy;
 
 	/* Offset from PCS to PCS_USB region */
 	unsigned int pcs_usb_offset;
@@ -1029,7 +1026,7 @@ static const char * const sc7180_usb3phy_reset_l[] = {
 
 static const struct qmp_phy_cfg sc7180_usb3phy_cfg = {
 	.type			= PHY_TYPE_USB3,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= qmp_v3_usb3_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(qmp_v3_usb3_serdes_tbl),
@@ -1056,12 +1053,11 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = {
 	.pwrdn_delay_max	= POWER_DOWN_DELAY_US_MAX,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 };
 
 static const struct qmp_phy_cfg sc7180_dpphy_cfg = {
 	.type			= PHY_TYPE_DP,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= qmp_v3_dp_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(qmp_v3_dp_serdes_tbl),
@@ -1091,7 +1087,6 @@ static const struct qmp_phy_cfg sc7180_dpphy_cfg = {
 	.regs			= qmp_v3_usb3phy_regs_layout,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 
 	.dp_aux_init = qcom_qmp_v3_phy_dp_aux_init,
 	.configure_dp_tx = qcom_qmp_v3_phy_configure_dp_tx,
@@ -1106,7 +1101,7 @@ static const struct qmp_phy_combo_cfg sc7180_usb3dpphy_cfg = {
 
 static const struct qmp_phy_cfg sdm845_usb3phy_cfg = {
 	.type			= PHY_TYPE_USB3,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= qmp_v3_usb3_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(qmp_v3_usb3_serdes_tbl),
@@ -1133,7 +1128,6 @@ static const struct qmp_phy_cfg sdm845_usb3phy_cfg = {
 	.pwrdn_delay_max	= POWER_DOWN_DELAY_US_MAX,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 };
 
 static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = {
@@ -1143,7 +1137,7 @@ static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = {
 
 static const struct qmp_phy_cfg sm8150_usb3phy_cfg = {
 	.type			= PHY_TYPE_USB3,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= sm8150_usb3_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(sm8150_usb3_serdes_tbl),
@@ -1174,12 +1168,11 @@ static const struct qmp_phy_cfg sm8150_usb3phy_cfg = {
 	.pwrdn_delay_max	= POWER_DOWN_DELAY_US_MAX,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 };
 
 static const struct qmp_phy_cfg sc8180x_dpphy_cfg = {
 	.type			= PHY_TYPE_DP,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= qmp_v4_dp_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1209,7 +1202,6 @@ static const struct qmp_phy_cfg sc8180x_dpphy_cfg = {
 	.regs			= qmp_v3_usb3phy_regs_layout,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 
 	.dp_aux_init = qcom_qmp_v4_phy_dp_aux_init,
 	.configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx,
@@ -1224,7 +1216,7 @@ static const struct qmp_phy_combo_cfg sc8180x_usb3dpphy_cfg = {
 
 static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = {
 	.type			= PHY_TYPE_USB3,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= sc8280xp_usb43dp_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(sc8280xp_usb43dp_serdes_tbl),
@@ -1252,12 +1244,11 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_usb_cfg = {
 	.pwrdn_delay_max	= POWER_DOWN_DELAY_US_MAX,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 };
 
 static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = {
 	.type			= PHY_TYPE_DP,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= qmp_v5_dp_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(qmp_v5_dp_serdes_tbl),
@@ -1287,7 +1278,6 @@ static const struct qmp_phy_cfg sc8280xp_usb43dp_dp_cfg = {
 	.regs			= qmp_v4_usb3phy_regs_layout,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 
 	.dp_aux_init = qcom_qmp_v4_phy_dp_aux_init,
 	.configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx,
@@ -1302,7 +1292,7 @@ static const struct qmp_phy_combo_cfg sc8280xp_usb43dpphy_combo_cfg = {
 
 static const struct qmp_phy_cfg sm8250_usb3phy_cfg = {
 	.type			= PHY_TYPE_USB3,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= sm8150_usb3_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(sm8150_usb3_serdes_tbl),
@@ -1332,12 +1322,11 @@ static const struct qmp_phy_cfg sm8250_usb3phy_cfg = {
 	.pwrdn_delay_max	= POWER_DOWN_DELAY_US_MAX,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 };
 
 static const struct qmp_phy_cfg sm8250_dpphy_cfg = {
 	.type			= PHY_TYPE_DP,
-	.nlanes			= 1,
+	.lanes			= 2,
 
 	.serdes_tbl		= qmp_v4_dp_serdes_tbl,
 	.serdes_tbl_num		= ARRAY_SIZE(qmp_v4_dp_serdes_tbl),
@@ -1367,7 +1356,6 @@ static const struct qmp_phy_cfg sm8250_dpphy_cfg = {
 	.regs			= qmp_v4_usb3phy_regs_layout,
 
 	.has_phy_dp_com_ctrl	= true,
-	.is_dual_lane_phy	= true,
 
 	.dp_aux_init = qcom_qmp_v4_phy_dp_aux_init,
 	.configure_dp_tx = qcom_qmp_v4_phy_configure_dp_tx,
@@ -2117,7 +2105,7 @@ static int qmp_combo_power_on(struct phy *phy)
 	/* Tx, Rx, and PCS configurations */
 	qmp_combo_configure_lane(tx, cfg->regs, cfg->tx_tbl, cfg->tx_tbl_num, 1);
 
-	if (cfg->is_dual_lane_phy) {
+	if (cfg->lanes >= 2) {
 		qmp_combo_configure_lane(qphy->tx2, cfg->regs, cfg->tx_tbl,
 					 cfg->tx_tbl_num, 2);
 	}
@@ -2128,7 +2116,7 @@ static int qmp_combo_power_on(struct phy *phy)
 
 	qmp_combo_configure_lane(rx, cfg->regs, cfg->rx_tbl, cfg->rx_tbl_num, 1);
 
-	if (cfg->is_dual_lane_phy) {
+	if (cfg->lanes >= 2) {
 		qmp_combo_configure_lane(qphy->rx2, cfg->regs, cfg->rx_tbl,
 					 cfg->rx_tbl_num, 2);
 	}
@@ -2725,7 +2713,7 @@ static int qmp_combo_create(struct device *dev, struct device_node *np, int id,
 	if (cfg->pcs_usb_offset)
 		qphy->pcs_usb = qphy->pcs + cfg->pcs_usb_offset;
 
-	if (cfg->is_dual_lane_phy) {
+	if (cfg->lanes >= 2) {
 		qphy->tx2 = devm_of_iomap(dev, np, 3, NULL);
 		if (IS_ERR(qphy->tx2))
 			return PTR_ERR(qphy->tx2);
-- 
2.35.1


  parent reply	other threads:[~2022-09-20  7:40 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  7:38 [PATCH 00/17] phy: qcom-qmp: config and misc clean ups Johan Hovold
2022-09-20  7:38 ` [PATCH 01/17] phy: qcom-qmp-pcie: drop unused type from config Johan Hovold
2022-09-20 13:50   ` Neil Armstrong
2022-09-22 14:30   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 02/17] phy: qcom-qmp-pcie-msm8996: " Johan Hovold
2022-09-20 13:50   ` Neil Armstrong
2022-09-22 14:31   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 03/17] phy: qcom-qmp-ufs: " Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 14:31   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 04/17] phy: qcom-qmp-usb: " Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 14:33   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 05/17] phy: qcom-qmp-pcie: drop init and exit wrappers Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 17:58   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 06/17] phy: qcom-qmp-usb: " Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 17:58   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 07/17] phy: qcom-qmp: drop unused forward declarations Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 14:31   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 08/17] phy: qcom-qmp-pcie-msm8996: drop unused kernel doc Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 17:58   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 09/17] phy: qcom-qmp-pcie: drop unused mode field Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 17:58   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 10/17] phy: qcom-qmp-pcie: drop unused config field Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 17:59   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 11/17] phy: qcom-qmp: drop unused index field Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 17:59   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 12/17] phy: qcom-qmp-pcie: consolidate lane config Johan Hovold
2022-09-20 13:51   ` Neil Armstrong
2022-09-22 18:06   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 13/17] phy: qcom-qmp-pcie-msm8996: rename nlanes config Johan Hovold
2022-09-20 13:52   ` Neil Armstrong
2022-09-22 18:01   ` Dmitry Baryshkov
2022-09-20  7:38 ` Johan Hovold [this message]
2022-09-20 13:52   ` [PATCH 14/17] phy: qcom-qmp-combo: consolidate lane config Neil Armstrong
2022-09-22 18:01   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 15/17] phy: qcom-qmp-ufs: " Johan Hovold
2022-09-20 13:52   ` Neil Armstrong
2022-09-22 18:02   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 16/17] phy: qcom-qmp-usb: " Johan Hovold
2022-09-20 13:52   ` Neil Armstrong
2022-09-22 18:02   ` Dmitry Baryshkov
2022-09-20  7:38 ` [PATCH 17/17] phy: qcom-qmp-combo: drop redundant DP config flag Johan Hovold
2022-09-20 13:52   ` Neil Armstrong
2022-09-20 14:08     ` Johan Hovold
2022-09-22 18:02   ` Dmitry Baryshkov
2022-09-23  6:14     ` Johan Hovold
2022-09-24  5:30 ` [PATCH 00/17] phy: qcom-qmp: config and misc clean ups Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220920073826.20811-15-johan+linaro@kernel.org \
    --to=johan+linaro@kernel.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=kishon@ti.com \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox