]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
phy: qcom: qmp-usbc: Move USB-only init to usb_power_on
authorXiangxu Yin <xiangxu.yin@oss.qualcomm.com>
Mon, 15 Dec 2025 12:42:03 +0000 (20:42 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 23 Dec 2025 17:41:04 +0000 (23:11 +0530)
The current implementation programs USB-specific registers in
qmp_usbc_com_init(), which is shared by both USB and DP modes. This
causes unnecessary configuration when the PHY is used for DP.

Move USB-only register setup from com_init to qmp_usbc_usb_power_on,
so it runs only for USB mode.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Xiangxu Yin <xiangxu.yin@oss.qualcomm.com>
Link: https://patch.msgid.link/20251215-add-displayport-support-for-qcs615-platform-v8-7-cbc72c88a44e@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c

index a6431e6d55866df5b5c2cca7d25b43864f5c05b5..c8e0f9574ba66187214ebdae2442d7a5bc466584 100644 (file)
@@ -30,6 +30,8 @@
 #include "phy-qcom-qmp-pcs-misc-v3.h"
 
 #define PHY_INIT_COMPLETE_TIMEOUT              10000
+#define SW_PORTSELECT_VAL                      BIT(0)
+#define SW_PORTSELECT_MUX                      BIT(1)
 
 /* set of registers with offsets different per-PHY */
 enum qphy_reg_layout {
@@ -531,8 +533,6 @@ static int qmp_usbc_com_init(struct phy *phy)
 {
        struct qmp_usbc *qmp = phy_get_drvdata(phy);
        const struct qmp_phy_cfg *cfg = qmp->cfg;
-       void __iomem *pcs = qmp->pcs;
-       u32 val = 0;
        int ret;
 
        ret = regulator_bulk_enable(cfg->num_vregs, qmp->vregs);
@@ -557,16 +557,6 @@ static int qmp_usbc_com_init(struct phy *phy)
        if (ret)
                goto err_assert_reset;
 
-       qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN);
-
-#define SW_PORTSELECT_VAL                      BIT(0)
-#define SW_PORTSELECT_MUX                      BIT(1)
-       /* Use software based port select and switch on typec orientation */
-       val = SW_PORTSELECT_MUX;
-       if (qmp->orientation == TYPEC_ORIENTATION_REVERSE)
-               val |= SW_PORTSELECT_VAL;
-       writel(val, qmp->pcs_misc);
-
        return 0;
 
 err_assert_reset:
@@ -599,6 +589,14 @@ static int qmp_usbc_usb_power_on(struct phy *phy)
        unsigned int val;
        int ret;
 
+       qphy_setbits(qmp->pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN);
+
+       /* Use software based port select and switch on typec orientation */
+       val = SW_PORTSELECT_MUX;
+       if (qmp->orientation == TYPEC_ORIENTATION_REVERSE)
+               val |= SW_PORTSELECT_VAL;
+       writel(val, qmp->pcs_misc);
+
        qmp_configure(qmp->dev, qmp->serdes, cfg->serdes_tbl,
                      cfg->serdes_tbl_num);