usb: dwc3: drd: use helper to get role-switch-default-mode
Use the new helper usb_get_role_switch_default_mode() to get property of "role-switch-default-mode" Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1626340078-29111-7-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
2037f2991d
commit
26f94fe8e7
|
@ -541,14 +541,10 @@ static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
|
||||||
static int dwc3_setup_role_switch(struct dwc3 *dwc)
|
static int dwc3_setup_role_switch(struct dwc3 *dwc)
|
||||||
{
|
{
|
||||||
struct usb_role_switch_desc dwc3_role_switch = {NULL};
|
struct usb_role_switch_desc dwc3_role_switch = {NULL};
|
||||||
const char *str;
|
|
||||||
u32 mode;
|
u32 mode;
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = device_property_read_string(dwc->dev, "role-switch-default-mode",
|
dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
|
||||||
&str);
|
if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
|
||||||
if (ret >= 0 && !strncmp(str, "host", strlen("host"))) {
|
|
||||||
dwc->role_switch_default_mode = USB_DR_MODE_HOST;
|
|
||||||
mode = DWC3_GCTL_PRTCAP_HOST;
|
mode = DWC3_GCTL_PRTCAP_HOST;
|
||||||
} else {
|
} else {
|
||||||
dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
|
dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
|
||||||
|
|
Loading…
Reference in New Issue