[PATCH 5.15 009/179] usb: dwc3: leave default DMA for PCI devices

From: Greg Kroah-Hartman
Date: Mon Nov 29 2021 - 18:02:34 EST


From: Fabio Aiuto <fabioaiuto83@xxxxxxxxx>

commit 47ce45906ca9870cf5267261f155fb7c70307cf0 upstream.

in case of a PCI dwc3 controller, leave the default DMA
mask. Calling of a 64 bit DMA mask breaks the driver on
cherrytrail based tablets like Cyberbook T116.

Fixes: 45d39448b4d0 ("usb: dwc3: support 64 bit DMA in platform driver")
Cc: stable <stable@xxxxxxxxxxxxxxx>
Reported-by: Hans De Goede <hdegoede@xxxxxxxxxx>
Tested-by: Fabio Aiuto <fabioaiuto83@xxxxxxxxx>
Tested-by: Hans de Goede <hdegoede@xxxxxxxxxx>
Signed-off-by: Fabio Aiuto <fabioaiuto83@xxxxxxxxx>
Link: https://lore.kernel.org/r/20211113142959.27191-1-fabioaiuto83@xxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/usb/dwc3/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1565,9 +1565,11 @@ static int dwc3_probe(struct platform_de

dwc3_get_properties(dwc);

- ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
- if (ret)
- return ret;
+ if (!dwc->sysdev_is_parent) {
+ ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64));
+ if (ret)
+ return ret;
+ }

dwc->reset = devm_reset_control_array_get_optional_shared(dev);
if (IS_ERR(dwc->reset))