mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
Revert "UPSTREAM: usb: dwc3: core: Move the mode setting to the right place"
This reverts commit1047560640. This commit1047560will reinit dwc3 controller mode when resuming dwc3 core. Generally, this patch can be used for "dr_mode = host", "dr_mode = peripheral" and "dr_mode = otg". However, rockchip dwc3 core don't support otg function, but only support DRD mode. So on rockchip platform, we set dr_mode to otg for DRD mode, then switch host and peripheral dynamically by extcon notifier. Also, we will enable dwc3 to be a wakeup source and enable usb3 power domain in suspend mode if usb device is pluged in. So dwc3 controller will not lost the mode when resuming dwc3 core. Change-Id: I0ee4f5b02d4504e853d8ef81df3df9a8a4ac284f Signed-off-by: William Wu <wulf@rock-chips.com>
This commit is contained in:
@@ -689,21 +689,6 @@ static int dwc3_core_init(struct dwc3 *dwc)
|
||||
goto err4;
|
||||
}
|
||||
|
||||
switch (dwc->dr_mode) {
|
||||
case USB_DR_MODE_PERIPHERAL:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
|
||||
break;
|
||||
case USB_DR_MODE_HOST:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
|
||||
break;
|
||||
case USB_DR_MODE_OTG:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
|
||||
break;
|
||||
default:
|
||||
dev_warn(dwc->dev, "Unsupported mode %d\n", dwc->dr_mode);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err4:
|
||||
@@ -801,6 +786,7 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
|
||||
|
||||
switch (dwc->dr_mode) {
|
||||
case USB_DR_MODE_PERIPHERAL:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
|
||||
ret = dwc3_gadget_init(dwc);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
@@ -809,6 +795,7 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
|
||||
}
|
||||
break;
|
||||
case USB_DR_MODE_HOST:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
|
||||
ret = dwc3_host_init(dwc);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
@@ -817,6 +804,7 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
|
||||
}
|
||||
break;
|
||||
case USB_DR_MODE_OTG:
|
||||
dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
|
||||
ret = dwc3_host_init(dwc);
|
||||
if (ret) {
|
||||
if (ret != -EPROBE_DEFER)
|
||||
|
||||
Reference in New Issue
Block a user