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

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

Merge changes I1f40d23f,I84c4b958,If343e4a6 into msm-4.14

* changes:
  usb: dwc3-msm: Remove qcom,no-vbus-vote-with-type-C property
  usb: dwc3-msm: Initialize mutex before registering extcon
  usb: phy: qmp: Make vls_clamp_reg optional
parents cc43db19 ee3daddc
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -72,8 +72,6 @@ Optional properties :
- qcom,pm-qos-latency: This represents max tolerable CPU latency in microsecs,
	which is used as a vote by driver to get max performance in perf mode.
- qcom,smmu-s1-bypass: If present, configure SMMU to bypass stage 1 translation.
- qcom,no-vbus-vote-with-type-C: If present, then do not try to get and enable VBUS
	regulator in type-C host mode from dwc3-msm driver.
- qcom,dbm-version: If present, specifies DBM version. Currently "1.4" or "1.5"
	are supported. If omitted, assume HW supports "1.5".
- qcom,reset-ep-after-lpm-resume: If present, dbm requires ep reset after
+6 −5
Original line number Diff line number Diff line
@@ -45,10 +45,8 @@ Required properties:
   "qcom,usb-ssphy-qmp-v2" or "qcom,usb-ssphy-qmp-usb3-or-dp" or
   "qcom,usb-ssphy-qmp-dp-combo"
 - reg: Address and length of the register set for the device
   Required regs are:
   Required reg-names entry must contain:
   "qmp_phy_base" : QMP PHY Base register set.
 - "vls_clamp_reg" : top-level CSR register to be written to enable phy vls
   clamp which allows phy to detect autonomous mode. (optional for USB DP PHY)
 - <supply-name>-supply: phandle to the regulator device tree node
   Required "supply-name" examples are:
	"vdd" : vdd supply for SSPHY digital circuit operation
@@ -61,7 +59,7 @@ Required properties:
   values (no, min, max) where each value represents either a voltage in
   microvolts or a value corresponding to voltage corner
 - qcom,qmp-phy-init-seq: QMP PHY initialization sequence with reg offset, its
   value, delay after register write. It is not must property to have for emulation.
   value, delay after register write.
 - qcom,qmp-phy-reg-offset: Provides important phy register offsets in an order
   defined in the phy driver.
   Provide below mentioned register offsets in order for non USB DP combo PHY:
@@ -80,6 +78,8 @@ Required properties:
   USB3_DP_COM_PHY_MODE_CTRL,
   USB3_DP_COM_TYPEC_CTRL,
   USB3_DP_COM_SWI_CTRL,

   Optional register for enabling/disabling VLS clamp if available:
   USB3_PCS_MISC_CLAMP_ENABLE

   Optional register for configuring USB Type-C port select if available:
@@ -96,6 +96,8 @@ Optional properties:
   super speed usb qmp phy.
   "pcs_clamp_enable_reg" : Clamps the phy data inputs and enables USB3
   autonomous mode.
   "vls_clamp_reg" : top-level CSR register to be written to enable phy vls
   clamp which allows phy to detect autonomous mode.
 - clocks: a list of phandles to the PHY clocks. Use as per
   Documentation/devicetree/bindings/clock/clock-bindings.txt
 - clock-names: Names of the clocks in 1-1 correspondence with the "clocks"
@@ -103,7 +105,6 @@ 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,emulation: Indicates that we are running on emulation platform.
 - 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.
+2 −8
Original line number Diff line number Diff line
@@ -234,8 +234,6 @@ struct dwc3_msm {
	bool			hc_died;
	/* for usb connector either type-C or microAB */
	bool			type_c;
	/* whether to vote for VBUS reg in host mode */
	bool			no_vbus_vote_type_c;

	struct extcon_dev	*extcon_vbus;
	struct extcon_dev	*extcon_id;
@@ -3388,9 +3386,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)
		mdwc->pm_qos_latency = 0;
	}

	mdwc->no_vbus_vote_type_c = of_property_read_bool(node,
					"qcom,no-vbus-vote-with-type-C");

	mutex_init(&mdwc->suspend_resume_mutex);
	/* Mark type-C as true by default */
	mdwc->type_c = true;

@@ -3416,7 +3412,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	if (ret)
		goto put_psy;

	mutex_init(&mdwc->suspend_resume_mutex);
	/* Update initial VBUS/ID state from extcon */
	if (mdwc->extcon_vbus && extcon_get_state(mdwc->extcon_vbus,
							EXTCON_USB))
@@ -3672,8 +3667,7 @@ static int dwc3_otg_start_host(struct dwc3_msm *mdwc, int on)
	 * IS_ERR: regulator could not be obtained, so skip using it
	 * Valid pointer otherwise
	 */
	if (!mdwc->vbus_reg && (!mdwc->type_c ||
				(mdwc->type_c && !mdwc->no_vbus_vote_type_c))) {
	if (!mdwc->vbus_reg) {
		mdwc->vbus_reg = devm_regulator_get_optional(mdwc->dev,
					"vbus_dwc3");
		if (IS_ERR(mdwc->vbus_reg) &&
+30 −46
Original line number Diff line number Diff line
@@ -132,12 +132,10 @@ struct msm_ssphy_qmp {
	bool			clk_enabled;
	bool			cable_connected;
	bool			in_suspend;
	bool			emulation;
	unsigned int		*phy_reg; /* revision based offset */
	unsigned int		*qmp_phy_init_seq;
	int			init_seq_len;
	unsigned int		*qmp_phy_reg_offset;
	u32			*phy_reg; /* revision based offset */
	int			reg_offset_cnt;
	u32			*qmp_phy_init_seq;
	int			init_seq_len;
};

static const struct of_device_id msm_usb_id_table[] = {
@@ -187,6 +185,7 @@ static void msm_ssusb_qmp_clamp_enable(struct msm_ssphy_qmp *phy, bool val)
		break;
	case USB_PHY_TYPE_USB3_OR_DP:
	case USB_PHY_TYPE_USB3:
		if (phy->vls_clamp_reg)
			writel_relaxed(!!val, phy->vls_clamp_reg);
		if (phy->pcs_clamp_enable_reg)
			writel_relaxed(!val, phy->pcs_clamp_enable_reg);
@@ -433,9 +432,6 @@ static int msm_ssphy_qmp_init(struct usb_phy *uphy)

	dev_dbg(uphy->dev, "Initializing QMP phy\n");

	if (phy->emulation)
		return 0;

	ret = msm_ssusb_qmp_ldo_enable(phy, 1);
	if (ret) {
		dev_err(phy->phy.dev,
@@ -843,11 +839,9 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)

	of_get_property(dev->of_node, "qcom,qmp-phy-reg-offset", &size);
	if (size) {
		phy->qmp_phy_reg_offset = devm_kzalloc(dev,
						size, GFP_KERNEL);
		if (phy->qmp_phy_reg_offset) {
			phy->reg_offset_cnt =
				(size / sizeof(*phy->qmp_phy_reg_offset));
		phy->phy_reg = devm_kzalloc(dev, size, GFP_KERNEL);
		if (phy->phy_reg) {
			phy->reg_offset_cnt = (size / sizeof(*phy->phy_reg));
			if (phy->reg_offset_cnt > USB3_PHY_REG_MAX) {
				dev_err(dev, "invalid reg offset count\n");
				return -EINVAL;
@@ -855,13 +849,11 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)

			of_property_read_u32_array(dev->of_node,
				"qcom,qmp-phy-reg-offset",
				phy->qmp_phy_reg_offset,
				phy->reg_offset_cnt);
				phy->phy_reg, phy->reg_offset_cnt);
		} else {
			dev_err(dev, "err mem alloc for qmp_phy_reg_offset\n");
			return -ENOMEM;
		}
		phy->phy_reg = phy->qmp_phy_reg_offset;
	} else {
		dev_err(dev, "err provide qcom,qmp-phy-reg-offset\n");
		return -EINVAL;
@@ -884,12 +876,12 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)
		goto err;
	}

	if (phy->phy.type != USB_PHY_TYPE_USB3_AND_DP) {
		res = platform_get_resource_byname(pdev,
				IORESOURCE_MEM, "vls_clamp_reg");
	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
			"vls_clamp_reg");
	if (res) {
		phy->vls_clamp_reg = devm_ioremap_resource(dev, res);
		if (IS_ERR(phy->vls_clamp_reg)) {
			dev_err(dev, "couldn't find vls_clamp_reg address.\n");
			dev_err(dev, "err getting vls_clamp_reg address\n");
			return PTR_ERR(phy->vls_clamp_reg);
		}
	}
@@ -914,34 +906,26 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev)
		}
	}

	phy->emulation = of_property_read_bool(dev->of_node,
						"qcom,emulation");
	if (!phy->emulation) {
	of_get_property(dev->of_node, "qcom,qmp-phy-init-seq", &size);
	if (size) {
		if (size % sizeof(*phy->qmp_phy_init_seq)) {
			dev_err(dev, "invalid init_seq_len\n");
			return -EINVAL;
		}
			phy->qmp_phy_init_seq = devm_kzalloc(dev,
							size, GFP_KERNEL);
			if (phy->qmp_phy_init_seq) {
				phy->init_seq_len =
					(size / sizeof(*phy->qmp_phy_init_seq));

		phy->qmp_phy_init_seq = devm_kzalloc(dev, size, GFP_KERNEL);
		if (!phy->qmp_phy_init_seq)
			return -ENOMEM;

		phy->init_seq_len = (size / sizeof(*phy->qmp_phy_init_seq));
		of_property_read_u32_array(dev->of_node,
				"qcom,qmp-phy-init-seq",
				phy->qmp_phy_init_seq,
				phy->init_seq_len);
			} else {
				dev_err(dev, "error allocating memory for phy_init_seq\n");
				return -EINVAL;
			}
	} else {
		dev_err(dev, "error need qmp-phy-init-seq\n");
		return -EINVAL;
	}
	}

	/* Set default core voltage values */
	phy->core_voltage_levels[CORE_LEVEL_NONE] = 0;