usb: dwc_otg: set dma_mask 32bit for both device and host mode
authorlyz <lyz@rock-chips.com>
Mon, 15 Dec 2014 06:27:40 +0000 (14:27 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 24 Dec 2014 10:50:05 +0000 (18:50 +0800)
drivers/usb/dwc_otg_310/dwc_otg_driver.c
drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c

index fba497d60663f3a1559b2335c4ce1518c81d0879..cbd3f364e37c7ebb1aa5106803a0c572c0391dbe 100755 (executable)
@@ -1015,6 +1015,13 @@ static int host20_driver_probe(struct platform_device *_dev)
        dev_dbg(&_dev->dev, "base=0x%08x\n",
                (unsigned)dwc_otg_device->os_dep.base);
 
+       /* Set device flags indicating whether the HCD supports DMA. */
+       if (!_dev->dev.dma_mask)
+               _dev->dev.dma_mask = &_dev->dev.coherent_dma_mask;
+       retval = dma_set_coherent_mask(&_dev->dev, DMA_BIT_MASK(32));
+       if (retval)
+               goto clk_disable;
+
        /*
         * Initialize driver data to point to the global DWC_otg
         * Device structure.
@@ -1391,6 +1398,13 @@ static int otg20_driver_probe(struct platform_device *_dev)
        dev_dbg(&_dev->dev, "base=0x%08x\n",
                (unsigned)dwc_otg_device->os_dep.base);
 
+       /* Set device flags indicating whether the HCD supports DMA. */
+       if (!_dev->dev.dma_mask)
+               _dev->dev.dma_mask = &_dev->dev.coherent_dma_mask;
+       retval = dma_set_coherent_mask(&_dev->dev, DMA_BIT_MASK(32));
+       if (retval)
+               goto clk_disable;
+
        /*
         * Initialize driver data to point to the global DWC_otg
         * Device structure.
index b726c90baf3c238d7e9ff36e77938979f3684012..18a10d8ab261ed308deab20f351725c65831251f 100755 (executable)
@@ -451,21 +451,9 @@ int otg20_hcd_init(struct platform_device *_dev)
        dwc_otg_device_t *otg_dev = dwc_get_device_platform_data(_dev);
        int retval = 0;
        int irq;
-       static u64 usb_dmamask = 0xffffffffUL;
 
        DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT\n");
 
-       /* Set device flags indicating whether the HCD supports DMA. */
-       if (dwc_otg_is_dma_enable(otg_dev->core_if)) {
-
-               _dev->dev.dma_mask = &usb_dmamask;
-               _dev->dev.coherent_dma_mask = ~0;
-       } else {
-
-               _dev->dev.dma_mask = (void *)0;
-               _dev->dev.coherent_dma_mask = 0;
-       }
-
        /*
         * Allocate memory for the base HCD plus the DWC OTG HCD.
         * Initialize the base HCD.
@@ -556,20 +544,8 @@ int host20_hcd_init(struct platform_device *_dev)
        dwc_otg_device_t *otg_dev = dwc_get_device_platform_data(_dev);
        int retval = 0;
        int irq;
-       static u64 usb_dmamask = 0xffffffffUL;
        DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD INIT\n");
 
-       /* Set device flags indicating whether the HCD supports DMA. */
-       if (dwc_otg_is_dma_enable(otg_dev->core_if)) {
-
-               _dev->dev.dma_mask = &usb_dmamask;
-               _dev->dev.coherent_dma_mask = ~0;
-       } else {
-
-               _dev->dev.dma_mask = (void *)0;
-               _dev->dev.coherent_dma_mask = 0;
-       }
-
        /*
         * Allocate memory for the base HCD plus the DWC OTG HCD.
         * Initialize the base HCD.