Skip to content

Commit 4031cd9

Browse files
ChiYuan Huanggregkh
authored andcommitted
usb: typec: tcpci_mt6360: Update for BMC PHY setting
Update MT6360 BMC PHY Tx/Rx setting for the compatibility. Macpaul reported this CtoDP cable attention message cannot be received from MT6360 TCPC. But actually, attention message really sent from UFP_D device. After RD's comment, there may be BMC PHY Tx/Rx setting causes this issue. Below's the detailed TCPM log and DP attention message didn't received from 6360 TCPCI. [ 1206.367775] Identity: 0000:0000.0000 [ 1206.416570] Alternate mode 0: SVID 0xff01, VDO 1: 0x00000405 [ 1206.447378] AMS DFP_TO_UFP_ENTER_MODE start [ 1206.447383] PD TX, header: 0x1d6f [ 1206.449393] PD TX complete, status: 0 [ 1206.454110] PD RX, header: 0x184f [1] [ 1206.456867] Rx VDM cmd 0xff018144 type 1 cmd 4 len 1 [ 1206.456872] AMS DFP_TO_UFP_ENTER_MODE finished [ 1206.456873] cc:=4 [ 1206.473100] AMS STRUCTURED_VDMS start [ 1206.473103] PD TX, header: 0x2f6f [ 1206.475397] PD TX complete, status: 0 [ 1206.480442] PD RX, header: 0x2a4f [1] [ 1206.483145] Rx VDM cmd 0xff018150 type 1 cmd 16 len 2 [ 1206.483150] AMS STRUCTURED_VDMS finished [ 1206.483151] cc:=4 [ 1206.505643] AMS STRUCTURED_VDMS start [ 1206.505646] PD TX, header: 0x216f [ 1206.507933] PD TX complete, status: 0 [ 1206.512664] PD RX, header: 0x1c4f [1] [ 1206.515456] Rx VDM cmd 0xff018151 type 1 cmd 17 len 1 [ 1206.515460] AMS STRUCTURED_VDMS finished [ 1206.515461] cc:=4 Fixes: e1aefcd ("usb typec: mt6360: Add support for mt6360 Type-C driver") Cc: stable <[email protected]> Reported-by: Macpaul Lin <[email protected]> Tested-by: Macpaul Lin <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: ChiYuan Huang <[email protected]> Signed-off-by: Fabien Parent <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b81ac43 commit 4031cd9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/usb/typec/tcpm/tcpci_mt6360.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515

1616
#include "tcpci.h"
1717

18+
#define MT6360_REG_PHYCTRL1 0x80
19+
#define MT6360_REG_PHYCTRL3 0x82
20+
#define MT6360_REG_PHYCTRL7 0x86
1821
#define MT6360_REG_VCONNCTRL1 0x8C
1922
#define MT6360_REG_MODECTRL2 0x8F
2023
#define MT6360_REG_SWRESET 0xA0
2124
#define MT6360_REG_DEBCTRL1 0xA1
2225
#define MT6360_REG_DRPCTRL1 0xA2
2326
#define MT6360_REG_DRPCTRL2 0xA3
2427
#define MT6360_REG_I2CTORST 0xBF
28+
#define MT6360_REG_PHYCTRL11 0xCA
29+
#define MT6360_REG_RXCTRL1 0xCE
2530
#define MT6360_REG_RXCTRL2 0xCF
2631
#define MT6360_REG_CTDCTRL2 0xEC
2732

@@ -106,6 +111,27 @@ static int mt6360_tcpc_init(struct tcpci *tcpci, struct tcpci_data *tdata)
106111
if (ret)
107112
return ret;
108113

114+
/* BMC PHY */
115+
ret = mt6360_tcpc_write16(regmap, MT6360_REG_PHYCTRL1, 0x3A70);
116+
if (ret)
117+
return ret;
118+
119+
ret = regmap_write(regmap, MT6360_REG_PHYCTRL3, 0x82);
120+
if (ret)
121+
return ret;
122+
123+
ret = regmap_write(regmap, MT6360_REG_PHYCTRL7, 0x36);
124+
if (ret)
125+
return ret;
126+
127+
ret = mt6360_tcpc_write16(regmap, MT6360_REG_PHYCTRL11, 0x3C60);
128+
if (ret)
129+
return ret;
130+
131+
ret = regmap_write(regmap, MT6360_REG_RXCTRL1, 0xE8);
132+
if (ret)
133+
return ret;
134+
109135
/* Set shipping mode off, AUTOIDLE on */
110136
return regmap_write(regmap, MT6360_REG_MODECTRL2, 0x7A);
111137
}

0 commit comments

Comments
 (0)