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

Commit 4809dcba 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: msm-hsphy: Support block reset using TCSR"

parents 44a34cae a8e7ec0f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -15,6 +15,10 @@ Required properties:
   microvolts or a value corresponding to voltage corner

Optional properties:
 - reg: Address and length of the TCSR register to be written when performing
   a block reset, as well as to intialize the internal MUX to select the
   correct controller. If present this must be the second register listed.

 - qcom,hsphy-init: Init value used to override HSPHY parameters into
   QSCRATCH register. This 32-bit value represents parameters as follows:
		bits 0-5   PARAMETER_OVERRIDE_A
+27 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ MODULE_PARM_DESC(override_phy_init, "Override HSPHY Init Seq");
#define DPDMHV_INT_MASK			(0xFC0)
#define ALT_INTERRUPT_MASK		(0xFFF)

#define TCSR_USB30_CONTROL		BIT(8)
#define TCSR_HSPHY_ARES			BIT(11)

#define USB_HSPHY_3P3_VOL_MIN			3050000 /* uV */
#define USB_HSPHY_3P3_VOL_MAX			3300000 /* uV */
#define USB_HSPHY_3P3_HPM_LOAD			16000	/* uA */
@@ -79,6 +82,7 @@ MODULE_PARM_DESC(override_phy_init, "Override HSPHY Init Seq");
struct msm_hsphy {
	struct usb_phy		phy;
	void __iomem		*base;
	void __iomem		*tcsr;
	int			hsphy_init_seq;

	struct regulator	*vdd;
@@ -214,6 +218,15 @@ static int msm_hsphy_init(struct usb_phy *uphy)
{
	struct msm_hsphy *phy = container_of(uphy, struct msm_hsphy, phy);

	if (phy->tcsr) {
		u32 val = readl_relaxed(phy->tcsr);

		/* Assert/deassert TCSR Reset */
		writel_relaxed((val | TCSR_HSPHY_ARES), phy->tcsr);
		usleep(1000);
		writel_relaxed((val & ~TCSR_HSPHY_ARES), phy->tcsr);
	}

	/*
	 * HSPHY Initialization: Enable UTMI clock and clamp enable HVINTs,
	 * and disable RETENTION (power-on default is ENABLED)
@@ -345,6 +358,20 @@ static int msm_hsphy_probe(struct platform_device *pdev)
		goto err_ret;
	}

	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	if (res) {
		phy->tcsr = devm_ioremap_nocache(dev, res->start,
						 resource_size(res));
		if (!phy->tcsr) {
			dev_err(dev, "tcsr ioremap failed\n");
			return -ENODEV;
		}

		/* switch MUX to let SNPS controller use the primary HSPHY */
		writel_relaxed(readl_relaxed(phy->tcsr) | TCSR_USB30_CONTROL,
				phy->tcsr);
	}

	ret = of_property_read_u32_array(dev->of_node, "qcom,vdd-voltage-level",
					 (u32 *) phy->vdd_levels,
					 ARRAY_SIZE(phy->vdd_levels));