diff options
Diffstat (limited to 'drivers/usb/dwc3/core.c')
| -rw-r--r-- | drivers/usb/dwc3/core.c | 64 | 
1 files changed, 39 insertions, 25 deletions
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index eb69eb9f06c8..9069984fe5cf 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -386,6 +386,13 @@ static int dwc3_core_init(struct dwc3 *dwc)  	}  	dwc->revision = reg; +	/* Handle USB2.0-only core configuration */ +	if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) == +			DWC3_GHWPARAMS3_SSPHY_IFC_DIS) { +		if (dwc->maximum_speed == USB_SPEED_SUPER) +			dwc->maximum_speed = USB_SPEED_HIGH; +	} +  	/* issue device SoftReset too */  	timeout = jiffies + msecs_to_jiffies(500);  	dwc3_writel(dwc->regs, DWC3_DCTL, DWC3_DCTL_CSFTRST); @@ -656,6 +663,31 @@ static int dwc3_probe(struct platform_device *pdev)  		return -ENODEV;  	} +	dwc->xhci_resources[0].start = res->start; +	dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + +					DWC3_XHCI_REGS_END; +	dwc->xhci_resources[0].flags = res->flags; +	dwc->xhci_resources[0].name = res->name; + +	res->start += DWC3_GLOBALS_REGS_START; + +	/* +	 * Request memory region but exclude xHCI regs, +	 * since it will be requested by the xhci-plat driver. +	 */ +	regs = devm_ioremap_resource(dev, res); +	if (IS_ERR(regs)) +		return PTR_ERR(regs); + +	dwc->regs	= regs; +	dwc->regs_size	= resource_size(res); +	/* +	 * restore res->start back to its original value so that, +	 * in case the probe is deferred, we don't end up getting error in +	 * request the memory region the next time probe is called. +	 */ +	res->start -= DWC3_GLOBALS_REGS_START; +  	if (node) {  		dwc->maximum_speed = of_usb_get_maximum_speed(node); @@ -676,28 +708,9 @@ static int dwc3_probe(struct platform_device *pdev)  	if (ret)  		return ret; -	dwc->xhci_resources[0].start = res->start; -	dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + -					DWC3_XHCI_REGS_END; -	dwc->xhci_resources[0].flags = res->flags; -	dwc->xhci_resources[0].name = res->name; - -	res->start += DWC3_GLOBALS_REGS_START; - -	/* -	 * Request memory region but exclude xHCI regs, -	 * since it will be requested by the xhci-plat driver. -	 */ -	regs = devm_ioremap_resource(dev, res); -	if (IS_ERR(regs)) -		return PTR_ERR(regs); -  	spin_lock_init(&dwc->lock);  	platform_set_drvdata(pdev, dwc); -	dwc->regs	= regs; -	dwc->regs_size	= resource_size(res); -  	dev->dma_mask	= dev->parent->dma_mask;  	dev->dma_parms	= dev->parent->dma_parms;  	dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask); @@ -786,20 +799,21 @@ static int dwc3_remove(struct platform_device *pdev)  {  	struct dwc3	*dwc = platform_get_drvdata(pdev); +	dwc3_debugfs_exit(dwc); +	dwc3_core_exit_mode(dwc); +	dwc3_event_buffers_cleanup(dwc); +	dwc3_free_event_buffers(dwc); +  	usb_phy_set_suspend(dwc->usb2_phy, 1);  	usb_phy_set_suspend(dwc->usb3_phy, 1);  	phy_power_off(dwc->usb2_generic_phy);  	phy_power_off(dwc->usb3_generic_phy); +	dwc3_core_exit(dwc); +  	pm_runtime_put_sync(&pdev->dev);  	pm_runtime_disable(&pdev->dev); -	dwc3_debugfs_exit(dwc); -	dwc3_core_exit_mode(dwc); -	dwc3_event_buffers_cleanup(dwc); -	dwc3_free_event_buffers(dwc); -	dwc3_core_exit(dwc); -  	return 0;  }  |