Lines Matching refs:cmd_q
19 static u32 ccp_alloc_ksb(struct ccp_cmd_queue *cmd_q, unsigned int count) in ccp_alloc_ksb() argument
22 struct ccp_device *ccp = cmd_q->ccp; in ccp_alloc_ksb()
50 static void ccp_free_ksb(struct ccp_cmd_queue *cmd_q, unsigned int start, in ccp_free_ksb() argument
53 struct ccp_device *ccp = cmd_q->ccp; in ccp_free_ksb()
69 static unsigned int ccp_get_free_slots(struct ccp_cmd_queue *cmd_q) in ccp_get_free_slots() argument
71 return CMD_Q_DEPTH(ioread32(cmd_q->reg_status)); in ccp_get_free_slots()
76 struct ccp_cmd_queue *cmd_q = op->cmd_q; in ccp_do_cmd() local
77 struct ccp_device *ccp = cmd_q->ccp; in ccp_do_cmd()
87 cmd_q->free_slots--; in ccp_do_cmd()
89 cr0 = (cmd_q->id << REQ0_CMD_Q_SHIFT) in ccp_do_cmd()
97 if (op->ioc || !cmd_q->free_slots) in ccp_do_cmd()
117 ret = wait_event_interruptible(cmd_q->int_queue, in ccp_do_cmd()
118 cmd_q->int_rcvd); in ccp_do_cmd()
119 if (ret || cmd_q->cmd_error) { in ccp_do_cmd()
121 cmd = (cmd_q->id << DEL_Q_ID_SHIFT) in ccp_do_cmd()
123 if (cmd_q->cmd_error) in ccp_do_cmd()
124 ccp_log_error(cmd_q->ccp, in ccp_do_cmd()
125 cmd_q->cmd_error); in ccp_do_cmd()
134 | (cmd_q->id << DEL_Q_ID_SHIFT) in ccp_do_cmd()
140 cmd_q->free_slots = CMD_Q_DEPTH(cmd_q->q_status); in ccp_do_cmd()
142 cmd_q->int_rcvd = 0; in ccp_do_cmd()
327 struct ccp_cmd_queue *cmd_q; in ccp_irq_bh() local
334 cmd_q = &ccp->cmd_q[i]; in ccp_irq_bh()
336 q_int = status & (cmd_q->int_ok | cmd_q->int_err); in ccp_irq_bh()
338 cmd_q->int_status = status; in ccp_irq_bh()
339 cmd_q->q_status = ioread32(cmd_q->reg_status); in ccp_irq_bh()
340 cmd_q->q_int_status = ioread32(cmd_q->reg_int_status); in ccp_irq_bh()
343 if ((q_int & cmd_q->int_err) && !cmd_q->cmd_error) in ccp_irq_bh()
344 cmd_q->cmd_error = CMD_Q_ERROR(cmd_q->q_status); in ccp_irq_bh()
346 cmd_q->int_rcvd = 1; in ccp_irq_bh()
350 wake_up_interruptible(&cmd_q->int_queue); in ccp_irq_bh()
372 struct ccp_cmd_queue *cmd_q; in ccp_init() local
397 cmd_q = &ccp->cmd_q[ccp->cmd_q_count]; in ccp_init()
400 cmd_q->ccp = ccp; in ccp_init()
401 cmd_q->id = i; in ccp_init()
402 cmd_q->dma_pool = dma_pool; in ccp_init()
405 cmd_q->sb_key = KSB_START + ccp->sb_start++; in ccp_init()
406 cmd_q->sb_ctx = KSB_START + ccp->sb_start++; in ccp_init()
412 cmd_q->reg_status = ccp->io_regs + CMD_Q_STATUS_BASE + in ccp_init()
414 cmd_q->reg_int_status = ccp->io_regs + CMD_Q_INT_STATUS_BASE + in ccp_init()
416 cmd_q->int_ok = 1 << (i * 2); in ccp_init()
417 cmd_q->int_err = 1 << ((i * 2) + 1); in ccp_init()
419 cmd_q->free_slots = ccp_get_free_slots(cmd_q); in ccp_init()
421 init_waitqueue_head(&cmd_q->int_queue); in ccp_init()
424 ccp->qim |= cmd_q->int_ok | cmd_q->int_err; in ccp_init()
444 cmd_q = &ccp->cmd_q[i]; in ccp_init()
446 ioread32(cmd_q->reg_int_status); in ccp_init()
447 ioread32(cmd_q->reg_status); in ccp_init()
468 cmd_q = &ccp->cmd_q[i]; in ccp_init()
470 kthread = kthread_run(ccp_cmd_queue_thread, cmd_q, in ccp_init()
471 "%s-q%u", ccp->name, cmd_q->id); in ccp_init()
479 cmd_q->kthread = kthread; in ccp_init()
505 if (ccp->cmd_q[i].kthread) in ccp_init()
506 kthread_stop(ccp->cmd_q[i].kthread); in ccp_init()
512 dma_pool_destroy(ccp->cmd_q[i].dma_pool); in ccp_init()
519 struct ccp_cmd_queue *cmd_q; in ccp_destroy() local
535 cmd_q = &ccp->cmd_q[i]; in ccp_destroy()
537 ioread32(cmd_q->reg_int_status); in ccp_destroy()
538 ioread32(cmd_q->reg_status); in ccp_destroy()
544 if (ccp->cmd_q[i].kthread) in ccp_destroy()
545 kthread_stop(ccp->cmd_q[i].kthread); in ccp_destroy()
550 dma_pool_destroy(ccp->cmd_q[i].dma_pool); in ccp_destroy()