Lines Matching refs:jrp

83 	struct caam_drv_private_jr *jrp = dev_get_drvdata(dev);  in caam_jr_stop_processing()  local
87 if (rd_reg32(&jrp->rregs->jrintstatus) & JRINT_ERR_HALT_INPROGRESS) in caam_jr_stop_processing()
91 clrsetbits_32(&jrp->rregs->jrintstatus, JRINT_ERR_HALT_MASK, 0); in caam_jr_stop_processing()
94 wr_reg32(&jrp->rregs->jrcommand, jrcr_bits); in caam_jr_stop_processing()
97 while (((rd_reg32(&jrp->rregs->jrintstatus) & JRINT_ERR_HALT_MASK) == in caam_jr_stop_processing()
101 if ((rd_reg32(&jrp->rregs->jrintstatus) & JRINT_ERR_HALT_MASK) != in caam_jr_stop_processing()
103 dev_err(dev, "failed to flush job ring %d\n", jrp->ridx); in caam_jr_stop_processing()
124 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_restart_processing() local
125 u32 halt_status = rd_reg32(&jrp->rregs->jrintstatus) & in caam_jr_restart_processing()
133 clrsetbits_32(&jrp->rregs->jrintstatus, 0, JRINT_ERR_HALT_COMPLETE); in caam_jr_restart_processing()
140 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_reset_hw_jr() local
147 clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JRCFG_IMSK); in caam_reset_hw_jr()
153 wr_reg32(&jrp->rregs->jrcommand, JRCR_RESET); in caam_reset_hw_jr()
154 while ((rd_reg32(&jrp->rregs->jrcommand) & JRCR_RESET) && --timeout) in caam_reset_hw_jr()
158 dev_err(dev, "failed to reset job ring %d\n", jrp->ridx); in caam_reset_hw_jr()
163 clrsetbits_32(&jrp->rregs->rconfig_lo, JRCFG_IMSK, 0); in caam_reset_hw_jr()
173 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_shutdown() local
178 tasklet_kill(&jrp->irqtask); in caam_jr_shutdown()
228 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_interrupt() local
235 irqstate = rd_reg32(&jrp->rregs->jrintstatus); in caam_jr_interrupt()
250 clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JRCFG_IMSK); in caam_jr_interrupt()
253 wr_reg32(&jrp->rregs->jrintstatus, irqstate); in caam_jr_interrupt()
256 tasklet_schedule(&jrp->irqtask); in caam_jr_interrupt()
268 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_dequeue() local
275 (outring_used = rd_reg32(&jrp->rregs->outring_used))) { in caam_jr_dequeue()
277 head = READ_ONCE(jrp->head); in caam_jr_dequeue()
279 sw_idx = tail = jrp->tail; in caam_jr_dequeue()
280 hw_idx = jrp->out_ring_read_index; in caam_jr_dequeue()
285 if (jr_outentry_desc(jrp->outring, hw_idx) == in caam_jr_dequeue()
286 caam_dma_to_cpu(jrp->entinfo[sw_idx].desc_addr_dma)) in caam_jr_dequeue()
294 caam_dma_to_cpu(jr_outentry_desc(jrp->outring, in caam_jr_dequeue()
296 jrp->entinfo[sw_idx].desc_size, in caam_jr_dequeue()
300 jrp->entinfo[sw_idx].desc_addr_dma = 0; in caam_jr_dequeue()
303 usercall = jrp->entinfo[sw_idx].callbk; in caam_jr_dequeue()
304 userarg = jrp->entinfo[sw_idx].cbkarg; in caam_jr_dequeue()
305 userdesc = jrp->entinfo[sw_idx].desc_addr_virt; in caam_jr_dequeue()
306 userstatus = caam32_to_cpu(jr_outentry_jrstatus(jrp->outring, in caam_jr_dequeue()
317 wr_reg32(&jrp->rregs->outring_rmvd, 1); in caam_jr_dequeue()
319 jrp->out_ring_read_index = (jrp->out_ring_read_index + 1) & in caam_jr_dequeue()
331 jrp->entinfo[tail].desc_addr_dma == 0); in caam_jr_dequeue()
333 jrp->tail = tail; in caam_jr_dequeue()
343 clrsetbits_32(&jrp->rregs->rconfig_lo, JRCFG_IMSK, 0); in caam_jr_dequeue()
431 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_enqueue() local
443 spin_lock_bh(&jrp->inplock); in caam_jr_enqueue()
445 head = jrp->head; in caam_jr_enqueue()
446 tail = READ_ONCE(jrp->tail); in caam_jr_enqueue()
448 if (!jrp->inpring_avail || in caam_jr_enqueue()
450 spin_unlock_bh(&jrp->inplock); in caam_jr_enqueue()
455 head_entry = &jrp->entinfo[head]; in caam_jr_enqueue()
462 jr_inpentry_set(jrp->inpring, head, cpu_to_caam_dma(desc_dma)); in caam_jr_enqueue()
479 jrp->head = (head + 1) & (JOBR_DEPTH - 1); in caam_jr_enqueue()
489 wr_reg32(&jrp->rregs->inpring_jobadd, 1); in caam_jr_enqueue()
491 jrp->inpring_avail--; in caam_jr_enqueue()
492 if (!jrp->inpring_avail) in caam_jr_enqueue()
493 jrp->inpring_avail = rd_reg32(&jrp->rregs->inpring_avail); in caam_jr_enqueue()
495 spin_unlock_bh(&jrp->inplock); in caam_jr_enqueue()
504 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_init_hw() local
506 wr_reg64(&jrp->rregs->inpring_base, inpbusaddr); in caam_jr_init_hw()
507 wr_reg64(&jrp->rregs->outring_base, outbusaddr); in caam_jr_init_hw()
508 wr_reg32(&jrp->rregs->inpring_size, JOBR_DEPTH); in caam_jr_init_hw()
509 wr_reg32(&jrp->rregs->outring_size, JOBR_DEPTH); in caam_jr_init_hw()
512 clrsetbits_32(&jrp->rregs->rconfig_lo, 0, JOBR_INTC | in caam_jr_init_hw()
517 static void caam_jr_reset_index(struct caam_drv_private_jr *jrp) in caam_jr_reset_index() argument
519 jrp->out_ring_read_index = 0; in caam_jr_reset_index()
520 jrp->head = 0; in caam_jr_reset_index()
521 jrp->tail = 0; in caam_jr_reset_index()
529 struct caam_drv_private_jr *jrp; in caam_jr_init() local
533 jrp = dev_get_drvdata(dev); in caam_jr_init()
539 jrp->inpring = dmam_alloc_coherent(dev, SIZEOF_JR_INPENTRY * in caam_jr_init()
542 if (!jrp->inpring) in caam_jr_init()
545 jrp->outring = dmam_alloc_coherent(dev, SIZEOF_JR_OUTENTRY * in caam_jr_init()
548 if (!jrp->outring) in caam_jr_init()
551 jrp->entinfo = devm_kcalloc(dev, JOBR_DEPTH, sizeof(*jrp->entinfo), in caam_jr_init()
553 if (!jrp->entinfo) in caam_jr_init()
557 jrp->entinfo[i].desc_addr_dma = !0; in caam_jr_init()
560 caam_jr_reset_index(jrp); in caam_jr_init()
561 jrp->inpring_avail = JOBR_DEPTH; in caam_jr_init()
564 spin_lock_init(&jrp->inplock); in caam_jr_init()
566 jrp->tasklet_params.dev = dev; in caam_jr_init()
567 jrp->tasklet_params.enable_itr = 1; in caam_jr_init()
568 tasklet_init(&jrp->irqtask, caam_jr_dequeue, in caam_jr_init()
569 (unsigned long)&jrp->tasklet_params); in caam_jr_init()
572 error = devm_request_irq(dev, jrp->irq, caam_jr_interrupt, IRQF_SHARED, in caam_jr_init()
576 jrp->ridx, jrp->irq); in caam_jr_init()
577 tasklet_kill(&jrp->irqtask); in caam_jr_init()
690 struct caam_drv_private_jr *jrp = dev_get_drvdata(dev); in caam_jr_get_hw_state() local
692 jrp->state.inpbusaddr = rd_reg64(&jrp->rregs->inpring_base); in caam_jr_get_hw_state()
693 jrp->state.outbusaddr = rd_reg64(&jrp->rregs->outring_base); in caam_jr_get_hw_state()