From 6a9f858a8de468e6b74e3fd884ff73fea72bb1e2 Mon Sep 17 00:00:00 2001 From: Meng Dongyang Date: Mon, 29 Jan 2018 18:30:39 +0800 Subject: [PATCH] phy: rockchip: rockchip-inno-usb2: tuning pre-emphasize for rk3399 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In current code, the pre-emphasize in eop state and chirp state are disabled only if we add “rockchip,u2phy-tuning” property in RK3399 dts, But we find that if we enable the pre-emphasize of sop/eop/chirp state for rk3399 by default, it will cause usb2 compliance test item - EL_8 and EL_9 failure, so disable the pre-emphasize of sop/eop/chirp state by default. And this can also help to avoid mis-trigger the disconnect detection or high-speed handshake failure. Change-Id: I5ceac9c88de4cdae5af904e973124c194f7718f6 Signed-off-by: Meng Dongyang --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 1eeffd1ed2bb..078d535585cc 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1827,6 +1827,30 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy) struct device_node *node = rphy->dev->of_node; int ret = 0; + if (rphy->phy_cfg->reg == 0xe450) { + /* + * Disable the pre-emphasize in eop state + * and chirp state to avoid mis-trigger the + * disconnect detection and also avoid hs + * handshake fail for PHY0. + */ + ret |= regmap_write(rphy->grf, 0x4480, + GENMASK(17, 16) | 0x0); + ret |= regmap_write(rphy->grf, 0x44b4, + GENMASK(17, 16) | 0x0); + } else { + /* + * Disable the pre-emphasize in eop state + * and chirp state to avoid mis-trigger the + * disconnect detection and also avoid hs + * handshake fail for PHY1. + */ + ret |= regmap_write(rphy->grf, 0x4500, + GENMASK(17, 16) | 0x0); + ret |= regmap_write(rphy->grf, 0x4534, + GENMASK(17, 16) | 0x0); + } + if (!of_property_read_bool(node, "rockchip,u2phy-tuning")) return ret; @@ -1842,17 +1866,6 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy) ret |= regmap_write(rphy->grf, 0x44b0, GENMASK(18, 16) | 0x07); - /* - * Disable the pre-emphasize in eop state - * and chirp state to avoid mis-trigger the - * disconnect detection and also avoid hs - * handshake fail for PHY0. - */ - ret |= regmap_write(rphy->grf, 0x4480, - GENMASK(17, 16) | 0x0); - ret |= regmap_write(rphy->grf, 0x44b4, - GENMASK(17, 16) | 0x0); - /* * Set PHY0 A port squelch trigger point to 125mv */ @@ -1870,17 +1883,6 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy) ret |= regmap_write(rphy->grf, 0x4530, GENMASK(18, 16) | 0x07); - /* - * Disable the pre-emphasize in eop state - * and chirp state to avoid mis-trigger the - * disconnect detection and also avoid hs - * handshake fail for PHY1. - */ - ret |= regmap_write(rphy->grf, 0x4500, - GENMASK(17, 16) | 0x0); - ret |= regmap_write(rphy->grf, 0x4534, - GENMASK(17, 16) | 0x0); - /* * Set PHY1 A port squelch trigger point to 125mv */