Skip to content

Commit dd33111

Browse files
superna9999vinodkoul
authored andcommitted
phy: qcom: qmp-combo: introduce QMPPHY_MODE
Introduce an enum for the QMP Combo PHY modes, use it in the QMP commmon phy init function and default to COMBO mode. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> [konrad: some renaming and rewording] Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on Lenovo Thinkpad T14S Link: https://lore.kernel.org/r/20250807-topic-4ln_dp_respin-v4-4-43272d6eca92@oss.qualcomm.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 8639047 commit dd33111

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

drivers/phy/qualcomm/phy-qcom-qmp-combo.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262

6363
#define PHY_INIT_COMPLETE_TIMEOUT 10000
6464

65+
enum qmpphy_mode {
66+
QMPPHY_MODE_USB3DP = 0,
67+
QMPPHY_MODE_DP_ONLY,
68+
QMPPHY_MODE_USB3_ONLY,
69+
};
70+
6571
/* set of registers with offsets different per-PHY */
6672
enum qphy_reg_layout {
6773
/* PCS registers */
@@ -1844,6 +1850,7 @@ struct qmp_combo {
18441850

18451851
struct mutex phy_mutex;
18461852
int init_count;
1853+
enum qmpphy_mode qmpphy_mode;
18471854

18481855
struct phy *usb_phy;
18491856
enum phy_mode phy_mode;
@@ -3037,12 +3044,33 @@ static int qmp_combo_com_init(struct qmp_combo *qmp, bool force)
30373044
if (qmp->orientation == TYPEC_ORIENTATION_REVERSE)
30383045
val |= SW_PORTSELECT_VAL;
30393046
writel(val, com + QPHY_V3_DP_COM_TYPEC_CTRL);
3040-
writel(USB3_MODE | DP_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL);
30413047

3042-
/* bring both QMP USB and QMP DP PHYs PCS block out of reset */
3043-
qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL,
3044-
SW_DPPHY_RESET_MUX | SW_DPPHY_RESET |
3045-
SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET);
3048+
switch (qmp->qmpphy_mode) {
3049+
case QMPPHY_MODE_USB3DP:
3050+
writel(USB3_MODE | DP_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL);
3051+
3052+
/* bring both QMP USB and QMP DP PHYs PCS block out of reset */
3053+
qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL,
3054+
SW_DPPHY_RESET_MUX | SW_DPPHY_RESET |
3055+
SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET);
3056+
break;
3057+
3058+
case QMPPHY_MODE_DP_ONLY:
3059+
writel(DP_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL);
3060+
3061+
/* bring QMP DP PHY PCS block out of reset */
3062+
qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL,
3063+
SW_DPPHY_RESET_MUX | SW_DPPHY_RESET);
3064+
break;
3065+
3066+
case QMPPHY_MODE_USB3_ONLY:
3067+
writel(USB3_MODE, com + QPHY_V3_DP_COM_PHY_MODE_CTRL);
3068+
3069+
/* bring QMP USB PHY PCS block out of reset */
3070+
qphy_clrbits(com, QPHY_V3_DP_COM_RESET_OVRD_CTRL,
3071+
SW_USB3PHY_RESET_MUX | SW_USB3PHY_RESET);
3072+
break;
3073+
}
30463074

30473075
qphy_clrbits(com, QPHY_V3_DP_COM_SWI_CTRL, 0x03);
30483076
qphy_clrbits(com, QPHY_V3_DP_COM_SW_RESET, SW_RESET);
@@ -4053,6 +4081,12 @@ static int qmp_combo_probe(struct platform_device *pdev)
40534081
if (ret)
40544082
goto err_node_put;
40554083

4084+
/*
4085+
* The hw default is USB3_ONLY, but USB3+DP mode lets us more easily
4086+
* check both sub-blocks' init tables for blunders at probe time.
4087+
*/
4088+
qmp->qmpphy_mode = QMPPHY_MODE_USB3DP;
4089+
40564090
qmp->usb_phy = devm_phy_create(dev, usb_np, &qmp_combo_usb_phy_ops);
40574091
if (IS_ERR(qmp->usb_phy)) {
40584092
ret = PTR_ERR(qmp->usb_phy);

0 commit comments

Comments
 (0)