usb: dwc2: Fix dr_mode validation
authorJohn Youn <John.Youn@synopsys.com>
Thu, 17 Dec 2015 19:16:31 +0000 (11:16 -0800)
committerFelipe Balbi <balbi@ti.com>
Tue, 22 Dec 2015 17:57:35 +0000 (11:57 -0600)
commit5268ed9d2e3b52f703f3661eef14cecbb2b572d4
tree847550f1122e545615311314c78faf4a7a42673d
parent6bea962053e76a4407f0d138184a8737eea960ee
usb: dwc2: Fix dr_mode validation

The dr_mode parameter was being checked against how the dwc2 module
was being configured at compile time. But it wasn't checked against
the hardware capabilities, nor were the hardware capabilities checked
against the compilation parameters.

This commit adds those checks and adjusts dr_mode to an appropriate
value, if needed. If the hardware capabilities and module compilation
do not match then we fail as it wouldn't be possible to run properly.

The hardware, module, and dr_mode, can each be set to host, device,
or otg. Check that all these values are compatible and adjust the
value of dr_mode if possible.

The following table summarizes the behavior:

                     actual
   HW  MOD dr_mode   dr_mode
 ------------------------------
  HST  HST  any    :  HST
  HST  DEV  any    :  ---
  HST  OTG  any    :  HST

  DEV  HST  any    :  ---
  DEV  DEV  any    :  DEV
  DEV  OTG  any    :  DEV

  OTG  HST  any    :  HST
  OTG  DEV  any    :  DEV
  OTG  OTG  any    :  dr_mode

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/platform.c
This page took 0.026444 seconds and 5 git commands to generate.