Skip to content

Commit

Permalink
usb: dwc3: set 'mode' based on selected Kconfig choices
Browse files Browse the repository at this point in the history
Now that machines may select dwc3's working mode (HOST only,
GADGET only or DUAL_ROLE) via Kconfig, let's set dwc3's mode
based on that, rather than fixing it to whatever hardware
says.

This way we can skip initializing Gadget/Host in case
we are using Host-only/Gadget-only mode respectively.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Vivek Gautam authored and Felipe Balbi committed Mar 18, 2013
1 parent b5a726b commit cd051da
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/usb/dwc3/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,12 @@ static int dwc3_probe(struct platform_device *pdev)
goto err1;
}

mode = DWC3_MODE(dwc->hwparams.hwparams0);
if (IS_ENABLED(CONFIG_USB_DWC3_HOST))
mode = DWC3_MODE_HOST;
else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
mode = DWC3_MODE_DEVICE;
else
mode = DWC3_MODE_DRD;

switch (mode) {
case DWC3_MODE_DEVICE:
Expand Down

0 comments on commit cd051da

Please sign in to comment.