aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2011-12-12 18:51:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-12 18:51:45 -0500
commita1016ce33ce23296ad030e5276fcfdf9cb27cb6a (patch)
tree121cfe8fa100d3459baca5bd5c4cad26783f05aa /drivers/usb/musb
parent007d00d4c11b30b8fd7ff23b9d5aed3743e41f74 (diff)
parente7f4e73287d2915499c821b884f70f42187e2a74 (diff)
Merge branch 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
* 'for-next/musb' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb: usb: musb: omap2430: fix compile warning usb: musb: fix pm_runtime calls while atomic usb: musb: drop ARCH dependency usb: musb: headers cleanup usb: musb: allow building USB_MUSB_TUSB6010 as a module usb: musb: use a Kconfig choice to pick the right DMA method usb: musb: omap2+: save and restore OTG_INTERFSEL usb: musb: omap2+: fix context api's usb: musb: ux500: optimize DMA callback routine
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/Kconfig59
-rw-r--r--drivers/usb/musb/Makefile26
-rw-r--r--drivers/usb/musb/musb_core.c5
-rw-r--r--drivers/usb/musb/musb_core.h4
-rw-r--r--drivers/usb/musb/musb_debugfs.c8
-rw-r--r--drivers/usb/musb/musb_gadget.c2
-rw-r--r--drivers/usb/musb/musb_gadget_ep0.c1
-rw-r--r--drivers/usb/musb/musb_io.h2
-rw-r--r--drivers/usb/musb/omap2430.c24
-rw-r--r--drivers/usb/musb/tusb6010.c1
-rw-r--r--drivers/usb/musb/ux500_dma.c39
11 files changed, 69 insertions, 102 deletions
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 07a03460a598..84a022411e38 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -6,7 +6,6 @@
6# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller 6# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller
7config USB_MUSB_HDRC 7config USB_MUSB_HDRC
8 depends on USB && USB_GADGET 8 depends on USB && USB_GADGET
9 depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523))
10 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) 9 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
11 select TWL4030_USB if MACH_OMAP_3430SDP 10 select TWL4030_USB if MACH_OMAP_3430SDP
12 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 11 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
@@ -45,7 +44,6 @@ config USB_MUSB_DA8XX
45 44
46config USB_MUSB_TUSB6010 45config USB_MUSB_TUSB6010
47 tristate "TUSB6010" 46 tristate "TUSB6010"
48 depends on ARCH_OMAP
49 47
50config USB_MUSB_OMAP2PLUS 48config USB_MUSB_OMAP2PLUS
51 tristate "OMAP2430 and onwards" 49 tristate "OMAP2430 and onwards"
@@ -65,46 +63,57 @@ config USB_MUSB_UX500
65 63
66endchoice 64endchoice
67 65
68config MUSB_PIO_ONLY 66choice
69 bool 'Disable DMA (always use PIO)' 67 prompt 'MUSB DMA mode'
70 depends on USB_MUSB_HDRC 68 default USB_UX500_DMA if USB_MUSB_UX500
71 default USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X 69 default USB_INVENTRA_DMA if USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN
70 default USB_TI_CPPI_DMA if USB_MUSB_DAVINCI
71 default USB_TUSB_OMAP_DMA if USB_MUSB_TUSB6010
72 default MUSB_PIO_ONLY if USB_MUSB_TUSB6010 || USB_MUSB_DA8XX || USB_MUSB_AM35X
72 help 73 help
73 All data is copied between memory and FIFO by the CPU. 74 Unfortunately, only one option can be enabled here. Ideally one
74 DMA controllers are ignored. 75 should be able to build all these drivers into one kernel to
75 76 allow using DMA on multiplatform kernels.
76 Do not select 'n' here unless DMA support for your SOC or board
77 is unavailable (or unstable). When DMA is enabled at compile time,
78 you can still disable it at run time using the "use_dma=n" module
79 parameter.
80 77
81config USB_UX500_DMA 78config USB_UX500_DMA
82 bool 79 bool 'ST Ericsson U8500 and U5500'
83 depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY 80 depends on USB_MUSB_HDRC
84 default USB_MUSB_UX500 81 depends on USB_MUSB_UX500
85 help 82 help
86 Enable DMA transfers on UX500 platforms. 83 Enable DMA transfers on UX500 platforms.
87 84
88config USB_INVENTRA_DMA 85config USB_INVENTRA_DMA
89 bool 86 bool 'Inventra'
90 depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY 87 depends on USB_MUSB_HDRC
91 default USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN 88 depends on USB_MUSB_OMAP2PLUS || USB_MUSB_BLACKFIN
92 help 89 help
93 Enable DMA transfers using Mentor's engine. 90 Enable DMA transfers using Mentor's engine.
94 91
95config USB_TI_CPPI_DMA 92config USB_TI_CPPI_DMA
96 bool 93 bool 'TI CPPI (Davinci)'
97 depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY 94 depends on USB_MUSB_HDRC
98 default USB_MUSB_DAVINCI 95 depends on USB_MUSB_DAVINCI
99 help 96 help
100 Enable DMA transfers when TI CPPI DMA is available. 97 Enable DMA transfers when TI CPPI DMA is available.
101 98
102config USB_TUSB_OMAP_DMA 99config USB_TUSB_OMAP_DMA
103 bool 100 bool 'TUSB 6010'
104 depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY 101 depends on USB_MUSB_HDRC
105 depends on USB_MUSB_TUSB6010 102 depends on USB_MUSB_TUSB6010
106 depends on ARCH_OMAP 103 depends on ARCH_OMAP
107 default y
108 help 104 help
109 Enable DMA transfers on TUSB 6010 when OMAP DMA is available. 105 Enable DMA transfers on TUSB 6010 when OMAP DMA is available.
110 106
107config MUSB_PIO_ONLY
108 bool 'Disable DMA (always use PIO)'
109 depends on USB_MUSB_HDRC
110 help
111 All data is copied between memory and FIFO by the CPU.
112 DMA controllers are ignored.
113
114 Do not choose this unless DMA support for your SOC or board
115 is unavailable (or unstable). When DMA is enabled at compile time,
116 you can still disable it at run time using the "use_dma=n" module
117 parameter.
118
119endchoice
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index d8fd9d092dec..88bfb9dee4bf 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -24,25 +24,7 @@ obj-$(CONFIG_USB_MUSB_UX500) += ux500.o
24# PIO only, or DMA (several potential schemes). 24# PIO only, or DMA (several potential schemes).
25# though PIO is always there to back up DMA, and for ep0 25# though PIO is always there to back up DMA, and for ep0
26 26
27ifneq ($(CONFIG_MUSB_PIO_ONLY),y) 27musb_hdrc-$(CONFIG_USB_INVENTRA_DMA) += musbhsdma.o
28 28musb_hdrc-$(CONFIG_USB_TI_CPPI_DMA) += cppi_dma.o
29 ifeq ($(CONFIG_USB_INVENTRA_DMA),y) 29musb_hdrc-$(CONFIG_USB_TUSB_OMAP_DMA) += tusb6010_omap.o
30 musb_hdrc-y += musbhsdma.o 30musb_hdrc-$(CONFIG_USB_UX500_DMA) += ux500_dma.o
31
32 else
33 ifeq ($(CONFIG_USB_TI_CPPI_DMA),y)
34 musb_hdrc-y += cppi_dma.o
35
36 else
37 ifeq ($(CONFIG_USB_TUSB_OMAP_DMA),y)
38 musb_hdrc-y += tusb6010_omap.o
39
40 else
41 ifeq ($(CONFIG_USB_UX500_DMA),y)
42 musb_hdrc-y += ux500_dma.o
43
44 endif
45 endif
46 endif
47 endif
48endif
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 227c1dfa6bee..de7405e6d7dc 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1431,7 +1431,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb)
1431 struct musb_hw_ep *hw_ep = musb->endpoints + i; 1431 struct musb_hw_ep *hw_ep = musb->endpoints + i;
1432 1432
1433 hw_ep->fifo = MUSB_FIFO_OFFSET(i) + mbase; 1433 hw_ep->fifo = MUSB_FIFO_OFFSET(i) + mbase;
1434#ifdef CONFIG_USB_MUSB_TUSB6010 1434#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
1435 hw_ep->fifo_async = musb->async + 0x400 + MUSB_FIFO_OFFSET(i); 1435 hw_ep->fifo_async = musb->async + 0x400 + MUSB_FIFO_OFFSET(i);
1436 hw_ep->fifo_sync = musb->sync + 0x400 + MUSB_FIFO_OFFSET(i); 1436 hw_ep->fifo_sync = musb->sync + 0x400 + MUSB_FIFO_OFFSET(i);
1437 hw_ep->fifo_sync_va = 1437 hw_ep->fifo_sync_va =
@@ -1630,6 +1630,7 @@ void musb_dma_completion(struct musb *musb, u8 epnum, u8 transmit)
1630 } 1630 }
1631 } 1631 }
1632} 1632}
1633EXPORT_SYMBOL_GPL(musb_dma_completion);
1633 1634
1634#else 1635#else
1635#define use_dma 0 1636#define use_dma 0
@@ -2157,6 +2158,7 @@ static void musb_save_context(struct musb *musb)
2157 if (!epio) 2158 if (!epio)
2158 continue; 2159 continue;
2159 2160
2161 musb_writeb(musb_base, MUSB_INDEX, i);
2160 musb->context.index_regs[i].txmaxp = 2162 musb->context.index_regs[i].txmaxp =
2161 musb_readw(epio, MUSB_TXMAXP); 2163 musb_readw(epio, MUSB_TXMAXP);
2162 musb->context.index_regs[i].txcsr = 2164 musb->context.index_regs[i].txcsr =
@@ -2232,6 +2234,7 @@ static void musb_restore_context(struct musb *musb)
2232 if (!epio) 2234 if (!epio)
2233 continue; 2235 continue;
2234 2236
2237 musb_writeb(musb_base, MUSB_INDEX, i);
2235 musb_writew(epio, MUSB_TXMAXP, 2238 musb_writew(epio, MUSB_TXMAXP,
2236 musb->context.index_regs[i].txmaxp); 2239 musb->context.index_regs[i].txmaxp);
2237 musb_writew(epio, MUSB_TXCSR, 2240 musb_writew(epio, MUSB_TXCSR,
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index b3c065ab9dbc..3d28fb8a2dc9 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -40,7 +40,6 @@
40#include <linux/interrupt.h> 40#include <linux/interrupt.h>
41#include <linux/errno.h> 41#include <linux/errno.h>
42#include <linux/timer.h> 42#include <linux/timer.h>
43#include <linux/clk.h>
44#include <linux/device.h> 43#include <linux/device.h>
45#include <linux/usb/ch9.h> 44#include <linux/usb/ch9.h>
46#include <linux/usb/gadget.h> 45#include <linux/usb/gadget.h>
@@ -311,6 +310,7 @@ struct musb_context_registers {
311 u8 index, testmode; 310 u8 index, testmode;
312 311
313 u8 devctl, busctl, misc; 312 u8 devctl, busctl, misc;
313 u32 otg_interfsel;
314 314
315 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; 315 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
316}; 316};
@@ -327,6 +327,7 @@ struct musb {
327 327
328 irqreturn_t (*isr)(int, void *); 328 irqreturn_t (*isr)(int, void *);
329 struct work_struct irq_work; 329 struct work_struct irq_work;
330 struct work_struct otg_notifier_work;
330 u16 hwvers; 331 u16 hwvers;
331 332
332/* this hub status bit is reserved by USB 2.0 and not seen by usbcore */ 333/* this hub status bit is reserved by USB 2.0 and not seen by usbcore */
@@ -372,6 +373,7 @@ struct musb {
372 u16 int_tx; 373 u16 int_tx;
373 374
374 struct otg_transceiver *xceiv; 375 struct otg_transceiver *xceiv;
376 u8 xceiv_event;
375 377
376 int nIrq; 378 int nIrq;
377 unsigned irq_wake:1; 379 unsigned irq_wake:1;
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 61f4ee466df7..13d9af9bf920 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -33,11 +33,7 @@
33 33
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/sched.h>
37#include <linux/init.h> 36#include <linux/init.h>
38#include <linux/list.h>
39#include <linux/platform_device.h>
40#include <linux/io.h>
41#include <linux/debugfs.h> 37#include <linux/debugfs.h>
42#include <linux/seq_file.h> 38#include <linux/seq_file.h>
43 39
@@ -46,10 +42,6 @@
46#include "musb_core.h" 42#include "musb_core.h"
47#include "musb_debug.h" 43#include "musb_debug.h"
48 44
49#ifdef CONFIG_ARCH_DAVINCI
50#include "davinci.h"
51#endif
52
53struct musb_register_map { 45struct musb_register_map {
54 char *name; 46 char *name;
55 unsigned offset; 47 unsigned offset;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 922148ff8d29..f2c5bcbf2541 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -40,8 +40,6 @@
40#include <linux/smp.h> 40#include <linux/smp.h>
41#include <linux/spinlock.h> 41#include <linux/spinlock.h>
42#include <linux/delay.h> 42#include <linux/delay.h>
43#include <linux/moduleparam.h>
44#include <linux/stat.h>
45#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
46#include <linux/slab.h> 44#include <linux/slab.h>
47 45
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 6a0d0467ec74..e40d7647caf1 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -37,7 +37,6 @@
37#include <linux/list.h> 37#include <linux/list.h>
38#include <linux/timer.h> 38#include <linux/timer.h>
39#include <linux/spinlock.h> 39#include <linux/spinlock.h>
40#include <linux/init.h>
41#include <linux/device.h> 40#include <linux/device.h>
42#include <linux/interrupt.h> 41#include <linux/interrupt.h>
43 42
diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h
index 03c6ccdbb3be..e61aa95f2d2a 100644
--- a/drivers/usb/musb/musb_io.h
+++ b/drivers/usb/musb/musb_io.h
@@ -74,7 +74,7 @@ static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
74 { __raw_writel(data, addr + offset); } 74 { __raw_writel(data, addr + offset); }
75 75
76 76
77#ifdef CONFIG_USB_MUSB_TUSB6010 77#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
78 78
79/* 79/*
80 * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum. 80 * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index ba85f273e487..c24dc26b9be2 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -29,7 +29,6 @@
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/clk.h>
33#include <linux/io.h> 32#include <linux/io.h>
34#include <linux/platform_device.h> 33#include <linux/platform_device.h>
35#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
@@ -228,11 +227,21 @@ static int musb_otg_notifications(struct notifier_block *nb,
228 unsigned long event, void *unused) 227 unsigned long event, void *unused)
229{ 228{
230 struct musb *musb = container_of(nb, struct musb, nb); 229 struct musb *musb = container_of(nb, struct musb, nb);
230
231 musb->xceiv_event = event;
232 schedule_work(&musb->otg_notifier_work);
233
234 return 0;
235}
236
237static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
238{
239 struct musb *musb = container_of(data_notifier_work, struct musb, otg_notifier_work);
231 struct device *dev = musb->controller; 240 struct device *dev = musb->controller;
232 struct musb_hdrc_platform_data *pdata = dev->platform_data; 241 struct musb_hdrc_platform_data *pdata = dev->platform_data;
233 struct omap_musb_board_data *data = pdata->board_data; 242 struct omap_musb_board_data *data = pdata->board_data;
234 243
235 switch (event) { 244 switch (musb->xceiv_event) {
236 case USB_EVENT_ID: 245 case USB_EVENT_ID:
237 dev_dbg(musb->controller, "ID GND\n"); 246 dev_dbg(musb->controller, "ID GND\n");
238 247
@@ -274,10 +283,7 @@ static int musb_otg_notifications(struct notifier_block *nb,
274 break; 283 break;
275 default: 284 default:
276 dev_dbg(musb->controller, "ID float\n"); 285 dev_dbg(musb->controller, "ID float\n");
277 return NOTIFY_DONE;
278 } 286 }
279
280 return NOTIFY_OK;
281} 287}
282 288
283static int omap2430_musb_init(struct musb *musb) 289static int omap2430_musb_init(struct musb *musb)
@@ -297,6 +303,8 @@ static int omap2430_musb_init(struct musb *musb)
297 return -ENODEV; 303 return -ENODEV;
298 } 304 }
299 305
306 INIT_WORK(&musb->otg_notifier_work, musb_otg_notifier_work);
307
300 status = pm_runtime_get_sync(dev); 308 status = pm_runtime_get_sync(dev);
301 if (status < 0) { 309 if (status < 0) {
302 dev_err(dev, "pm_runtime_get_sync FAILED"); 310 dev_err(dev, "pm_runtime_get_sync FAILED");
@@ -491,6 +499,9 @@ static int omap2430_runtime_suspend(struct device *dev)
491 struct omap2430_glue *glue = dev_get_drvdata(dev); 499 struct omap2430_glue *glue = dev_get_drvdata(dev);
492 struct musb *musb = glue_to_musb(glue); 500 struct musb *musb = glue_to_musb(glue);
493 501
502 musb->context.otg_interfsel = musb_readl(musb->mregs,
503 OTG_INTERFSEL);
504
494 omap2430_low_level_exit(musb); 505 omap2430_low_level_exit(musb);
495 otg_set_suspend(musb->xceiv, 1); 506 otg_set_suspend(musb->xceiv, 1);
496 507
@@ -503,6 +514,9 @@ static int omap2430_runtime_resume(struct device *dev)
503 struct musb *musb = glue_to_musb(glue); 514 struct musb *musb = glue_to_musb(glue);
504 515
505 omap2430_low_level_init(musb); 516 omap2430_low_level_init(musb);
517 musb_writel(musb->mregs, OTG_INTERFSEL,
518 musb->context.otg_interfsel);
519
506 otg_set_suspend(musb->xceiv, 0); 520 otg_set_suspend(musb->xceiv, 0);
507 521
508 return 0; 522 return 0;
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index ec1480191f78..1f405616e6cd 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -56,6 +56,7 @@ u8 tusb_get_revision(struct musb *musb)
56 56
57 return rev; 57 return rev;
58} 58}
59EXPORT_SYMBOL_GPL(tusb_get_revision);
59 60
60static int tusb_print_revision(struct musb *musb) 61static int tusb_print_revision(struct musb *musb)
61{ 62{
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index ef4333f4bbe0..a163632877af 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -37,7 +37,6 @@ struct ux500_dma_channel {
37 struct dma_channel channel; 37 struct dma_channel channel;
38 struct ux500_dma_controller *controller; 38 struct ux500_dma_controller *controller;
39 struct musb_hw_ep *hw_ep; 39 struct musb_hw_ep *hw_ep;
40 struct work_struct channel_work;
41 struct dma_chan *dma_chan; 40 struct dma_chan *dma_chan;
42 unsigned int cur_len; 41 unsigned int cur_len;
43 dma_cookie_t cookie; 42 dma_cookie_t cookie;
@@ -56,31 +55,11 @@ struct ux500_dma_controller {
56 dma_addr_t phy_base; 55 dma_addr_t phy_base;
57}; 56};
58 57
59/* Work function invoked from DMA callback to handle tx transfers. */
60static void ux500_tx_work(struct work_struct *data)
61{
62 struct ux500_dma_channel *ux500_channel = container_of(data,
63 struct ux500_dma_channel, channel_work);
64 struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
65 struct musb *musb = hw_ep->musb;
66 unsigned long flags;
67
68 dev_dbg(musb->controller, "DMA tx transfer done on hw_ep=%d\n",
69 hw_ep->epnum);
70
71 spin_lock_irqsave(&musb->lock, flags);
72 ux500_channel->channel.actual_len = ux500_channel->cur_len;
73 ux500_channel->channel.status = MUSB_DMA_STATUS_FREE;
74 musb_dma_completion(musb, hw_ep->epnum,
75 ux500_channel->is_tx);
76 spin_unlock_irqrestore(&musb->lock, flags);
77}
78
79/* Work function invoked from DMA callback to handle rx transfers. */ 58/* Work function invoked from DMA callback to handle rx transfers. */
80static void ux500_rx_work(struct work_struct *data) 59void ux500_dma_callback(void *private_data)
81{ 60{
82 struct ux500_dma_channel *ux500_channel = container_of(data, 61 struct dma_channel *channel = private_data;
83 struct ux500_dma_channel, channel_work); 62 struct ux500_dma_channel *ux500_channel = channel->private_data;
84 struct musb_hw_ep *hw_ep = ux500_channel->hw_ep; 63 struct musb_hw_ep *hw_ep = ux500_channel->hw_ep;
85 struct musb *musb = hw_ep->musb; 64 struct musb *musb = hw_ep->musb;
86 unsigned long flags; 65 unsigned long flags;
@@ -94,14 +73,7 @@ static void ux500_rx_work(struct work_struct *data)
94 musb_dma_completion(musb, hw_ep->epnum, 73 musb_dma_completion(musb, hw_ep->epnum,
95 ux500_channel->is_tx); 74 ux500_channel->is_tx);
96 spin_unlock_irqrestore(&musb->lock, flags); 75 spin_unlock_irqrestore(&musb->lock, flags);
97}
98
99void ux500_dma_callback(void *private_data)
100{
101 struct dma_channel *channel = (struct dma_channel *)private_data;
102 struct ux500_dma_channel *ux500_channel = channel->private_data;
103 76
104 schedule_work(&ux500_channel->channel_work);
105} 77}
106 78
107static bool ux500_configure_channel(struct dma_channel *channel, 79static bool ux500_configure_channel(struct dma_channel *channel,
@@ -330,7 +302,6 @@ static int ux500_dma_controller_start(struct dma_controller *c)
330 void **param_array; 302 void **param_array;
331 struct ux500_dma_channel *channel_array; 303 struct ux500_dma_channel *channel_array;
332 u32 ch_count; 304 u32 ch_count;
333 void (*musb_channel_work)(struct work_struct *);
334 dma_cap_mask_t mask; 305 dma_cap_mask_t mask;
335 306
336 if ((data->num_rx_channels > UX500_MUSB_DMA_NUM_RX_CHANNELS) || 307 if ((data->num_rx_channels > UX500_MUSB_DMA_NUM_RX_CHANNELS) ||
@@ -347,7 +318,6 @@ static int ux500_dma_controller_start(struct dma_controller *c)
347 channel_array = controller->rx_channel; 318 channel_array = controller->rx_channel;
348 ch_count = data->num_rx_channels; 319 ch_count = data->num_rx_channels;
349 param_array = data->dma_rx_param_array; 320 param_array = data->dma_rx_param_array;
350 musb_channel_work = ux500_rx_work;
351 321
352 for (dir = 0; dir < 2; dir++) { 322 for (dir = 0; dir < 2; dir++) {
353 for (ch_num = 0; ch_num < ch_count; ch_num++) { 323 for (ch_num = 0; ch_num < ch_count; ch_num++) {
@@ -374,15 +344,12 @@ static int ux500_dma_controller_start(struct dma_controller *c)
374 return -EBUSY; 344 return -EBUSY;
375 } 345 }
376 346
377 INIT_WORK(&ux500_channel->channel_work,
378 musb_channel_work);
379 } 347 }
380 348
381 /* Prepare the loop for TX channels */ 349 /* Prepare the loop for TX channels */
382 channel_array = controller->tx_channel; 350 channel_array = controller->tx_channel;
383 ch_count = data->num_tx_channels; 351 ch_count = data->num_tx_channels;
384 param_array = data->dma_tx_param_array; 352 param_array = data->dma_tx_param_array;
385 musb_channel_work = ux500_tx_work;
386 is_tx = 1; 353 is_tx = 1;
387 } 354 }
388 355