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

Commit 1a561f8a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: phy: qmp: Add support for PHY PLL calibration"

parents 5707db31 70dc0eb3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ Optional properties:
   deemphasis value to be used for overriding into SSPHY register.
 - qcom,primary-phy: If present, indicates this is a secondary PHY and is
   dependent on the primary PHY referenced by this phandle.
 - qcom,override-pll-calibration: If present, program PHY register to overrride
	the automatic PHY PLL calibration settings.

Example:
	ssphy@f9200000 {
+14 −1
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@
#define QSERDES_COM_DIV_FRAC_START1		0xF8
#define QSERDES_COM_DIV_FRAC_START2		0xFC

#define QSERDES_COM_PLL_VCOTAIL_EN		0x004
#define QSERDES_COM_DIV_FRAC_START3		0x100
#define QSERDES_COM_DEC_START2			0x104
#define QSERDES_COM_PLL_CRCTRL			0x10C
@@ -108,6 +109,7 @@ struct msm_ssphy_qmp {
	bool			cable_connected;
	bool			in_suspend;
	bool			ext_vbus_id;
	bool			override_pll_cal;
};

static inline char *get_cable_status_str(struct msm_ssphy_qmp *phy)
@@ -287,6 +289,9 @@ static int msm_ssphy_qmp_init(struct usb_phy *uphy)
	writel_relaxed(0x01, phy->base + PCIE_USB3_PHY_POWER_DOWN_CONTROL);

	writel_relaxed(0x08, phy->base + QSERDES_COM_SYSCLK_EN_SEL_TXBAND);

	if (phy->override_pll_cal)
		writel_relaxed(0xE1, phy->base + QSERDES_COM_PLL_VCOTAIL_EN);
	writel_relaxed(0x82, phy->base + QSERDES_COM_DEC_START1);
	writel_relaxed(0x03, phy->base + QSERDES_COM_DEC_START2);
	writel_relaxed(0xD5, phy->base + QSERDES_COM_DIV_FRAC_START1);
@@ -310,6 +315,9 @@ static int msm_ssphy_qmp_init(struct usb_phy *uphy)

	/* Calibration Settings */
	writel_relaxed(0x90, phy->base + QSERDES_COM_RESETSM_CNTRL);
	if (phy->override_pll_cal)
		writel_relaxed(0x07, phy->base + QSERDES_COM_RESETSM_CNTRL2);
	else
		writel_relaxed(0x05, phy->base + QSERDES_COM_RESETSM_CNTRL2);

	writel_relaxed(0x20, phy->base + QSERDES_COM_RES_CODE_START_SEG1);
@@ -618,6 +626,11 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)
	if (of_property_read_bool(dev->of_node, "qcom,vbus-valid-override"))
		phy->phy.flags |= PHY_VBUS_VALID_OVERRIDE;

	phy->override_pll_cal = of_property_read_bool(dev->of_node,
					"qcom,override-pll-calibration");
	if (phy->override_pll_cal)
		dev_dbg(dev, "Override PHY PLL calibration is enabled.\n");

	phy->phy.dev			= dev;
	phy->phy.init			= msm_ssphy_qmp_init;
	phy->phy.set_suspend		= msm_ssphy_qmp_set_suspend;