27 #include <linux/device.h>
74 ux500_channel->
is_tx);
75 spin_unlock_irqrestore(&musb->
lock, flags);
96 "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n",
97 packet_sz, mode, dma_addr, len, ux500_channel->
is_tx);
112 slave_conf.src_addr = usb_fifo_addr;
113 slave_conf.src_addr_width = addr_width;
114 slave_conf.src_maxburst = 16;
115 slave_conf.dst_addr = usb_fifo_addr;
116 slave_conf.dst_addr_width = addr_width;
117 slave_conf.dst_maxburst = 16;
118 slave_conf.device_fc =
false;
121 (
unsigned long) &slave_conf);
123 dma_desc = dmaengine_prep_slave_sg(dma_chan, &
sg, 1, direction,
132 dma_async_issue_pending(dma_chan);
157 if (ch_num >= max_ch)
160 ux500_channel = is_tx ? &(controller->
tx_channel[ch_num]) :
167 ux500_channel->
hw_ep = hw_ep;
171 hw_ep->
epnum, is_tx, ch_num);
173 return &(ux500_channel->
channel);
176 static void ux500_dma_channel_release(
struct dma_channel *channel)
179 struct musb *musb = ux500_channel->
controller->private_data;
190 static int ux500_dma_is_compatible(
struct dma_channel *channel,
193 if ((maxpacket & 0x3) ||
202 static int ux500_dma_channel_program(
struct dma_channel *channel,
203 u16 packet_sz,
u8 mode,
211 if (!ux500_dma_is_compatible(channel, packet_sz, (
void *)dma_addr, len))
216 ret = ux500_configure_channel(channel, packet_sz, mode, dma_addr, len);
223 static int ux500_dma_channel_abort(
struct dma_channel *channel)
235 if (ux500_channel->
is_tx) {
250 device_control(ux500_channel->
dma_chan,
266 channel = &controller->
rx_channel[ch_num].channel;
269 ux500_dma_channel_release(channel);
276 channel = &controller->
tx_channel[ch_num].channel;
279 ux500_dma_channel_release(channel);
322 for (dir = 0; dir < 2; dir++) {
323 for (ch_num = 0; ch_num < ch_count; ch_num++) {
324 ux500_channel = &channel_array[
ch_num];
329 dma_channel = &(ux500_channel->
channel);
336 param_array[ch_num]);
338 ERR(
"Dma pipe allocation error dir=%d ch=%d\n",
342 ux500_dma_controller_stop(c);
374 controller = kzalloc(
sizeof(*controller),
GFP_KERNEL);
384 controller->
controller.start = ux500_dma_controller_start;
385 controller->
controller.stop = ux500_dma_controller_stop;
386 controller->
controller.channel_alloc = ux500_dma_channel_allocate;
387 controller->
controller.channel_release = ux500_dma_channel_release;
388 controller->
controller.channel_program = ux500_dma_channel_program;
389 controller->
controller.channel_abort = ux500_dma_channel_abort;
390 controller->
controller.is_compatible = ux500_dma_is_compatible;