Skip to contentSkip to conversation

usb:host:xhci-plat: 64-bit dma addressing support

PATCH In review Feng Kan 1 participant 2 messages Nov 4, 2014 – Nov 14, 2014

Subsystems (2)
lore
Share & tools
lore

Feng Kan

author
#0 lore raw

PATCH v2 1/1 usb:host:xhci-plat: 64-bit dma addressing support

Use dma_addr_t to support 64-bit plaforms, which access beyond the default 32 bit address range.

---
Changes:
V2: fixed GKH's comment regarding not mark up the comment after
code change.

 drivers/usb/host/xhci-plat.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-plat.c +7 -3
index 3d78b0c..f75764f 100644
@@ -96,14 +96,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	/* Initialize dma_mask and coherent_dma_mask to 32-bits */
-	ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+	/*
+	 * Initialize dma_mask and coherent_dma_mask to valid DMA or bus
+	 * address for the platform.
+	 */
+	ret = dma_set_coherent_mask(&pdev->dev,
+					DMA_BIT_MASK(sizeof(dma_addr_t)*8));
 	if (ret)
 		return ret;
 	if (!pdev->dev.dma_mask)
 		pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
 	else
-		dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+		dma_set_mask(&pdev->dev, DMA_BIT_MASK(sizeof(dma_addr_t)*8));
 
 	hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
 	if (!hcd)
Signature · 1 line
1.9.1
author
#1 lore raw

Just want to ping this again to see if there is any comments, thanks.

Quoted 42 lines · Feng Kan

Use dma_addr_t to support 64-bit plaforms, which access beyond the default 32 bit address range.

---
Changes:
V2: fixed GKH's comment regarding not mark up the comment after
code change.

 drivers/usb/host/xhci-plat.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/host/xhci-plat.c +7 -4
index 3d78b0c..f75764f 100644
@@ -96,14 +96,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       /* Initialize dma_mask and coherent_dma_mask to 32-bits */
-       ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+       /*
+        * Initialize dma_mask and coherent_dma_mask to valid DMA or bus
+        * address for the platform.
+        */
+       ret = dma_set_coherent_mask(&pdev->dev,
+                                       DMA_BIT_MASK(sizeof(dma_addr_t)*8));
        if (ret)
                return ret;
        if (!pdev->dev.dma_mask)
                pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
        else
-               dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+               dma_set_mask(&pdev->dev, DMA_BIT_MASK(sizeof(dma_addr_t)*8));
 
        hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
        if (!hcd)
--

1.9.1