UPSTREAM: usb: dwc2: allow peripheral mode for OTG configuration

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.

Change-Id: Iede854cdf940f5e1ef14a7e394087ac97998213a
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit 7c654683464dc4cd89f9a8198e26336263390b57)
This commit is contained in:
Patrick Delaunay 2019-06-18 16:57:18 +02:00 committed by Frank Wang
parent aea37ef60f
commit ba6d0aabab
1 changed files with 2 additions and 1 deletions

View File

@ -1043,7 +1043,8 @@ static int dwc2_udc_otg_ofdata_to_platdata(struct udevice *dev)
void (*set_params)(struct dwc2_plat_otg_data *data);
int ret;
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;
}