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

Commit 4d7140a4 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: phy: msm: Add support for overriding SSPHY deemphasis setting



TX deemphasis value can be different from platform to platform.
This value has to be set to suitable value to pass USB3 complaince
test. Hence add support for overriding this deemphasis value from
device tree.

CRs-Fixed: 536912
Change-Id: Ic3c2213fc0d090407057525115eae1351ecc4668
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 27c6afde
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ Optional properties:
 - 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.
 - qcom,deemphasis-value: This property if present represents ss phy
   deemphasis value to be used for overriding into SSPHY register.

Example:
	ssphy@f9200000 {
@@ -66,4 +68,5 @@ Example:
		vdd-supply = <&pm8841_s2_corner>;
		vdda18-supply = <&pm8941_l6>;
		qcom,vdd-voltage-level = <1 5 7>;
		qcom,deemphasis-value = <26>;
	};
+15 −1
Original line number Diff line number Diff line
@@ -24,6 +24,10 @@
#include <linux/usb/phy.h>
#include <linux/usb/msm_hsusb.h>

static int ss_phy_override_deemphasis;
module_param(ss_phy_override_deemphasis, int, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(ss_phy_override_deemphasis, "Override SSPHY demphasis value");

/* QSCRATCH SSPHY control registers */
#define SS_PHY_CTRL_REG			0x30
#define SS_PHY_PARAM_CTRL_1		0x34
@@ -52,6 +56,7 @@ struct msm_ssphy {
	struct regulator	*vdd;
	struct regulator	*vdda18;
	int			vdd_levels[3]; /* none, low, high */
	int			deemphasis_val;
};

static int msm_ssusb_config_vdd(struct msm_ssphy *phy, int high)
@@ -271,6 +276,11 @@ static int msm_ssphy_set_params(struct usb_phy *uphy)
	 */
	data = msm_ssusb_read_phycreg(phy->base, 0x1002);
	data &= ~0x3F80;
	if (ss_phy_override_deemphasis)
		phy->deemphasis_val = ss_phy_override_deemphasis;
	if (phy->deemphasis_val)
		data |= (phy->deemphasis_val << 7);
	else
		data |= (0x16 << 7);
	data &= ~0x7F;
	data |= (0x7F | (1 << 14));
@@ -432,6 +442,10 @@ static int msm_ssphy_probe(struct platform_device *pdev)
	if (of_property_read_bool(dev->of_node, "qcom,vbus-valid-override"))
		phy->phy.flags |= PHY_VBUS_VALID_OVERRIDE;

	if (of_property_read_u32(dev->of_node, "qcom,deemphasis-value",
						&phy->deemphasis_val))
		dev_dbg(dev, "unable to read ssphy deemphasis value\n");

	phy->phy.dev			= dev;
	phy->phy.init			= msm_ssphy_init;
	phy->phy.set_suspend		= msm_ssphy_set_suspend;