All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: linux-usb@vger.kernel.org
Cc: Marek Vasut <marex@denx.de>,
	Amelie Delaunay <amelie.delaunay@st.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Minas Harutyunyan <hminas@synopsys.com>
Subject: [PATCH] [RFC] usb: dwc2: Run the core connect in dwc2_hcd_init()
Date: Mon, 13 Apr 2020 16:31:07 +0200	[thread overview]
Message-ID: <20200413143107.181669-1-marex@denx.de> (raw)

On STM32MP1 without the STUSB1600 USB-C chip (i.e. with plain USB-OTG
micro-B plug with ID and VBUS detection), the USB OTG port only works
if a micro-B device (e.g. a USB stick) is plugged in first. Once this
is done, both micro-B device and host (e.g. a PC via a USB A-to-microB
cable) are correctly detected and recognized. If a USB host is plugged
in first (e.g. a PC), then the PC does not detect the STM32MP1 at all.

By running the core connect code in dwc2_hcd_init(), both device and
host are detected and the USB works as expected. However, it is not
clear whether this is the correct solution.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Amelie Delaunay <amelie.delaunay@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Minas Harutyunyan <hminas@synopsys.com>
To: linux-usb@vger.kernel.org
---
 drivers/usb/dwc2/hcd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index b90f858af960..ead605efeb24 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -5237,6 +5237,11 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
 
 	dwc2_enable_global_interrupts(hsotg);
 
+	dwc2_hsotg_core_init_disconnected(hsotg, false);
+	/* Enable ACG feature in device mode,if supported */
+	dwc2_enable_acg(hsotg);
+	dwc2_hsotg_core_connect(hsotg);
+
 	return 0;
 
 error4:
-- 
2.25.1


             reply	other threads:[~2020-04-13 14:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 14:31 Marek Vasut [this message]
2020-04-13 14:45 ` [PATCH] [RFC] usb: dwc2: Run the core connect in dwc2_hcd_init() Minas Harutyunyan
2020-04-13 14:54   ` Marek Vasut
2020-04-13 15:27     ` Minas Harutyunyan
2020-04-13 17:00       ` Marek Vasut
2020-04-14  7:14         ` Minas Harutyunyan
2020-04-14 12:18           ` Marek Vasut
2020-04-15  8:37             ` Minas Harutyunyan
2020-04-15 14:55               ` Marek Vasut
2020-04-15 15:10                 ` Minas Harutyunyan
2020-04-16  9:46                   ` Marek Vasut
2020-04-16 13:37                     ` Minas Harutyunyan
2020-04-16 14:31                       ` Marek Vasut
2020-04-17  9:00                         ` Minas Harutyunyan
2020-04-20 12:09                           ` Marek Vasut
2020-04-22 13:45                             ` Minas Harutyunyan
2020-04-22 14:21                               ` Marek Vasut
2020-05-14  0:10                                 ` Marek Vasut
2020-05-15  7:41                                   ` Minas Harutyunyan
2020-05-27  6:17                                     ` Minas Harutyunyan
2020-05-28 22:35                                       ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200413143107.181669-1-marex@denx.de \
    --to=marex@denx.de \
    --cc=amelie.delaunay@st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hminas@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.