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

Commit da0d2c17 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3-msm: Read initial ID line state after core init



When booting with an A-type cable already attached, the initial
reading of the ID line state could trigger the ID work function to
execute before the DWC3 core has even initialized. As a result the
OTG driver will fail to be notified to start up in host mode. Fix
this by reading the line state after of_platform_populate().

CRs-fixed: 629312
Change-Id: I94f42812584a37de070dc7316f99c33cb9c67bca
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 97d5ac84
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -2469,16 +2469,6 @@ static int dwc3_msm_probe(struct platform_device *pdev)
					dev_err(&pdev->dev, "irqreq IDINT failed\n");
					goto disable_ref_clk;
				}

				local_irq_save(flags);
				/* Update initial ID state */
				mdwc->id_state =
					!!irq_read_line(mdwc->pmic_id_irq);
				if (mdwc->id_state == DWC3_ID_GROUND)
					queue_work(system_nrt_wq,
							&mdwc->id_work);
				local_irq_restore(flags);
				enable_irq_wake(mdwc->pmic_id_irq);
			}
		}

@@ -2699,6 +2689,16 @@ static int dwc3_msm_probe(struct platform_device *pdev)
	pm_runtime_set_active(mdwc->dev);
	pm_runtime_enable(mdwc->dev);

	/* Update initial ID state */
	if (mdwc->pmic_id_irq) {
		local_irq_save(flags);
		mdwc->id_state = !!irq_read_line(mdwc->pmic_id_irq);
		if (mdwc->id_state == DWC3_ID_GROUND)
			queue_work(system_nrt_wq, &mdwc->id_work);
		local_irq_restore(flags);
		enable_irq_wake(mdwc->pmic_id_irq);
	}

	if (of_property_read_bool(node, "qcom,reset_hsphy_sleep_clk_on_init")) {
		ret = clk_reset(mdwc->hsphy_sleep_clk, CLK_RESET_ASSERT);
		if (ret) {