• J
    usb: dwc2: Fix dr_mode validation · 5268ed9d
    John Youn 提交于
    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: NJohn Youn <johnyoun@synopsys.com>
    Signed-off-by: NFelipe Balbi <balbi@ti.com>
    5268ed9d
platform.c 15.7 KB