phy: rockchip: rockchip-inno-usb2: tuning pre-emphasize for rk3399

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 <daniel.meng@rock-chips.com>
This commit is contained in:
Meng Dongyang 2018-01-29 18:30:39 +08:00 committed by Tao Huang
commit 6a9f858a8d

View file

@ -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
*/