Skip to content

Commit fda182d

Browse files
dhdanggregkh
authored andcommitted
usb: xhci: configure 32-bit DMA if the controller does not support 64-bit DMA
This change avoids DMA error in the cases where dma_mask and coherent_dma_mask of a 32-bit controller get configured as DMA_BIT_MASK(64) when running on a 64-bit system. Signed-off-by: Duc Dang <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 579085b commit fda182d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/usb/host/xhci.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4913,6 +4913,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
49134913
!dma_set_mask(dev, DMA_BIT_MASK(64))) {
49144914
xhci_dbg(xhci, "Enabling 64-bit DMA addresses.\n");
49154915
dma_set_coherent_mask(dev, DMA_BIT_MASK(64));
4916+
} else {
4917+
/*
4918+
* This is to avoid error in cases where a 32-bit USB
4919+
* controller is used on a 64-bit capable system.
4920+
*/
4921+
retval = dma_set_mask(dev, DMA_BIT_MASK(32));
4922+
if (retval)
4923+
return retval;
4924+
xhci_dbg(xhci, "Enabling 32-bit DMA addresses.\n");
4925+
dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
49164926
}
49174927

49184928
xhci_dbg(xhci, "Calling HCD init\n");

0 commit comments

Comments
 (0)