Lines Matching refs:scc
153 struct mxc_scc *scc; member
164 struct mxc_scc *scc; member
172 struct mxc_scc *scc = ctx->scc; in mxc_scc_get_data() local
177 from = scc->red_memory; in mxc_scc_get_data()
179 from = scc->black_memory; in mxc_scc_get_data()
181 dev_dbg(scc->dev, "pcopy: from 0x%p %d bytes\n", from, in mxc_scc_get_data()
186 dev_err(scc->dev, "pcopy err from 0x%p (len=%d)\n", from, len); in mxc_scc_get_data()
194 scc->red_memory, ctx->size, 1); in mxc_scc_get_data()
198 scc->black_memory, ctx->size, 1); in mxc_scc_get_data()
212 struct mxc_scc *scc = ctx->scc; in mxc_scc_ablkcipher_req_init() local
217 dev_err(scc->dev, "Invalid number of src SC"); in mxc_scc_ablkcipher_req_init()
224 dev_err(scc->dev, "Invalid number of dst SC"); in mxc_scc_ablkcipher_req_init()
240 struct mxc_scc *scc = ctx->scc; in mxc_scc_ablkcipher_req_complete() local
242 scc->req = NULL; in mxc_scc_ablkcipher_req_complete()
243 scc->bytes_remaining = scc->memory_size_bytes; in mxc_scc_ablkcipher_req_complete()
246 memcpy(ablkreq->info, scc->base + SCC_SCM_INIT_VECTOR_0, in mxc_scc_ablkcipher_req_complete()
247 scc->block_size_bytes); in mxc_scc_ablkcipher_req_complete()
250 scc->hw_busy = false; in mxc_scc_ablkcipher_req_complete()
260 ctx->scc->bytes_remaining); in mxc_scc_put_data()
262 struct mxc_scc *scc = ctx->scc; in mxc_scc_put_data() local
266 to = scc->black_memory; in mxc_scc_put_data()
268 to = scc->red_memory; in mxc_scc_put_data()
271 memcpy(scc->base + SCC_SCM_INIT_VECTOR_0, req->info, in mxc_scc_put_data()
272 scc->block_size_bytes); in mxc_scc_put_data()
277 dev_err(scc->dev, "pcopy err to 0x%p (len=%d)\n", to, len); in mxc_scc_put_data()
284 dev_dbg(scc->dev, "copied %d bytes to 0x%p\n", len, to); in mxc_scc_put_data()
288 scc->base + SCC_SCM_INIT_VECTOR_0, scc->block_size_bytes, in mxc_scc_put_data()
293 scc->red_memory, ctx->size, 1); in mxc_scc_put_data()
297 scc->black_memory, ctx->size, 1); in mxc_scc_put_data()
300 scc->bytes_remaining -= len; in mxc_scc_put_data()
302 padding_byte_count = len % scc->block_size_bytes; in mxc_scc_put_data()
324 struct mxc_scc *scc = ctx->scc; in mxc_scc_ablkcipher_next() local
327 dev_dbg(scc->dev, "dispatch request (nbytes=%d, src=%p, dst=%p)\n", in mxc_scc_ablkcipher_next()
330 writel(0, scc->base + SCC_SCM_ERROR_STATUS); in mxc_scc_ablkcipher_next()
338 dev_dbg(scc->dev, "Start encryption (0x%p/0x%p)\n", in mxc_scc_ablkcipher_next()
339 (void *)readl(scc->base + SCC_SCM_RED_START), in mxc_scc_ablkcipher_next()
340 (void *)readl(scc->base + SCC_SCM_BLACK_START)); in mxc_scc_ablkcipher_next()
344 scc->base + SCC_SCM_INTR_CTRL); in mxc_scc_ablkcipher_next()
346 writel((ctx->size / ctx->scc->block_size_bytes) - 1, in mxc_scc_ablkcipher_next()
347 scc->base + SCC_SCM_LENGTH); in mxc_scc_ablkcipher_next()
349 dev_dbg(scc->dev, "Process %d block(s) in 0x%p\n", in mxc_scc_ablkcipher_next()
350 ctx->size / ctx->scc->block_size_bytes, in mxc_scc_ablkcipher_next()
351 (ctx->ctrl & SCC_SCM_CTRL_DECRYPT_MODE) ? scc->black_memory : in mxc_scc_ablkcipher_next()
352 scc->red_memory); in mxc_scc_ablkcipher_next()
354 writel(ctx->ctrl, scc->base + SCC_SCM_CTRL); in mxc_scc_ablkcipher_next()
361 struct mxc_scc *scc = priv; in mxc_scc_int() local
365 status = readl(scc->base + SCC_SCM_STATUS); in mxc_scc_int()
368 writel(SCC_SCM_INTR_CTRL_CLR_INTR, scc->base + SCC_SCM_INTR_CTRL); in mxc_scc_int()
373 req = scc->req; in mxc_scc_int()
394 ctx->scc = algt->scc; in mxc_scc_cra_init()
402 if (ctx->scc->hw_busy) in mxc_scc_dequeue_req_unlocked()
405 spin_lock_bh(&ctx->scc->lock); in mxc_scc_dequeue_req_unlocked()
406 backlog = crypto_get_backlog(&ctx->scc->queue); in mxc_scc_dequeue_req_unlocked()
407 req = crypto_dequeue_request(&ctx->scc->queue); in mxc_scc_dequeue_req_unlocked()
408 ctx->scc->req = req; in mxc_scc_dequeue_req_unlocked()
409 ctx->scc->hw_busy = true; in mxc_scc_dequeue_req_unlocked()
410 spin_unlock_bh(&ctx->scc->lock); in mxc_scc_dequeue_req_unlocked()
426 spin_lock_bh(&ctx->scc->lock); in mxc_scc_queue_req()
427 ret = crypto_enqueue_request(&ctx->scc->queue, req); in mxc_scc_queue_req()
428 spin_unlock_bh(&ctx->scc->lock); in mxc_scc_queue_req()
494 static void mxc_scc_hw_init(struct mxc_scc *scc) in mxc_scc_hw_init() argument
498 offset = SCC_NON_RESERVED_OFFSET / scc->block_size_bytes; in mxc_scc_hw_init()
501 writel(offset, scc->base + SCC_SCM_RED_START); in mxc_scc_hw_init()
504 writel(offset, scc->base + SCC_SCM_BLACK_START); in mxc_scc_hw_init()
506 scc->red_memory = scc->base + SCC_SCM_RED_MEMORY + in mxc_scc_hw_init()
509 scc->black_memory = scc->base + SCC_SCM_BLACK_MEMORY + in mxc_scc_hw_init()
512 scc->bytes_remaining = scc->memory_size_bytes; in mxc_scc_hw_init()
515 static int mxc_scc_get_config(struct mxc_scc *scc) in mxc_scc_get_config() argument
519 config = readl(scc->base + SCC_SCM_CFG); in mxc_scc_get_config()
521 scc->block_size_bytes = config & SCC_SCM_CFG_BLOCK_SIZE_MASK; in mxc_scc_get_config()
523 scc->black_ram_size_blocks = config & SCC_SCM_CFG_BLACK_SIZE_MASK; in mxc_scc_get_config()
525 scc->memory_size_bytes = (scc->block_size_bytes * in mxc_scc_get_config()
526 scc->black_ram_size_blocks) - in mxc_scc_get_config()
532 static enum mxc_scc_state mxc_scc_get_state(struct mxc_scc *scc) in mxc_scc_get_state() argument
537 status = readl(scc->base + SCC_SMN_STATUS) & in mxc_scc_get_state()
546 writel(0xaaaa, scc->base + SCC_SMN_SEQ_START); in mxc_scc_get_state()
547 writel(0x5555, scc->base + SCC_SMN_SEQ_END); in mxc_scc_get_state()
548 writel(0x5555, scc->base + SCC_SMN_SEQ_CHECK); in mxc_scc_get_state()
550 status = readl(scc->base + SCC_SMN_STATUS) & in mxc_scc_get_state()
617 static int mxc_scc_crypto_register(struct mxc_scc *scc) in mxc_scc_crypto_register() argument
623 scc_crypto_algs[i]->scc = scc; in mxc_scc_crypto_register()
650 struct mxc_scc *scc; in mxc_scc_probe() local
656 scc = devm_kzalloc(dev, sizeof(*scc), GFP_KERNEL); in mxc_scc_probe()
657 if (!scc) in mxc_scc_probe()
661 scc->base = devm_ioremap_resource(dev, res); in mxc_scc_probe()
662 if (IS_ERR(scc->base)) in mxc_scc_probe()
663 return PTR_ERR(scc->base); in mxc_scc_probe()
665 scc->clk = devm_clk_get(&pdev->dev, "ipg"); in mxc_scc_probe()
666 if (IS_ERR(scc->clk)) { in mxc_scc_probe()
668 return PTR_ERR(scc->clk); in mxc_scc_probe()
671 ret = clk_prepare_enable(scc->clk); in mxc_scc_probe()
676 writel(0x0, scc->base + SCC_SCM_ERROR_STATUS); in mxc_scc_probe()
681 scc->base + SCC_SCM_INTR_CTRL); in mxc_scc_probe()
685 scc->base + SCC_SMN_COMMAND); in mxc_scc_probe()
687 scc->dev = dev; in mxc_scc_probe()
688 platform_set_drvdata(pdev, scc); in mxc_scc_probe()
690 ret = mxc_scc_get_config(scc); in mxc_scc_probe()
694 state = mxc_scc_get_state(scc); in mxc_scc_probe()
702 mxc_scc_hw_init(scc); in mxc_scc_probe()
704 spin_lock_init(&scc->lock); in mxc_scc_probe()
706 crypto_init_queue(&scc->queue, 50); in mxc_scc_probe()
717 IRQF_ONESHOT, dev_name(dev), scc); in mxc_scc_probe()
722 ret = mxc_scc_crypto_register(scc); in mxc_scc_probe()
733 clk_disable_unprepare(scc->clk); in mxc_scc_probe()
740 struct mxc_scc *scc = platform_get_drvdata(pdev); in mxc_scc_remove() local
744 clk_disable_unprepare(scc->clk); in mxc_scc_remove()