public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: tegra: fix hardlock with invalid dr mode
@ 2020-01-27  2:35 Peter Geis
       [not found] ` <20200127023548.27107-1-pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Geis @ 2020-01-27  2:35 UTC (permalink / raw)
  To: Peter Chen, Thierry Reding, Dmitry Osipenko
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Peter Geis

The ci_hdrc_tegra driver does not currently support dual role mode, but
it does not explicitly prevent its use.
Certain devices support dual role mode, but not automatic role switch.
This can cause the device to lock up during initialization of the
driver.

Detect this state by checking for the extcon phandle when dual role mode
is set to otg.
If it doesn't exist request the driver to only enable manual role
switching.

Fixes: dfebb5f ("usb: chipidea: Add support for Tegra20/30/114/124")
Signed-off-by: Peter Geis <pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/chipidea/ci_hdrc_tegra.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
index 7455df0ede49..2f6f6ce3e8f5 100644
--- a/drivers/usb/chipidea/ci_hdrc_tegra.c
+++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
@@ -89,6 +89,13 @@ static int tegra_udc_probe(struct platform_device *pdev)
 	udc->data.usb_phy = udc->phy;
 	udc->data.capoffset = DEF_CAPOFFSET;
 
+	/* check the dual mode and warn about bad configurations */
+	if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_OTG &&
+	   !of_property_read_bool(pdev->dev.of_node, "extcon")) {
+		dev_warn(&pdev->dev, "no extcon registered, otg unavailable");
+		udc->data.flags |= CI_HDRC_DUAL_ROLE_NOT_OTG;
+	}
+
 	udc->dev = ci_hdrc_add_device(&pdev->dev, pdev->resource,
 				      pdev->num_resources, &udc->data);
 	if (IS_ERR(udc->dev)) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-02-05 11:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-27  2:35 [PATCH] usb: chipidea: tegra: fix hardlock with invalid dr mode Peter Geis
     [not found] ` <20200127023548.27107-1-pgwipeout-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-01-27  7:17   ` Greg KH
     [not found]     ` <20200127071758.GD279449-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2020-01-27 15:25       ` Peter Geis
     [not found]         ` <CAMdYzYqctkfqhHN0-WDvX9kKdXH-AVir193SpcrR_t3K=VN=0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-01-27 15:38           ` Dmitry Osipenko
2020-01-31  5:27   ` Peter Chen
2020-01-31 20:43     ` Peter Geis
     [not found]       ` <CAMdYzYqwz9HLsjvc1hDmovzWqiV_Vswe57d_gWhwBnvb2aNPyQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-01  6:13         ` Peter Chen
2020-02-03 17:22           ` Peter Geis
     [not found]             ` <CAMdYzYrbvsTunwxJLcC_-ZhczsQfyDLOjTnZ+eorb325qO-QhA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-04  7:44               ` Peter Chen
2020-02-04 14:35                 ` Peter Geis
     [not found]                   ` <CAMdYzYo8Vgw8h=LtfLnQNF4j-rVzgKJTp1hCyf7BFKrdhAhAHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-05 11:17                     ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox