From: wenping.zhang Date: Fri, 14 Oct 2016 01:22:51 +0000 (+0800) Subject: phy: phy-rockchip-typec: add dp 4 lane + usb2.0 support. X-Git-Tag: firefly_0821_release~1397 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=10a5f482857dd4b7af188f78e321690b1735b3b8;p=firefly-linux-kernel-4.4.55.git phy: phy-rockchip-typec: add dp 4 lane + usb2.0 support. Change-Id: I7b67959a1bd05694f929d1d437d55d2b7b015b46 Signed-off-by: wenping.zhang --- diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index 4b1ee77ef2c5..d8b80dfc3eae 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -265,6 +265,8 @@ struct usb3phy_reg { struct rockchip_usb3phy_port_cfg { struct usb3phy_reg typec_conn_dir; struct usb3phy_reg usb3tousb2_en; + struct usb3phy_reg usb3host_disable; + struct usb3phy_reg usb3host_port; struct usb3phy_reg external_psm; struct usb3phy_reg pipe_status; }; @@ -559,12 +561,28 @@ static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode) tcphy_cfg_24m(tcphy); if (mode == MODE_DFP_DP) { + /* + * Config usb work in USB2.0 only mode, we need to ensure + * usb3 pd is enabled before access these regiters. + */ + property_enable(tcphy, &cfg->usb3tousb2_en, 1); + property_enable(tcphy, &cfg->usb3host_disable, 1); + property_enable(tcphy, &cfg->usb3host_port, 0); + tcphy_cfg_dp_pll(tcphy); for (i = 0; i < 4; i++) tcphy_dp_cfg_lane(tcphy, i); writel(PIN_ASSIGN_C_E, tcphy->base + PMA_LANE_CFG); } else { + /* + * Enable usb work in usb3.0, we need to ensure usb3 + * pd is enabled before access these registers. + */ + property_enable(tcphy, &cfg->usb3tousb2_en, 0); + property_enable(tcphy, &cfg->usb3host_disable, 0); + property_enable(tcphy, &cfg->usb3host_port, 1); + tcphy_cfg_usb3_pll(tcphy); tcphy_cfg_dp_pll(tcphy); if (tcphy->flip) { @@ -866,6 +884,16 @@ static int tcphy_parse_dt(struct rockchip_typec_phy *tcphy, if (ret) return ret; + ret = tcphy_get_param(dev, &cfg->usb3host_disable, + "rockchip,usb3-host-disable"); + if (ret) + return ret; + + ret = tcphy_get_param(dev, &cfg->usb3host_port, + "rockchip,usb3-host-port"); + if (ret) + return ret; + ret = tcphy_get_param(dev, &cfg->external_psm, "rockchip,external-psm"); if (ret)