From c7877396ea3273c1dcfc23ee68282c1a4544afae Mon Sep 17 00:00:00 2001 From: lyz Date: Mon, 15 Dec 2014 14:27:40 +0800 Subject: [PATCH] usb: dwc_otg: set dma_mask 32bit for both device and host mode --- drivers/usb/dwc_otg_310/dwc_otg_driver.c | 14 ++++++++++++ drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c | 24 --------------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/drivers/usb/dwc_otg_310/dwc_otg_driver.c b/drivers/usb/dwc_otg_310/dwc_otg_driver.c index fba497d60663..cbd3f364e37c 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_driver.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_driver.c @@ -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. diff --git a/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c b/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c index b726c90baf3c..18a10d8ab261 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_hcd_linux.c @@ -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. -- 2.34.1