• Home
  • Raw
  • Download

Lines Matching refs:ccp

135 void ccp_add_device(struct ccp_device *ccp)  in ccp_add_device()  argument
140 list_add_tail(&ccp->entry, &ccp_units); in ccp_add_device()
145 ccp_rr = ccp; in ccp_add_device()
158 void ccp_del_device(struct ccp_device *ccp) in ccp_del_device() argument
163 if (ccp_rr == ccp) { in ccp_del_device()
174 list_del(&ccp->entry); in ccp_del_device()
182 int ccp_register_rng(struct ccp_device *ccp) in ccp_register_rng() argument
186 dev_dbg(ccp->dev, "Registering RNG...\n"); in ccp_register_rng()
188 ccp->hwrng.name = ccp->rngname; in ccp_register_rng()
189 ccp->hwrng.read = ccp_trng_read; in ccp_register_rng()
190 ret = hwrng_register(&ccp->hwrng); in ccp_register_rng()
192 dev_err(ccp->dev, "error registering hwrng (%d)\n", ret); in ccp_register_rng()
197 void ccp_unregister_rng(struct ccp_device *ccp) in ccp_unregister_rng() argument
199 if (ccp->hwrng.name) in ccp_unregister_rng()
200 hwrng_unregister(&ccp->hwrng); in ccp_unregister_rng()
291 struct ccp_device *ccp; in ccp_enqueue_cmd() local
297 ccp = cmd->ccp ? cmd->ccp : ccp_get_device(); in ccp_enqueue_cmd()
299 if (!ccp) in ccp_enqueue_cmd()
306 cmd->ccp = ccp; in ccp_enqueue_cmd()
308 spin_lock_irqsave(&ccp->cmd_lock, flags); in ccp_enqueue_cmd()
310 i = ccp->cmd_q_count; in ccp_enqueue_cmd()
312 if (ccp->cmd_count >= MAX_CMD_QLEN) { in ccp_enqueue_cmd()
315 list_add_tail(&cmd->entry, &ccp->backlog); in ccp_enqueue_cmd()
321 ccp->cmd_count++; in ccp_enqueue_cmd()
322 list_add_tail(&cmd->entry, &ccp->cmd); in ccp_enqueue_cmd()
325 if (!ccp->suspending) { in ccp_enqueue_cmd()
326 for (i = 0; i < ccp->cmd_q_count; i++) { in ccp_enqueue_cmd()
327 if (ccp->cmd_q[i].active) in ccp_enqueue_cmd()
335 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_enqueue_cmd()
338 if (i < ccp->cmd_q_count) in ccp_enqueue_cmd()
339 wake_up_process(ccp->cmd_q[i].kthread); in ccp_enqueue_cmd()
348 struct ccp_device *ccp = cmd->ccp; in ccp_do_cmd_backlog() local
354 spin_lock_irqsave(&ccp->cmd_lock, flags); in ccp_do_cmd_backlog()
356 ccp->cmd_count++; in ccp_do_cmd_backlog()
357 list_add_tail(&cmd->entry, &ccp->cmd); in ccp_do_cmd_backlog()
360 for (i = 0; i < ccp->cmd_q_count; i++) { in ccp_do_cmd_backlog()
361 if (ccp->cmd_q[i].active) in ccp_do_cmd_backlog()
367 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_do_cmd_backlog()
370 if (i < ccp->cmd_q_count) in ccp_do_cmd_backlog()
371 wake_up_process(ccp->cmd_q[i].kthread); in ccp_do_cmd_backlog()
376 struct ccp_device *ccp = cmd_q->ccp; in ccp_dequeue_cmd() local
381 spin_lock_irqsave(&ccp->cmd_lock, flags); in ccp_dequeue_cmd()
385 if (ccp->suspending) { in ccp_dequeue_cmd()
388 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_dequeue_cmd()
389 wake_up_interruptible(&ccp->suspend_queue); in ccp_dequeue_cmd()
394 if (ccp->cmd_count) { in ccp_dequeue_cmd()
397 cmd = list_first_entry(&ccp->cmd, struct ccp_cmd, entry); in ccp_dequeue_cmd()
400 ccp->cmd_count--; in ccp_dequeue_cmd()
403 if (!list_empty(&ccp->backlog)) { in ccp_dequeue_cmd()
404 backlog = list_first_entry(&ccp->backlog, struct ccp_cmd, in ccp_dequeue_cmd()
409 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_dequeue_cmd()
478 struct ccp_device *ccp; in ccp_alloc_struct() local
480 ccp = devm_kzalloc(dev, sizeof(*ccp), GFP_KERNEL); in ccp_alloc_struct()
481 if (!ccp) in ccp_alloc_struct()
483 ccp->dev = dev; in ccp_alloc_struct()
484 ccp->sp = sp; in ccp_alloc_struct()
485 ccp->axcache = sp->axcache; in ccp_alloc_struct()
487 INIT_LIST_HEAD(&ccp->cmd); in ccp_alloc_struct()
488 INIT_LIST_HEAD(&ccp->backlog); in ccp_alloc_struct()
490 spin_lock_init(&ccp->cmd_lock); in ccp_alloc_struct()
491 mutex_init(&ccp->req_mutex); in ccp_alloc_struct()
492 mutex_init(&ccp->sb_mutex); in ccp_alloc_struct()
493 ccp->sb_count = KSB_COUNT; in ccp_alloc_struct()
494 ccp->sb_start = 0; in ccp_alloc_struct()
497 init_waitqueue_head(&ccp->sb_queue); in ccp_alloc_struct()
498 init_waitqueue_head(&ccp->suspend_queue); in ccp_alloc_struct()
500 snprintf(ccp->name, MAX_CCP_NAME_LEN, "ccp-%u", sp->ord); in ccp_alloc_struct()
501 snprintf(ccp->rngname, MAX_CCP_NAME_LEN, "ccp-%u-rng", sp->ord); in ccp_alloc_struct()
503 return ccp; in ccp_alloc_struct()
508 struct ccp_device *ccp = container_of(rng, struct ccp_device, hwrng); in ccp_trng_read() local
515 trng_value = ioread32(ccp->io_regs + TRNG_OUT_REG); in ccp_trng_read()
521 if (ccp->hwrng_retries++ > TRNG_RETRIES) in ccp_trng_read()
528 ccp->hwrng_retries = 0; in ccp_trng_read()
534 bool ccp_queues_suspended(struct ccp_device *ccp) in ccp_queues_suspended() argument
540 spin_lock_irqsave(&ccp->cmd_lock, flags); in ccp_queues_suspended()
542 for (i = 0; i < ccp->cmd_q_count; i++) in ccp_queues_suspended()
543 if (ccp->cmd_q[i].suspended) in ccp_queues_suspended()
546 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_queues_suspended()
548 return ccp->cmd_q_count == suspended; in ccp_queues_suspended()
553 struct ccp_device *ccp = sp->ccp_data; in ccp_dev_suspend() local
558 if (!ccp) in ccp_dev_suspend()
561 spin_lock_irqsave(&ccp->cmd_lock, flags); in ccp_dev_suspend()
563 ccp->suspending = 1; in ccp_dev_suspend()
566 for (i = 0; i < ccp->cmd_q_count; i++) in ccp_dev_suspend()
567 wake_up_process(ccp->cmd_q[i].kthread); in ccp_dev_suspend()
569 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_dev_suspend()
572 while (!ccp_queues_suspended(ccp)) in ccp_dev_suspend()
573 wait_event_interruptible(ccp->suspend_queue, in ccp_dev_suspend()
574 ccp_queues_suspended(ccp)); in ccp_dev_suspend()
579 struct ccp_device *ccp = sp->ccp_data; in ccp_dev_resume() local
584 if (!ccp) in ccp_dev_resume()
587 spin_lock_irqsave(&ccp->cmd_lock, flags); in ccp_dev_resume()
589 ccp->suspending = 0; in ccp_dev_resume()
592 for (i = 0; i < ccp->cmd_q_count; i++) { in ccp_dev_resume()
593 ccp->cmd_q[i].suspended = 0; in ccp_dev_resume()
594 wake_up_process(ccp->cmd_q[i].kthread); in ccp_dev_resume()
597 spin_unlock_irqrestore(&ccp->cmd_lock, flags); in ccp_dev_resume()
603 struct ccp_device *ccp; in ccp_dev_init() local
614 ccp = ccp_alloc_struct(sp); in ccp_dev_init()
615 if (!ccp) in ccp_dev_init()
617 sp->ccp_data = ccp; in ccp_dev_init()
620 ccp->max_q_count = MAX_HW_QUEUES; in ccp_dev_init()
622 ccp->max_q_count = nqueues; in ccp_dev_init()
624 ccp->vdata = (struct ccp_vdata *)sp->dev_vdata->ccp_vdata; in ccp_dev_init()
625 if (!ccp->vdata || !ccp->vdata->version) { in ccp_dev_init()
631 ccp->use_tasklet = sp->use_tasklet; in ccp_dev_init()
633 ccp->io_regs = sp->io_map + ccp->vdata->offset; in ccp_dev_init()
634 if (ccp->vdata->setup) in ccp_dev_init()
635 ccp->vdata->setup(ccp); in ccp_dev_init()
637 ret = ccp->vdata->perform->init(ccp); in ccp_dev_init()
664 struct ccp_device *ccp = sp->ccp_data; in ccp_dev_destroy() local
666 if (!ccp) in ccp_dev_destroy()
669 ccp->vdata->perform->destroy(ccp); in ccp_dev_destroy()