From: Patrick Delaunay Date: Fri, 14 Jun 2019 13:08:32 +0200 Subject: [U-Boot] [PATCH 2/2] usb: dwc2: allow peripheral mode for OTG configuration In-Reply-To: <1560510512-15015-1-git-send-email-patrick.delaunay@st.com> References: <1560510512-15015-1-git-send-email-patrick.delaunay@st.com> Message-ID: <1560510512-15015-2-git-send-email-patrick.delaunay@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Allow device mode in DWC2 driver when device tree select the dr_mode "peripheral" or "otg". The device mode is not allowed when dr_mode = "host" in device tree. Signed-off-by: Patrick Delaunay --- drivers/usb/gadget/dwc2_udc_otg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 7e6b5fc..895f8c9 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -1042,7 +1042,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev) u32 tx_fifo_sz_array[DWC2_MAX_HW_ENDPOINTS]; int ret, i; - if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL) { + if (usb_get_dr_mode(node) != USB_DR_MODE_PERIPHERAL && + usb_get_dr_mode(node) != USB_DR_MODE_OTG) { dev_dbg(dev, "Invalid mode\n"); return -ENODEV; } -- 2.7.4