From bf64cf12226f9ba49d795c793f454312a3add1d7 Mon Sep 17 00:00:00 2001 From: Meng Dongyang Date: Mon, 17 Apr 2017 14:11:58 +0800 Subject: [PATCH] phy: rockchip-inno-usb2: tuning USB 2.0 squelch detection threshold According to USB 2.0 Spec Table 7-7, the High-speed squelch detection threshold Min 100mV and Max 150mV, and we set USB 2.0 PHY0 and PHY1 squelch detection threshold to 150mV by default, so if the amplitude of differential voltage envelope is < 150 mV, the USB 2.0 PHYs envelope detector will indicate it as squelch. On RK3399 box, if we connect usb device with a 4 meter cable, we can see that the impedance of U2 cable is too big according to the eye-diagram test report, and this cause serious signal attenuation at the end of receiver, the amplitude of differential voltage falls below 150mV. This patch aims to reduce the PHY0 and PHY1 otg-ports squelch detection threshold to 125mV (host-ports still use 150mV by default), this is helpful to increase USB 2.0 PHY compatibility. Change-Id: Iec8b4043a3440d6f2a5fb18ff59ac0f4988019e9 Signed-off-by: Meng Dongyang Signed-off-by: Frank Wang --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index ff6f1bd539b5..d61249f9cb7f 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1471,6 +1471,12 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy) GENMASK(17, 16) | 0x0); ret |= regmap_write(rphy->grf, 0x44b4, GENMASK(17, 16) | 0x0); + + /* + * Set PHY0 A port squelch trigger point to 125mv + */ + ret |= regmap_write(rphy->grf, 0x4480, + GENMASK(30, 30) | 0x4000); } else { /* * Set max ODT compensation voltage and @@ -1493,6 +1499,12 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy) GENMASK(17, 16) | 0x0); ret |= regmap_write(rphy->grf, 0x4534, GENMASK(17, 16) | 0x0); + + /* + * Set PHY1 A port squelch trigger point to 125mv + */ + ret |= regmap_write(rphy->grf, 0x4500, + GENMASK(30, 30) | 0x4000); } return ret;