summaryrefslogtreecommitdiff
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2020-06-10 19:01:54 +0800
committerPeter Chen <peter.chen@nxp.com>2020-06-17 10:06:18 +0800
commit1a418446c32d897aa4695bfe44ad4947ed54513a (patch)
tree46c8e271a2b51bc61b10cd05c42da9cfb0accb5c /drivers/usb/phy
parentf45a6bb1d43588e89f54d7bac3db6a202fbece56 (diff)
MLK-23765 usb: phy: mxs: increase the TVDPSRC_ON value
The default 40ms is the minimum value according to BC 1.2 spec, it works not well for Type-C port when connected with DCP charger. Like this ticket described, the DCP charger will be recognized as SDP. After increasing TVDPSRC_ON value to 240ms, the Type-C port could work well with DCP charger. imx8dxl mek, imx7ulp evk and imx8qxp mek are tested. Reviewed-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-mxs-usb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 299eb6be79b8..e692e88a6374 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -139,6 +139,7 @@
#define DCD_CONTROL 0x800
#define DCD_CLOCK (DCD_CONTROL + 0x4)
#define DCD_STATUS (DCD_CONTROL + 0x8)
+#define DCD_TIMER1 (DCD_CONTROL + 0x14)
#define DCD_CONTROL_SR BIT(25)
#define DCD_CONTROL_START BIT(24)
@@ -161,6 +162,9 @@
#define DCD_CDP_PORT BIT(17)
#define DCD_DCP_PORT (BIT(16) | BIT(17))
+#define DCD_TVDPSRC_ON_MASK GENMASK(9, 0)
+#define DCD_TVDPSRC_ON_VALUE 0xf0 /* 240ms */
+
#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy)
/* Do disconnection between PHY and controller without vbus */
@@ -888,6 +892,11 @@ static int mxs_phy_dcd_start(struct mxs_phy *mxs_phy)
writel(((mxs_phy->clk_rate / 1000000) << 2) | DCD_CLOCK_MHZ,
base + DCD_CLOCK);
+ value = readl(base + DCD_TIMER1);
+ value &= ~DCD_TVDPSRC_ON_MASK;
+ value |= DCD_TVDPSRC_ON_VALUE;
+ writel(value, base + DCD_TIMER1);
+
value = readl(base + DCD_CONTROL);
value &= ~DCD_CONTROL_IE;
writel(value | DCD_CONTROL_BC12, base + DCD_CONTROL);