usb: phy: qmp: Add support to select usb3 phy mode

qmp phy can run in display port mode or in usb3 mode.
It is recommended to explicitly select the usb3 phy
mode before programming the phy init sequence, since
TCSR_USB3_DP_PHYMODE register is commonly used to
select mode between display port driver as well as
ssphy driver.

Change-Id: I270596868762ccd4f2f2cc9b0daaca647a2bee88
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
This commit is contained in:
Hemant Kumar 2016-05-11 18:26:31 -07:00 committed by Jeevan Shriram
parent 81dd5e3f78
commit 3a0c8b9280
2 changed files with 18 additions and 1 deletions

View file

@ -116,7 +116,9 @@ Required properties:
USB3_PHY_START
Optional properties:
- reg: Additional register set of address and length to control QMP PHY
- reg: Additional register set of address and length to control QMP PHY are:
"tcsr_usb3_dp_phymode" : top-level CSR register to be written to select
super speed usb qmp phy.
- qcom,vbus-valid-override: If present, indicates VBUS pin is not connected to
the USB PHY and the controller must rely on external VBUS notification in
order to manually relay the notification to the SSPHY.

View file

@ -68,6 +68,7 @@ struct msm_ssphy_qmp {
struct usb_phy phy;
void __iomem *base;
void __iomem *vls_clamp_reg;
void __iomem *tcsr_usb3_dp_phymode;
struct regulator *vdd;
int vdd_levels[3]; /* none, low, high */
@ -269,6 +270,10 @@ static int msm_ssphy_qmp_init(struct usb_phy *uphy)
writel_relaxed(0x01,
phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);
/* select usb3 phy mode */
if (phy->tcsr_usb3_dp_phymode)
writel_relaxed(0x0, phy->tcsr_usb3_dp_phymode);
/* Make sure that above write completed to get PHY into POWER DOWN */
mb();
@ -612,6 +617,16 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)
return PTR_ERR(phy->vls_clamp_reg);
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"tcsr_usb3_dp_phymode");
if (res) {
phy->tcsr_usb3_dp_phymode = devm_ioremap_resource(dev, res);
if (IS_ERR(phy->tcsr_usb3_dp_phymode)) {
dev_err(dev, "err getting tcsr_usb3_dp_phymode addr\n");
return PTR_ERR(phy->tcsr_usb3_dp_phymode);
}
}
phy->emulation = of_property_read_bool(dev->of_node,
"qcom,emulation");
if (!phy->emulation) {