From fc6a791259803fee75599123cbd45bcb9b010ad0 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 --- drivers/phy/phy-rockchip-inno-usb2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/phy/phy-rockchip-inno-usb2.c b/drivers/phy/phy-rockchip-inno-usb2.c index 9b3fe5d544dd..61f2e22bd3a5 100644 --- a/drivers/phy/phy-rockchip-inno-usb2.c +++ b/drivers/phy/phy-rockchip-inno-usb2.c @@ -1461,6 +1461,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 @@ -1483,6 +1489,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; -- 2.34.1