aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 17:55:21 -0500
commit8ceafbfa91ffbdbb2afaea5c24ccb519ffb8b587 (patch)
tree98c9ea93362536f1ddd73175b13b7847583350df /drivers/usb/host
parent42a2d923cc349583ebf6fdd52a7d35e1c2f7e6bd (diff)
parent26ba47b18318abe7dadbe9294a611c0e932651d8 (diff)
Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm
Pull DMA mask updates from Russell King: "This series cleans up the handling of DMA masks in a lot of drivers, fixing some bugs as we go. Some of the more serious errors include: - drivers which only set their coherent DMA mask if the attempt to set the streaming mask fails. - drivers which test for a NULL dma mask pointer, and then set the dma mask pointer to a location in their module .data section - which will cause problems if the module is reloaded. To counter these, I have introduced two helper functions: - dma_set_mask_and_coherent() takes care of setting both the streaming and coherent masks at the same time, with the correct error handling as specified by the API. - dma_coerce_mask_and_coherent() which resolves the problem of drivers forcefully setting DMA masks. This is more a marker for future work to further clean these locations up - the code which creates the devices really should be initialising these, but to fix that in one go along with this change could potentially be very disruptive. The last thing this series does is prise away some of Linux's addition to "DMA addresses are physical addresses and RAM always starts at zero". We have ARM LPAE systems where all system memory is above 4GB physical, hence having DMA masks interpreted by (eg) the block layers as describing physical addresses in the range 0..DMAMASK fails on these platforms. Santosh Shilimkar addresses this in this series; the patches were copied to the appropriate people multiple times but were ignored. Fixing this also gets rid of some ARM weirdness in the setup of the max*pfn variables, and brings ARM into line with every other Linux architecture as far as those go" * 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm: (52 commits) ARM: 7805/1: mm: change max*pfn to include the physical offset of memory ARM: 7797/1: mmc: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7796/1: scsi: Use dma_max_pfn(dev) helper for bounce_limit calculations ARM: 7795/1: mm: dma-mapping: Add dma_max_pfn(dev) helper function ARM: 7794/1: block: Rename parameter dma_mask to max_addr for blk_queue_bounce_limit() ARM: DMA-API: better handing of DMA masks for coherent allocations ARM: 7857/1: dma: imx-sdma: setup dma mask DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks DMA-API: dcdbas: update DMA mask handing DMA-API: dma: edma.c: no need to explicitly initialize DMA masks DMA-API: usb: musb: use platform_device_register_full() to avoid directly messing with dma masks DMA-API: crypto: remove last references to 'static struct device *dev' DMA-API: crypto: fix ixp4xx crypto platform device support DMA-API: others: use dma_set_coherent_mask() DMA-API: staging: use dma_set_coherent_mask() DMA-API: usb: use new dma_coerce_mask_and_coherent() DMA-API: usb: use dma_set_coherent_mask() DMA-API: parport: parport_pc.c: use dma_coerce_mask_and_coherent() DMA-API: net: octeon: use dma_coerce_mask_and_coherent() DMA-API: net: nxp/lpc_eth: use dma_coerce_mask_and_coherent() ...
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/bcma-hcd.c3
-rw-r--r--drivers/usb/host/ehci-atmel.c7
-rw-r--r--drivers/usb/host/ehci-exynos.c7
-rw-r--r--drivers/usb/host/ehci-octeon.c4
-rw-r--r--drivers/usb/host/ehci-omap.c10
-rw-r--r--drivers/usb/host/ehci-orion.c7
-rw-r--r--drivers/usb/host/ehci-platform.c10
-rw-r--r--drivers/usb/host/ehci-spear.c7
-rw-r--r--drivers/usb/host/ehci-tegra.c7
-rw-r--r--drivers/usb/host/ohci-at91.c9
-rw-r--r--drivers/usb/host/ohci-exynos.c7
-rw-r--r--drivers/usb/host/ohci-nxp.c5
-rw-r--r--drivers/usb/host/ohci-octeon.c5
-rw-r--r--drivers/usb/host/ohci-omap3.c10
-rw-r--r--drivers/usb/host/ohci-pxa27x.c8
-rw-r--r--drivers/usb/host/ohci-sa1111.c6
-rw-r--r--drivers/usb/host/ohci-spear.c7
-rw-r--r--drivers/usb/host/ssb-hcd.c3
-rw-r--r--drivers/usb/host/uhci-platform.c7
19 files changed, 64 insertions, 65 deletions
diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c
index df13d425e9c5..205f4a336583 100644
--- a/drivers/usb/host/bcma-hcd.c
+++ b/drivers/usb/host/bcma-hcd.c
@@ -227,8 +227,7 @@ static int bcma_hcd_probe(struct bcma_device *dev)
227 227
228 /* TODO: Probably need checks here; is the core connected? */ 228 /* TODO: Probably need checks here; is the core connected? */
229 229
230 if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || 230 if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
231 dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32)))
232 return -EOPNOTSUPP; 231 return -EOPNOTSUPP;
233 232
234 usb_dev = kzalloc(sizeof(struct bcma_hcd_device), GFP_KERNEL); 233 usb_dev = kzalloc(sizeof(struct bcma_hcd_device), GFP_KERNEL);
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index f417526fb1f4..284f8417eae5 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -96,10 +96,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
96 * Since shared usb code relies on it, set it here for now. 96 * Since shared usb code relies on it, set it here for now.
97 * Once we have dma capability bindings this can go away. 97 * Once we have dma capability bindings this can go away.
98 */ 98 */
99 if (!pdev->dev.dma_mask) 99 retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
100 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 100 if (retval)
101 if (!pdev->dev.coherent_dma_mask) 101 goto fail_create_hcd;
102 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
103 102
104 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 103 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
105 if (!hcd) { 104 if (!hcd) {
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 016352e0f5a7..e97c198e052f 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -84,10 +84,9 @@ static int exynos_ehci_probe(struct platform_device *pdev)
84 * Since shared usb code relies on it, set it here for now. 84 * Since shared usb code relies on it, set it here for now.
85 * Once we move to full device tree support this will vanish off. 85 * Once we move to full device tree support this will vanish off.
86 */ 86 */
87 if (!pdev->dev.dma_mask) 87 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
88 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 88 if (err)
89 if (!pdev->dev.coherent_dma_mask) 89 return err;
90 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
91 90
92 exynos_setup_vbus_gpio(pdev); 91 exynos_setup_vbus_gpio(pdev);
93 92
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c
index ab0397e4d8f3..4c528b2c033a 100644
--- a/drivers/usb/host/ehci-octeon.c
+++ b/drivers/usb/host/ehci-octeon.c
@@ -116,8 +116,10 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
116 * We can DMA from anywhere. But the descriptors must be in 116 * We can DMA from anywhere. But the descriptors must be in
117 * the lower 4GB. 117 * the lower 4GB.
118 */ 118 */
119 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
120 pdev->dev.dma_mask = &ehci_octeon_dma_mask; 119 pdev->dev.dma_mask = &ehci_octeon_dma_mask;
120 ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
121 if (ret)
122 return ret;
121 123
122 hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon"); 124 hcd = usb_create_hcd(&ehci_octeon_hc_driver, &pdev->dev, "octeon");
123 if (!hcd) 125 if (!hcd)
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 78b01fa475bb..6fa82d6b7661 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -104,7 +104,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
104 struct resource *res; 104 struct resource *res;
105 struct usb_hcd *hcd; 105 struct usb_hcd *hcd;
106 void __iomem *regs; 106 void __iomem *regs;
107 int ret = -ENODEV; 107 int ret;
108 int irq; 108 int irq;
109 int i; 109 int i;
110 struct omap_hcd *omap; 110 struct omap_hcd *omap;
@@ -144,11 +144,11 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
144 * Since shared usb code relies on it, set it here for now. 144 * Since shared usb code relies on it, set it here for now.
145 * Once we have dma capability bindings this can go away. 145 * Once we have dma capability bindings this can go away.
146 */ 146 */
147 if (!dev->dma_mask) 147 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
148 dev->dma_mask = &dev->coherent_dma_mask; 148 if (ret)
149 if (!dev->coherent_dma_mask) 149 return ret;
150 dev->coherent_dma_mask = DMA_BIT_MASK(32);
151 150
151 ret = -ENODEV;
152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev, 152 hcd = usb_create_hcd(&ehci_omap_hc_driver, dev,
153 dev_name(dev)); 153 dev_name(dev));
154 if (!hcd) { 154 if (!hcd) {
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index d1dfb9db5b42..2ba76730e650 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -180,10 +180,9 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
180 * set. Since shared usb code relies on it, set it here for 180 * set. Since shared usb code relies on it, set it here for
181 * now. Once we have dma capability bindings this can go away. 181 * now. Once we have dma capability bindings this can go away.
182 */ 182 */
183 if (!pdev->dev.dma_mask) 183 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
184 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 184 if (err)
185 if (!pdev->dev.coherent_dma_mask) 185 goto err1;
186 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
187 186
188 if (!request_mem_region(res->start, resource_size(res), 187 if (!request_mem_region(res->start, resource_size(res),
189 ehci_orion_hc_driver.description)) { 188 ehci_orion_hc_driver.description)) {
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index f6b790ca8cf2..7f30b7168d5a 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -78,7 +78,7 @@ static int ehci_platform_probe(struct platform_device *dev)
78 struct resource *res_mem; 78 struct resource *res_mem;
79 struct usb_ehci_pdata *pdata; 79 struct usb_ehci_pdata *pdata;
80 int irq; 80 int irq;
81 int err = -ENOMEM; 81 int err;
82 82
83 if (usb_disabled()) 83 if (usb_disabled())
84 return -ENODEV; 84 return -ENODEV;
@@ -89,10 +89,10 @@ static int ehci_platform_probe(struct platform_device *dev)
89 */ 89 */
90 if (!dev_get_platdata(&dev->dev)) 90 if (!dev_get_platdata(&dev->dev))
91 dev->dev.platform_data = &ehci_platform_defaults; 91 dev->dev.platform_data = &ehci_platform_defaults;
92 if (!dev->dev.dma_mask) 92
93 dev->dev.dma_mask = &dev->dev.coherent_dma_mask; 93 err = dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
94 if (!dev->dev.coherent_dma_mask) 94 if (err)
95 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 95 return err;
96 96
97 pdata = dev_get_platdata(&dev->dev); 97 pdata = dev_get_platdata(&dev->dev);
98 98
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 1cf0adba3fc8..ee6f9ffaa0e7 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -81,10 +81,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
81 * Since shared usb code relies on it, set it here for now. 81 * Since shared usb code relies on it, set it here for now.
82 * Once we have dma capability bindings this can go away. 82 * Once we have dma capability bindings this can go away.
83 */ 83 */
84 if (!pdev->dev.dma_mask) 84 retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
85 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 85 if (retval)
86 if (!pdev->dev.coherent_dma_mask) 86 goto fail;
87 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
88 87
89 usbh_clk = devm_clk_get(&pdev->dev, NULL); 88 usbh_clk = devm_clk_get(&pdev->dev, NULL);
90 if (IS_ERR(usbh_clk)) { 89 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index e6d8e26e48cc..b9fd0396011e 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -362,10 +362,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
362 * Since shared usb code relies on it, set it here for now. 362 * Since shared usb code relies on it, set it here for now.
363 * Once we have dma capability bindings this can go away. 363 * Once we have dma capability bindings this can go away.
364 */ 364 */
365 if (!pdev->dev.dma_mask) 365 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
366 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 366 if (err)
367 if (!pdev->dev.coherent_dma_mask) 367 return err;
368 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
369 368
370 hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev, 369 hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev,
371 dev_name(&pdev->dev)); 370 dev_name(&pdev->dev));
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 476b5a5baf25..418444ebb1b8 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -469,7 +469,7 @@ MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
469static int ohci_at91_of_init(struct platform_device *pdev) 469static int ohci_at91_of_init(struct platform_device *pdev)
470{ 470{
471 struct device_node *np = pdev->dev.of_node; 471 struct device_node *np = pdev->dev.of_node;
472 int i, gpio; 472 int i, gpio, ret;
473 enum of_gpio_flags flags; 473 enum of_gpio_flags flags;
474 struct at91_usbh_data *pdata; 474 struct at91_usbh_data *pdata;
475 u32 ports; 475 u32 ports;
@@ -481,10 +481,9 @@ static int ohci_at91_of_init(struct platform_device *pdev)
481 * Since shared usb code relies on it, set it here for now. 481 * Since shared usb code relies on it, set it here for now.
482 * Once we have dma capability bindings this can go away. 482 * Once we have dma capability bindings this can go away.
483 */ 483 */
484 if (!pdev->dev.dma_mask) 484 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
485 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 485 if (ret)
486 if (!pdev->dev.coherent_dma_mask) 486 return ret;
487 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
488 487
489 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 488 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
490 if (!pdata) 489 if (!pdata)
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index a87baedc0aa7..91ec9b2cd378 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -71,10 +71,9 @@ static int exynos_ohci_probe(struct platform_device *pdev)
71 * Since shared usb code relies on it, set it here for now. 71 * Since shared usb code relies on it, set it here for now.
72 * Once we move to full device tree support this will vanish off. 72 * Once we move to full device tree support this will vanish off.
73 */ 73 */
74 if (!pdev->dev.dma_mask) 74 err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
75 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 75 if (err)
76 if (!pdev->dev.coherent_dma_mask) 76 return err;
77 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
78 77
79 hcd = usb_create_hcd(&exynos_ohci_hc_driver, 78 hcd = usb_create_hcd(&exynos_ohci_hc_driver,
80 &pdev->dev, dev_name(&pdev->dev)); 79 &pdev->dev, dev_name(&pdev->dev));
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 9ab7e24ba65d..e99db8a6d55f 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -181,8 +181,9 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
181 return -EPROBE_DEFER; 181 return -EPROBE_DEFER;
182 } 182 }
183 183
184 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 184 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
185 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 185 if (ret)
186 goto fail_disable;
186 187
187 dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name); 188 dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (nxp)\n", hcd_name);
188 if (usb_disabled()) { 189 if (usb_disabled()) {
diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c
index 342dc7e543b8..6c16dcef15c6 100644
--- a/drivers/usb/host/ohci-octeon.c
+++ b/drivers/usb/host/ohci-octeon.c
@@ -127,8 +127,9 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev)
127 } 127 }
128 128
129 /* Ohci is a 32-bit device. */ 129 /* Ohci is a 32-bit device. */
130 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 130 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
131 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 131 if (ret)
132 return ret;
132 133
133 hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon"); 134 hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon");
134 if (!hcd) 135 if (!hcd)
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index 408d06a68571..21457417a856 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -65,7 +65,7 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
65 struct usb_hcd *hcd = NULL; 65 struct usb_hcd *hcd = NULL;
66 void __iomem *regs = NULL; 66 void __iomem *regs = NULL;
67 struct resource *res; 67 struct resource *res;
68 int ret = -ENODEV; 68 int ret;
69 int irq; 69 int irq;
70 70
71 if (usb_disabled()) 71 if (usb_disabled())
@@ -99,11 +99,11 @@ static int ohci_hcd_omap3_probe(struct platform_device *pdev)
99 * Since shared usb code relies on it, set it here for now. 99 * Since shared usb code relies on it, set it here for now.
100 * Once we have dma capability bindings this can go away. 100 * Once we have dma capability bindings this can go away.
101 */ 101 */
102 if (!dev->dma_mask) 102 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
103 dev->dma_mask = &dev->coherent_dma_mask; 103 if (ret)
104 if (!dev->coherent_dma_mask) 104 goto err_io;
105 dev->coherent_dma_mask = DMA_BIT_MASK(32);
106 105
106 ret = -ENODEV;
107 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev, 107 hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
108 dev_name(dev)); 108 dev_name(dev));
109 if (!hcd) { 109 if (!hcd) {
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index deea5d1d6394..e89ac4d4b87e 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -298,6 +298,7 @@ static int ohci_pxa_of_init(struct platform_device *pdev)
298 struct device_node *np = pdev->dev.of_node; 298 struct device_node *np = pdev->dev.of_node;
299 struct pxaohci_platform_data *pdata; 299 struct pxaohci_platform_data *pdata;
300 u32 tmp; 300 u32 tmp;
301 int ret;
301 302
302 if (!np) 303 if (!np)
303 return 0; 304 return 0;
@@ -306,10 +307,9 @@ static int ohci_pxa_of_init(struct platform_device *pdev)
306 * Since shared usb code relies on it, set it here for now. 307 * Since shared usb code relies on it, set it here for now.
307 * Once we have dma capability bindings this can go away. 308 * Once we have dma capability bindings this can go away.
308 */ 309 */
309 if (!pdev->dev.dma_mask) 310 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
310 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 311 if (ret)
311 if (!pdev->dev.coherent_dma_mask) 312 return ret;
312 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
313 313
314 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 314 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
315 if (!pdata) 315 if (!pdata)
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 17b2a7dad77b..aa9e127bbe71 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -185,6 +185,12 @@ static int ohci_hcd_sa1111_probe(struct sa1111_dev *dev)
185 if (usb_disabled()) 185 if (usb_disabled())
186 return -ENODEV; 186 return -ENODEV;
187 187
188 /*
189 * We don't call dma_set_mask_and_coherent() here because the
190 * DMA mask has already been appropraitely setup by the core
191 * SA-1111 bus code (which includes bug workarounds.)
192 */
193
188 hcd = usb_create_hcd(&ohci_sa1111_hc_driver, &dev->dev, "sa1111"); 194 hcd = usb_create_hcd(&ohci_sa1111_hc_driver, &dev->dev, "sa1111");
189 if (!hcd) 195 if (!hcd)
190 return -ENOMEM; 196 return -ENOMEM;
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 31ff3fc4e26f..6b02107d281d 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -56,10 +56,9 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev)
56 * Since shared usb code relies on it, set it here for now. 56 * Since shared usb code relies on it, set it here for now.
57 * Once we have dma capability bindings this can go away. 57 * Once we have dma capability bindings this can go away.
58 */ 58 */
59 if (!pdev->dev.dma_mask) 59 retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
60 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 60 if (retval)
61 if (!pdev->dev.coherent_dma_mask) 61 goto fail;
62 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
63 62
64 usbh_clk = devm_clk_get(&pdev->dev, NULL); 63 usbh_clk = devm_clk_get(&pdev->dev, NULL);
65 if (IS_ERR(usbh_clk)) { 64 if (IS_ERR(usbh_clk)) {
diff --git a/drivers/usb/host/ssb-hcd.c b/drivers/usb/host/ssb-hcd.c
index 74af2c6287d2..0196f766df73 100644
--- a/drivers/usb/host/ssb-hcd.c
+++ b/drivers/usb/host/ssb-hcd.c
@@ -163,8 +163,7 @@ static int ssb_hcd_probe(struct ssb_device *dev,
163 163
164 /* TODO: Probably need checks here; is the core connected? */ 164 /* TODO: Probably need checks here; is the core connected? */
165 165
166 if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || 166 if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32)))
167 dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32)))
168 return -EOPNOTSUPP; 167 return -EOPNOTSUPP;
169 168
170 usb_dev = kzalloc(sizeof(struct ssb_hcd_device), GFP_KERNEL); 169 usb_dev = kzalloc(sizeof(struct ssb_hcd_device), GFP_KERNEL);
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index ded842bc6578..3003fefaa964 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -75,10 +75,9 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
75 * Since shared usb code relies on it, set it here for now. 75 * Since shared usb code relies on it, set it here for now.
76 * Once we have dma capability bindings this can go away. 76 * Once we have dma capability bindings this can go away.
77 */ 77 */
78 if (!pdev->dev.dma_mask) 78 ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
79 pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 79 if (ret)
80 if (!pdev->dev.coherent_dma_mask) 80 return ret;
81 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
82 81
83 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev, 82 hcd = usb_create_hcd(&uhci_platform_hc_driver, &pdev->dev,
84 pdev->name); 83 pdev->name);