From 3a0c8b9280414f7da4ce28751eb2b9cf423319a6 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 11 May 2016 18:26:31 -0700 Subject: [PATCH] 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 --- Documentation/devicetree/bindings/usb/msm-phy.txt | 4 +++- drivers/usb/phy/phy-msm-ssusb-qmp.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/msm-phy.txt b/Documentation/devicetree/bindings/usb/msm-phy.txt index 929fdee7157b..e909c67ca20a 100644 --- a/Documentation/devicetree/bindings/usb/msm-phy.txt +++ b/Documentation/devicetree/bindings/usb/msm-phy.txt @@ -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. diff --git a/drivers/usb/phy/phy-msm-ssusb-qmp.c b/drivers/usb/phy/phy-msm-ssusb-qmp.c index 8b4fd8c0436a..ed1b2d2d7730 100644 --- a/drivers/usb/phy/phy-msm-ssusb-qmp.c +++ b/drivers/usb/phy/phy-msm-ssusb-qmp.c @@ -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) {