Skip to content

Commit 993cc87

Browse files
Nagarjuna Kristamgregkh
authored andcommitted
usb: host: xhci-tegra: Set DMA mask correctly
The Falcon microcontroller that runs the XUSB firmware and which is responsible for exposing the XHCI interface can address only 40 bits of memory. Typically that's not a problem because Tegra devices don't have enough system memory to exceed those 40 bits. However, if the ARM SMMU is enable on Tegra186 and later, the addresses passed to the XUSB controller can be anywhere in the 48-bit IOV address space of the ARM SMMU. Since the DMA/IOMMU API starts allocating from the top of the IOVA space, the Falcon microcontroller is not able to load the firmware successfully. Fix this by setting the DMA mask to 40 bits, which will force the DMA API to map the buffer for the firmware to an IOVA that is addressable by the Falcon. Signed-off-by: Nagarjuna Kristam <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1902a01 commit 993cc87

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/usb/host/xhci-tegra.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,16 @@ static int tegra_xusb_probe(struct platform_device *pdev)
11941194

11951195
tegra_xusb_config(tegra, regs);
11961196

1197+
/*
1198+
* The XUSB Falcon microcontroller can only address 40 bits, so set
1199+
* the DMA mask accordingly.
1200+
*/
1201+
err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40));
1202+
if (err < 0) {
1203+
dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
1204+
goto put_rpm;
1205+
}
1206+
11971207
err = tegra_xusb_load_firmware(tegra);
11981208
if (err < 0) {
11991209
dev_err(&pdev->dev, "failed to load firmware: %d\n", err);

0 commit comments

Comments
 (0)