aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/buffer.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2017-03-12 22:18:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-23 03:20:21 -0400
commita8c06e407ef969461b7f51ec72839fe382dd3c29 (patch)
tree427e69f9e100243b8309f387859c861c9691c0cf /drivers/usb/core/buffer.c
parentf5cccf49428447dfbc9edb7a04bb8fc316269781 (diff)
usb: separate out sysdev pointer from usb_bus
For xhci-hcd platform device, all the DMA parameters are not configured properly, notably dma ops for dwc3 devices. The idea here is that you pass in the parent of_node along with the child device pointer, so it would behave exactly like the parent already does. The difference is that it also handles all the other attributes besides the mask. sysdev will represent the physical device, as seen from firmware or bus.Splitting the usb_bus->controller field into the Linux-internal device (used for the sysfs hierarchy, for printks and for power management) and a new pointer (used for DMA, DT enumeration and phy lookup) probably covers all that we really need. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Tested-by: Baolin Wang <baolin.wang@linaro.org> Tested-by: Brian Norris <briannorris@chromium.org> Tested-by: Alexander Sverdlin <alexander.sverdlin@nokia.com> Tested-by: Vivek Gautam <vivek.gautam@codeaurora.org> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Grygorii Strashko <grygorii.strashko@ti.com> Cc: Sinjan Kumar <sinjank@codeaurora.org> Cc: David Fisher <david.fisher1@synopsys.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: "Thang Q. Nguyen" <tqnguyen@apm.com> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Ming Lei <tom.leiming@gmail.com> Cc: Jon Masters <jcm@redhat.com> Cc: Dann Frazier <dann.frazier@canonical.com> Cc: Peter Chen <peter.chen@nxp.com> Cc: Leo Li <pku.leo@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/buffer.c')
-rw-r--r--drivers/usb/core/buffer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c
index b9bf6e2eb6fe..b64568cf572c 100644
--- a/drivers/usb/core/buffer.c
+++ b/drivers/usb/core/buffer.c
@@ -66,7 +66,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
66 int i, size; 66 int i, size;
67 67
68 if (!IS_ENABLED(CONFIG_HAS_DMA) || 68 if (!IS_ENABLED(CONFIG_HAS_DMA) ||
69 (!hcd->self.controller->dma_mask && 69 (!is_device_dma_capable(hcd->self.sysdev) &&
70 !(hcd->driver->flags & HCD_LOCAL_MEM))) 70 !(hcd->driver->flags & HCD_LOCAL_MEM)))
71 return 0; 71 return 0;
72 72
@@ -75,7 +75,7 @@ int hcd_buffer_create(struct usb_hcd *hcd)
75 if (!size) 75 if (!size)
76 continue; 76 continue;
77 snprintf(name, sizeof(name), "buffer-%d", size); 77 snprintf(name, sizeof(name), "buffer-%d", size);
78 hcd->pool[i] = dma_pool_create(name, hcd->self.controller, 78 hcd->pool[i] = dma_pool_create(name, hcd->self.sysdev,
79 size, size, 0); 79 size, size, 0);
80 if (!hcd->pool[i]) { 80 if (!hcd->pool[i]) {
81 hcd_buffer_destroy(hcd); 81 hcd_buffer_destroy(hcd);
@@ -130,7 +130,7 @@ void *hcd_buffer_alloc(
130 130
131 /* some USB hosts just use PIO */ 131 /* some USB hosts just use PIO */
132 if (!IS_ENABLED(CONFIG_HAS_DMA) || 132 if (!IS_ENABLED(CONFIG_HAS_DMA) ||
133 (!bus->controller->dma_mask && 133 (!is_device_dma_capable(bus->sysdev) &&
134 !(hcd->driver->flags & HCD_LOCAL_MEM))) { 134 !(hcd->driver->flags & HCD_LOCAL_MEM))) {
135 *dma = ~(dma_addr_t) 0; 135 *dma = ~(dma_addr_t) 0;
136 return kmalloc(size, mem_flags); 136 return kmalloc(size, mem_flags);
@@ -140,7 +140,7 @@ void *hcd_buffer_alloc(
140 if (size <= pool_max[i]) 140 if (size <= pool_max[i])
141 return dma_pool_alloc(hcd->pool[i], mem_flags, dma); 141 return dma_pool_alloc(hcd->pool[i], mem_flags, dma);
142 } 142 }
143 return dma_alloc_coherent(hcd->self.controller, size, dma, mem_flags); 143 return dma_alloc_coherent(hcd->self.sysdev, size, dma, mem_flags);
144} 144}
145 145
146void hcd_buffer_free( 146void hcd_buffer_free(
@@ -157,7 +157,7 @@ void hcd_buffer_free(
157 return; 157 return;
158 158
159 if (!IS_ENABLED(CONFIG_HAS_DMA) || 159 if (!IS_ENABLED(CONFIG_HAS_DMA) ||
160 (!bus->controller->dma_mask && 160 (!is_device_dma_capable(bus->sysdev) &&
161 !(hcd->driver->flags & HCD_LOCAL_MEM))) { 161 !(hcd->driver->flags & HCD_LOCAL_MEM))) {
162 kfree(addr); 162 kfree(addr);
163 return; 163 return;
@@ -169,5 +169,5 @@ void hcd_buffer_free(
169 return; 169 return;
170 } 170 }
171 } 171 }
172 dma_free_coherent(hcd->self.controller, size, addr, dma); 172 dma_free_coherent(hcd->self.sysdev, size, addr, dma);
173} 173}