From nobody Thu Apr 2 23:03:13 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8855C54EE9 for ; Tue, 20 Sep 2022 07:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbiITHjv (ORCPT ); Tue, 20 Sep 2022 03:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbiITHjE (ORCPT ); Tue, 20 Sep 2022 03:39:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6CAF61103; Tue, 20 Sep 2022 00:39:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F28D624F7; Tue, 20 Sep 2022 07:39:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB8DFC4FEE4; Tue, 20 Sep 2022 07:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663659540; bh=3mWP8IJ6A2mLlaC+zaZQsvzQRfJ1SsQlxyXRCQSRzJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hh1N+odv1v6NiJSkvmmG4ZlhM4WaMQCJXqaeyNrjLGHQZT/dTvgBvUfzoOUW/K5Qk GvzgQWKd6AqpuAjw02KUXCclwbzb16Az6ViQ7rViSepCKPamjsoYXolyFyRlUm9+fz AcgMiyp06eA2DUMjRs0MH5e4g7XwZJPo/osM8qQk2tKRJqRg0O2mz1lrVz3aJgLuCS DPQVz7ocd+snbvmjKKvcXdJpR9Q3FHbDWYepMIF2KMfL9LCgDUwJYd8/Q14wcaTpzt m3L26iv9O6JERce+soWw6FBoSToEjS319PYkjiEl2V+Tzgo6z2QZdwq9ottGOQczA1 HxDOsE4/0ocYg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oaXqQ-0005RM-ML; Tue, 20 Sep 2022 09:39:02 +0200 From: Johan Hovold To: Vinod Koul Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Kishon Vijay Abraham I , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 16/17] phy: qcom-qmp-usb: consolidate lane config Date: Tue, 20 Sep 2022 09:38:25 +0200 Message-Id: <20220920073826.20811-17-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220920073826.20811-1-johan+linaro@kernel.org> References: <20220920073826.20811-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/phy/qualcomm/phy-qcom-qmp-usb.c | 52 ++++++++++--------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c b/drivers/phy/qualcomm= /phy-qcom-qmp-usb.c index a34320738f60..f01b3022a10d 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-usb.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-usb.c @@ -1429,8 +1429,7 @@ static const struct qmp_phy_init_tbl sc8280xp_usb3_un= iphy_pcs_tbl[] =3D { =20 /* struct qmp_phy_cfg - per-PHY initialization config */ struct qmp_phy_cfg { - /* number of lanes provided by phy */ - int nlanes; + int lanes; =20 /* Init sequence for PHY blocks - serdes, tx, rx, pcs */ const struct qmp_phy_init_tbl *serdes_tbl; @@ -1470,8 +1469,6 @@ struct qmp_phy_cfg { =20 /* 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; =20 /* Offset from PCS to PCS_USB region */ unsigned int pcs_usb_offset; @@ -1603,7 +1600,7 @@ static const char * const qmp_phy_vreg_l[] =3D { }; =20 static const struct qmp_phy_cfg ipq8074_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D ipq8074_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(ipq8074_usb3_serdes_tbl), @@ -1627,7 +1624,7 @@ static const struct qmp_phy_cfg ipq8074_usb3phy_cfg = =3D { }; =20 static const struct qmp_phy_cfg msm8996_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D msm8996_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(msm8996_usb3_serdes_tbl), @@ -1651,7 +1648,7 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = =3D { }; =20 static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), @@ -1678,11 +1675,10 @@ static const struct qmp_phy_cfg qmp_v3_usb3phy_cfg = =3D { .pwrdn_delay_max =3D POWER_DOWN_DELAY_US_MAX, =20 .has_phy_dp_com_ctrl =3D true, - .is_dual_lane_phy =3D true, }; =20 static const struct qmp_phy_cfg sc7180_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D qmp_v3_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(qmp_v3_usb3_serdes_tbl), @@ -1709,11 +1705,10 @@ static const struct qmp_phy_cfg sc7180_usb3phy_cfg = =3D { .pwrdn_delay_max =3D POWER_DOWN_DELAY_US_MAX, =20 .has_phy_dp_com_ctrl =3D true, - .is_dual_lane_phy =3D true, }; =20 static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D sc8280xp_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sc8280xp_usb3_uniphy_serdes_tbl), @@ -1741,7 +1736,7 @@ static const struct qmp_phy_cfg sc8280xp_usb3_uniphy_= cfg =3D { }; =20 static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D qmp_v3_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(qmp_v3_usb3_uniphy_serdes_tbl), @@ -1769,7 +1764,7 @@ static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cf= g =3D { }; =20 static const struct qmp_phy_cfg msm8998_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D msm8998_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(msm8998_usb3_serdes_tbl), @@ -1790,12 +1785,10 @@ static const struct qmp_phy_cfg msm8998_usb3phy_cfg= =3D { .start_ctrl =3D SERDES_START | PCS_START, .pwrdn_ctrl =3D SW_PWRDN, .phy_status =3D PHYSTATUS, - - .is_dual_lane_phy =3D true, }; =20 static const struct qmp_phy_cfg sm8150_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D sm8150_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_serdes_tbl), @@ -1826,11 +1819,10 @@ static const struct qmp_phy_cfg sm8150_usb3phy_cfg = =3D { .pwrdn_delay_max =3D POWER_DOWN_DELAY_US_MAX, =20 .has_phy_dp_com_ctrl =3D true, - .is_dual_lane_phy =3D true, }; =20 static const struct qmp_phy_cfg sm8150_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), @@ -1861,7 +1853,7 @@ static const struct qmp_phy_cfg sm8150_usb3_uniphy_cf= g =3D { }; =20 static const struct qmp_phy_cfg sm8250_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D sm8150_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_serdes_tbl), @@ -1891,11 +1883,10 @@ static const struct qmp_phy_cfg sm8250_usb3phy_cfg = =3D { .pwrdn_delay_max =3D POWER_DOWN_DELAY_US_MAX, =20 .has_phy_dp_com_ctrl =3D true, - .is_dual_lane_phy =3D true, }; =20 static const struct qmp_phy_cfg sm8250_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), @@ -1926,7 +1917,7 @@ static const struct qmp_phy_cfg sm8250_usb3_uniphy_cf= g =3D { }; =20 static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), @@ -1957,7 +1948,7 @@ static const struct qmp_phy_cfg sdx55_usb3_uniphy_cfg= =3D { }; =20 static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), @@ -1988,7 +1979,7 @@ static const struct qmp_phy_cfg sdx65_usb3_uniphy_cfg= =3D { }; =20 static const struct qmp_phy_cfg sm8350_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D sm8150_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_serdes_tbl), @@ -2018,11 +2009,10 @@ static const struct qmp_phy_cfg sm8350_usb3phy_cfg = =3D { .pwrdn_delay_max =3D POWER_DOWN_DELAY_US_MAX, =20 .has_phy_dp_com_ctrl =3D true, - .is_dual_lane_phy =3D true, }; =20 static const struct qmp_phy_cfg sm8350_usb3_uniphy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 1, =20 .serdes_tbl =3D sm8150_usb3_uniphy_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(sm8150_usb3_uniphy_serdes_tbl), @@ -2053,7 +2043,7 @@ static const struct qmp_phy_cfg sm8350_usb3_uniphy_cf= g =3D { }; =20 static const struct qmp_phy_cfg qcm2290_usb3phy_cfg =3D { - .nlanes =3D 1, + .lanes =3D 2, =20 .serdes_tbl =3D qcm2290_usb3_serdes_tbl, .serdes_tbl_num =3D ARRAY_SIZE(qcm2290_usb3_serdes_tbl), @@ -2074,8 +2064,6 @@ static const struct qmp_phy_cfg qcm2290_usb3phy_cfg = =3D { .start_ctrl =3D SERDES_START | PCS_START, .pwrdn_ctrl =3D SW_PWRDN, .phy_status =3D PHYSTATUS, - - .is_dual_lane_phy =3D true, }; =20 static void qmp_usb_configure_lane(void __iomem *base, @@ -2232,14 +2220,14 @@ static int qmp_usb_power_on(struct phy *phy) /* Tx, Rx, and PCS configurations */ qmp_usb_configure_lane(tx, cfg->regs, cfg->tx_tbl, cfg->tx_tbl_num, 1); =20 - if (cfg->is_dual_lane_phy) { + if (cfg->lanes >=3D 2) { qmp_usb_configure_lane(qphy->tx2, cfg->regs, cfg->tx_tbl, cfg->tx_tbl_num, 2); } =20 qmp_usb_configure_lane(rx, cfg->regs, cfg->rx_tbl, cfg->rx_tbl_num, 1); =20 - if (cfg->is_dual_lane_phy) { + if (cfg->lanes >=3D 2) { qmp_usb_configure_lane(qphy->rx2, cfg->regs, cfg->rx_tbl, cfg->rx_tbl_num, 2); } @@ -2613,7 +2601,7 @@ int qmp_usb_create(struct device *dev, struct device_= node *np, int id, if (cfg->pcs_usb_offset) qphy->pcs_usb =3D qphy->pcs + cfg->pcs_usb_offset; =20 - if (cfg->is_dual_lane_phy) { + if (cfg->lanes >=3D 2) { qphy->tx2 =3D devm_of_iomap(dev, np, 3, NULL); if (IS_ERR(qphy->tx2)) return PTR_ERR(qphy->tx2); --=20 2.35.1