Merge "usb: dwc3-msm: Prevent switch to peripheral for host-mode only core"

This commit is contained in:
qctecmdr 2021-02-19 22:41:24 -08:00 • committed by Gerrit - the friendly Code Review server
commit d7006445cf

View file

@ -3869,8 +3869,14 @@ static ssize_t mode_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct dwc3_msm *mdwc = dev_get_drvdata(dev);
struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
if (sysfs_streq(buf, "peripheral")) {
if (dwc->dr_mode == USB_DR_MODE_HOST) {
dev_err(dev, "Core supports host mode only.\n");
return -EINVAL;
}
mdwc->vbus_active = true;
mdwc->id_state = DWC3_ID_FLOAT;
} else if (sysfs_streq(buf, "host")) {