Commit 857512d0 authored by Mian Yousaf Kaukab's avatar Mian Yousaf Kaukab Committed by Felipe Balbi

usb: dwc2: force dr_mode in case of configuration mismatch

If dual role configuration is not selected, check and force dr_mode
based on the selected configuration.
Signed-off-by: default avatarMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Tested-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
Tested-by: default avatarDinh Nguyen <dinguyen@opensource.altera.com>
Tested-by: default avatarJohn Youn <johnyoun@synopsys.com>
Acked-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent fa50bff6
......@@ -221,6 +221,17 @@ static int dwc2_driver_probe(struct platform_device *dev)
(unsigned long)res->start, hsotg->regs);
hsotg->dr_mode = usb_get_dr_mode(&dev->dev);
if (IS_ENABLED(CONFIG_USB_DWC2_HOST) &&
hsotg->dr_mode != USB_DR_MODE_HOST) {
hsotg->dr_mode = USB_DR_MODE_HOST;
dev_warn(hsotg->dev,
"Configuration mismatch. Forcing host mode\n");
} else if (IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) &&
hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) {
hsotg->dr_mode = USB_DR_MODE_PERIPHERAL;
dev_warn(hsotg->dev,
"Configuration mismatch. Forcing peripheral mode\n");
}
/*
* Attempt to find a generic PHY, then look for an old style
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment