usb: phy-msm-ssusb-qmp: Make vls_clamp_reg as optional

Currently the SSUSB QMP PHY driver mandates that vls_clamp_reg be
passed from the DTSI. But this register cannot be accessed on a
platform on which Linux is a guest OS. This can lead to errors
when trying to enable autonomous mode. Work around this situation
by making the vls_clamp_reg property as optional.

Change-Id: Idb103d9b7bda717a5f12689951a7452c46aa76dd
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
This commit is contained in:
Ajay Agarwal 2018-07-25 12:25:16 +05:30 committed by Gerrit - the friendly Code Review server
parent b77f7d2943
commit 53324ddb60
2 changed files with 16 additions and 13 deletions

View file

@ -95,8 +95,6 @@ Required properties:
- reg: Address and length of the register set for the device
Required regs are:
"qmp_phy_base" : QMP PHY Base register set.
- "vls_clamp_reg" : top-level CSR register to be written to enable phy vls
clamp which allows phy to detect autonomous mode.
- <supply-name>-supply: phandle to the regulator device tree node
Required "supply-name" examples are:
"vdd" : vdd supply for SSPHY digital circuit operation
@ -125,6 +123,8 @@ Required properties:
Optional properties:
- reg: Additional register set of address and length to control QMP PHY are:
"vls_clamp_reg" : top-level CSR register to be written to enable phy vls
clamp which allows phy to detect autonomous mode.
"tcsr_usb3_dp_phymode" : top-level CSR register to be written to select
super speed usb qmp phy.
- clocks: a list of phandles to the PHY clocks. Use as per

View file

@ -473,11 +473,13 @@ static int msm_ssphy_qmp_set_suspend(struct usb_phy *uphy, int suspend)
}
if (suspend) {
if (phy->cable_connected)
msm_ssusb_qmp_enable_autonomous(phy, 1);
else
if (phy->cable_connected) {
if (phy->vls_clamp_reg)
msm_ssusb_qmp_enable_autonomous(phy, 1);
} else {
writel_relaxed(0x00,
phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);
}
/* Make sure above write completed with PHY */
wmb();
@ -509,7 +511,8 @@ static int msm_ssphy_qmp_set_suspend(struct usb_phy *uphy, int suspend)
writel_relaxed(0x01,
phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);
} else {
msm_ssusb_qmp_enable_autonomous(phy, 0);
if (phy->vls_clamp_reg)
msm_ssusb_qmp_enable_autonomous(phy, 0);
}
/* Make sure that above write completed with PHY */
@ -648,13 +651,13 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"vls_clamp_reg");
if (!res) {
dev_err(dev, "failed getting vls_clamp_reg\n");
return -ENODEV;
}
phy->vls_clamp_reg = devm_ioremap_resource(dev, res);
if (IS_ERR(phy->vls_clamp_reg)) {
dev_err(dev, "couldn't find vls_clamp_reg address.\n");
return PTR_ERR(phy->vls_clamp_reg);
dev_dbg(dev, "vls_clamp_reg not passed\n");
} else {
phy->vls_clamp_reg = devm_ioremap_resource(dev, res);
if (IS_ERR(phy->vls_clamp_reg)) {
dev_err(dev, "couldn't find vls_clamp_reg address.\n");
return PTR_ERR(phy->vls_clamp_reg);
}
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,