mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
usb: dwc3: Add a function to check properties
Add a function to check properties and call it from probe. This will allow us to add check code without bloating the probe function. This needs to be done after dwc3_get_properties() and dwc3_core_init() so that all the properties and hardware configs are available. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
a987a906e9
commit
7ac51a12ea
1 changed files with 33 additions and 26 deletions
|
@ -1019,6 +1019,38 @@ static void dwc3_get_properties(struct dwc3 *dwc)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dwc3_check_params(struct dwc3 *dwc)
|
||||||
|
{
|
||||||
|
struct device *dev = dwc->dev;
|
||||||
|
|
||||||
|
/* Check the maximum_speed parameter */
|
||||||
|
switch (dwc->maximum_speed) {
|
||||||
|
case USB_SPEED_LOW:
|
||||||
|
case USB_SPEED_FULL:
|
||||||
|
case USB_SPEED_HIGH:
|
||||||
|
case USB_SPEED_SUPER:
|
||||||
|
case USB_SPEED_SUPER_PLUS:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_err(dev, "invalid maximum_speed parameter %d\n",
|
||||||
|
dwc->maximum_speed);
|
||||||
|
/* fall through */
|
||||||
|
case USB_SPEED_UNKNOWN:
|
||||||
|
/* default to superspeed */
|
||||||
|
dwc->maximum_speed = USB_SPEED_SUPER;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* default to superspeed plus if we are capable.
|
||||||
|
*/
|
||||||
|
if (dwc3_is_usb31(dwc) &&
|
||||||
|
(DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
|
||||||
|
DWC3_GHWPARAMS3_SSPHY_IFC_GEN2))
|
||||||
|
dwc->maximum_speed = USB_SPEED_SUPER_PLUS;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int dwc3_probe(struct platform_device *pdev)
|
static int dwc3_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
|
@ -1110,32 +1142,7 @@ static int dwc3_probe(struct platform_device *pdev)
|
||||||
goto err4;
|
goto err4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the maximum_speed parameter */
|
dwc3_check_params(dwc);
|
||||||
switch (dwc->maximum_speed) {
|
|
||||||
case USB_SPEED_LOW:
|
|
||||||
case USB_SPEED_FULL:
|
|
||||||
case USB_SPEED_HIGH:
|
|
||||||
case USB_SPEED_SUPER:
|
|
||||||
case USB_SPEED_SUPER_PLUS:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_err(dev, "invalid maximum_speed parameter %d\n",
|
|
||||||
dwc->maximum_speed);
|
|
||||||
/* fall through */
|
|
||||||
case USB_SPEED_UNKNOWN:
|
|
||||||
/* default to superspeed */
|
|
||||||
dwc->maximum_speed = USB_SPEED_SUPER;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* default to superspeed plus if we are capable.
|
|
||||||
*/
|
|
||||||
if (dwc3_is_usb31(dwc) &&
|
|
||||||
(DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
|
|
||||||
DWC3_GHWPARAMS3_SSPHY_IFC_GEN2))
|
|
||||||
dwc->maximum_speed = USB_SPEED_SUPER_PLUS;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = dwc3_core_init_mode(dwc);
|
ret = dwc3_core_init_mode(dwc);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue