23 #define MSM_DMOV_CHANNEL_COUNT 16
32 static struct clk *msm_dmov_clk;
33 static unsigned int channel_active;
38 #define MSM_DMOV_DPRINTF(mask, format, args...) \
40 if ((mask) & msm_dmov_print_mask) \
41 printk(KERN_ERR format, args); \
43 #define PRINT_ERROR(format, args...) \
44 MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args);
45 #define PRINT_IO(format, args...) \
46 MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args);
47 #define PRINT_FLOW(format, args...) \
48 MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args);
57 unsigned long irq_flags;
65 if (list_empty(&ready_commands[
id]) &&
68 if (list_empty(&active_commands[
id])) {
69 PRINT_FLOW(
"msm_dmov_enqueue_cmd(%d), enable interrupt\n",
id);
75 PRINT_IO(
"msm_dmov_enqueue_cmd(%d), start command, status %x\n",
id, status);
79 channel_active |= 1
U <<
id;
84 if (list_empty(&active_commands[
id]))
85 PRINT_ERROR(
"msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n",
id, status);
87 PRINT_IO(
"msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n",
id, status);
90 spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
102 dmov_exec_cmdptr_complete_func(
struct msm_dmov_cmd *_cmd,
108 if (result != 0x80000002 && err)
118 PRINT_FLOW(
"dmov_exec_cmdptr(%d, %x)\n",
id, cmdptr);
121 cmd.
dmov_cmd.complete_func = dmov_exec_cmdptr_complete_func;
129 if (cmd.
result != 0x80000002) {
131 PRINT_ERROR(
"dmov_exec_cmdptr(%d): flush: %x %x %x %x\n",
132 id, cmd.
err.flush[0], cmd.
err.flush[1], cmd.
err.flush[2], cmd.
err.flush[3]);
135 PRINT_FLOW(
"dmov_exec_cmdptr(%d, %x) done\n",
id, cmdptr);
143 unsigned long irq_flags;
144 unsigned int ch_status;
145 unsigned int ch_result;
151 PRINT_FLOW(
"msm_datamover_irq_handler: DMOV_ISR %x\n", int_status);
156 PRINT_FLOW(
"msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask,
id);
160 PRINT_FLOW(
"msm_datamover_irq_handler id %d, result not valid %x\n",
id, ch_status);
165 if (list_empty(&active_commands[
id])) {
166 PRINT_ERROR(
"msm_datamover_irq_handler id %d, got result "
167 "with no active command, status %x, result %x\n",
168 id, ch_status, ch_result);
172 PRINT_FLOW(
"msm_datamover_irq_handler id %d, status %x, result %x\n",
id, ch_status, ch_result);
174 PRINT_FLOW(
"msm_datamover_irq_handler id %d, status %x\n",
176 PRINT_IO(
"msm_datamover_irq_handler id %d, got result "
177 "for %p, result %x\n",
id, cmd, ch_result);
193 PRINT_FLOW(
"msm_datamover_irq_handler id %d, status %x\n",
id, ch_status);
194 PRINT_FLOW(
"msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n",
id, ch_result, errdata.flush[0]);
211 PRINT_ERROR(
"msm_datamover_irq_handler id %d, status %x\n",
id, ch_status);
212 PRINT_ERROR(
"msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n",
id, ch_result, errdata.flush[0]);
223 PRINT_FLOW(
"msm_datamover_irq_handler id %d, status %x\n",
id, ch_status);
226 list_move_tail(&cmd->
list, &active_commands[
id]);
229 PRINT_FLOW(
"msm_datamover_irq_handler id %d, start command\n",
id);
232 }
while (ch_status & DMOV_STATUS_RSLT_VALID);
233 if (list_empty(&active_commands[
id]) && list_empty(&ready_commands[
id]))
234 channel_active &= ~(1
U <<
id);
235 PRINT_FLOW(
"msm_datamover_irq_handler id %d, status %x\n",
id, ch_status);
238 if (!channel_active) {
243 spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
247 static int __init msm_init_datamover(
void)
254 INIT_LIST_HEAD(&ready_commands[i]);
255 INIT_LIST_HEAD(&active_commands[i]);