33 #include <linux/device.h>
36 #include <linux/slab.h>
58 "Stopping DMA controller while channel active\n");
63 dma_channel_release(channel);
91 channel = &(musb_channel->
channel);
105 static void dma_channel_release(
struct dma_channel *channel)
111 musb_channel->
len = 0;
114 ~(1 << musb_channel->
idx);
119 static void configure_channel(
struct dma_channel *channel,
131 channel, packet_sz, dma_addr, len, mode);
157 static int dma_channel_program(
struct dma_channel *channel,
158 u16 packet_sz,
u8 mode,
165 dev_dbg(musb->
controller,
"ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n",
167 musb_channel->
transmit ?
"Tx" :
"Rx",
168 packet_sz, dma_addr, len, mode);
174 if (musb->
ops->adjust_channel_params) {
175 int ret = musb->
ops->adjust_channel_params(channel,
176 packet_sz, &mode, &dma_addr, &len);
195 musb_channel->
len = len;
199 configure_channel(channel, packet_sz, mode, dma_addr, len);
204 static int dma_channel_abort(
struct dma_channel *channel)
209 u8 bchannel = musb_channel->
idx;
222 csr = musb_readw(mbase, offset);
224 musb_writew(mbase, offset, csr);
226 musb_writew(mbase, offset, csr);
231 csr = musb_readw(mbase, offset);
235 musb_writew(mbase, offset, csr);
272 #ifdef CONFIG_BLACKFIN
282 &(controller->
channel[bchannel]);
283 channel = &musb_channel->
channel;
288 int_hsdma |= (1 << bchannel);
299 if (int_hsdma & (1 << bchannel)) {
301 &(controller->
channel[bchannel]);
302 channel = &musb_channel->
channel;
304 csr = musb_readw(mbase,
324 < musb_channel->
len) ?
325 "=> reconfig 0" :
"=> complete");
348 txcsr = musb_readw(mbase, offset);
351 musb_writew(mbase, offset, txcsr);
355 musb_writew(mbase, offset, txcsr);
365 spin_unlock_irqrestore(&musb->
lock, flags);
392 dev_err(dev,
"No DMA interrupt line!\n");
396 controller = kzalloc(
sizeof(*controller),
GFP_KERNEL);
402 controller->
base = base;
404 controller->
controller.start = dma_controller_start;
405 controller->
controller.stop = dma_controller_stop;
406 controller->
controller.channel_alloc = dma_channel_allocate;
407 controller->
controller.channel_release = dma_channel_release;
408 controller->
controller.channel_program = dma_channel_program;
409 controller->
controller.channel_abort = dma_channel_abort;
413 dev_err(dev,
"request_irq %d failed!\n", irq);
419 controller->
irq = irq;