Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84c6b597 authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: phy-msm-ssusb-qmp: Add support to set/clear PCS clamp enable reg



Clearing CLAMP_EN_B in USB3_UNI_PCS_CLAMP_ENABLE reg, clamps the PHY data
inputs and enables USB3 autonomous mode. CLAMP_EN_B is set power on default
which disables USB3 autonomous mode.

Change-Id: I6e9c4404a18e0ee2d10f1e58ccd1ca52de27e5bf
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 700cd930
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ Optional properties:
 - qcom,core-voltage-level: This property must be a list of three integer
   values (no, min, max) where each value represents either a voltage in
   microvolts or a value corresponding to voltage corner.
 - "pcs_clamp_enable_reg" : Clamps the phy data inputs and enables USB3
   autonomous mode.

Example:
	ssphy0: ssphy@f9b38000 {
+14 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -112,6 +112,7 @@ struct msm_ssphy_qmp {
	struct usb_phy		phy;
	void __iomem		*base;
	void __iomem		*vls_clamp_reg;
	void __iomem		*pcs_clamp_enable_reg;
	void __iomem		*tcsr_usb3_dp_phymode;

	struct regulator	*vdd;
@@ -187,6 +188,8 @@ static void msm_ssusb_qmp_clamp_enable(struct msm_ssphy_qmp *phy, bool val)
	case USB_PHY_TYPE_USB3_OR_DP:
	case USB_PHY_TYPE_USB3:
		writel_relaxed(!!val, phy->vls_clamp_reg);
		if (phy->pcs_clamp_enable_reg)
			writel_relaxed(!val, phy->pcs_clamp_enable_reg);
		break;
	default:
		break;
@@ -891,6 +894,16 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)
		}
	}

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
			"pcs_clamp_enable_reg");
	if (res) {
		phy->pcs_clamp_enable_reg = devm_ioremap_resource(dev, res);
		if (IS_ERR(phy->pcs_clamp_enable_reg)) {
			dev_err(dev, "err getting pcs_clamp_enable_reg address.\n");
			return PTR_ERR(phy->pcs_clamp_enable_reg);
		}
	}

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
			"tcsr_usb3_dp_phymode");
	if (res) {