Lines Matching +full:at91sam9g46 +full:- +full:aes
1 // SPDX-License-Identifier: GPL-2.0
7 * Copyright (c) 2012 Eukréa Electromatique - ATMEL
10 * Some ideas are from omap-aes.c drivers.
30 #include <linux/dma-mapping.h>
38 #include "atmel-tdes-regs.h"
43 /* Reserve bits [17:16], [13:12], [2:0] for AES Mode Register */
156 count = min((*sg)->length - *offset, total); in atmel_tdes_sg_copy()
165 buflen -= count; in atmel_tdes_sg_copy()
167 total -= count; in atmel_tdes_sg_copy()
169 if (*offset == (*sg)->length) { in atmel_tdes_sg_copy()
183 return readl_relaxed(dd->io_base + offset); in atmel_tdes_read()
189 writel_relaxed(value, dd->io_base + offset); in atmel_tdes_write()
195 for (; count--; value++, offset += 4) in atmel_tdes_write_n()
205 if (!ctx->dd) { in atmel_tdes_find_dev()
210 ctx->dd = tdes_dd; in atmel_tdes_find_dev()
212 tdes_dd = ctx->dd; in atmel_tdes_find_dev()
223 err = clk_prepare_enable(dd->iclk); in atmel_tdes_hw_init()
227 if (!(dd->flags & TDES_FLAGS_INIT)) { in atmel_tdes_hw_init()
229 dd->flags |= TDES_FLAGS_INIT; in atmel_tdes_hw_init()
248 dd->hw_version = atmel_tdes_get_version(dd); in atmel_tdes_hw_version_init()
250 dev_info(dd->dev, in atmel_tdes_hw_version_init()
251 "version: 0x%x\n", dd->hw_version); in atmel_tdes_hw_version_init()
253 clk_disable_unprepare(dd->iclk); in atmel_tdes_hw_version_init()
262 /* dma_lch_out - completed */ in atmel_tdes_dma_callback()
263 tasklet_schedule(&dd->done_task); in atmel_tdes_dma_callback()
276 if (!dd->caps.has_dma) in atmel_tdes_write_ctrl()
281 if (dd->ctx->keylen > (DES_KEY_SIZE << 1)) { in atmel_tdes_write_ctrl()
284 } else if (dd->ctx->keylen > DES_KEY_SIZE) { in atmel_tdes_write_ctrl()
291 valmr |= dd->flags & TDES_FLAGS_MODE_MASK; in atmel_tdes_write_ctrl()
295 atmel_tdes_write_n(dd, TDES_KEY1W1R, dd->ctx->key, in atmel_tdes_write_ctrl()
296 dd->ctx->keylen >> 2); in atmel_tdes_write_ctrl()
298 if (dd->req->iv && (valmr & TDES_MR_OPMOD_MASK) != TDES_MR_OPMOD_ECB) in atmel_tdes_write_ctrl()
299 atmel_tdes_write_n(dd, TDES_IV1R, (void *)dd->req->iv, 2); in atmel_tdes_write_ctrl()
311 if (dd->flags & TDES_FLAGS_FAST) { in atmel_tdes_crypt_pdc_stop()
312 dma_unmap_sg(dd->dev, dd->out_sg, 1, DMA_FROM_DEVICE); in atmel_tdes_crypt_pdc_stop()
313 dma_unmap_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); in atmel_tdes_crypt_pdc_stop()
315 dma_sync_single_for_device(dd->dev, dd->dma_addr_out, in atmel_tdes_crypt_pdc_stop()
316 dd->dma_size, DMA_FROM_DEVICE); in atmel_tdes_crypt_pdc_stop()
319 count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset, in atmel_tdes_crypt_pdc_stop()
320 dd->buf_out, dd->buflen, dd->dma_size, 1); in atmel_tdes_crypt_pdc_stop()
321 if (count != dd->dma_size) { in atmel_tdes_crypt_pdc_stop()
322 err = -EINVAL; in atmel_tdes_crypt_pdc_stop()
332 int err = -ENOMEM; in atmel_tdes_buff_init()
334 dd->buf_in = (void *)__get_free_pages(GFP_KERNEL, 0); in atmel_tdes_buff_init()
335 dd->buf_out = (void *)__get_free_pages(GFP_KERNEL, 0); in atmel_tdes_buff_init()
336 dd->buflen = PAGE_SIZE; in atmel_tdes_buff_init()
337 dd->buflen &= ~(DES_BLOCK_SIZE - 1); in atmel_tdes_buff_init()
339 if (!dd->buf_in || !dd->buf_out) { in atmel_tdes_buff_init()
340 dev_err(dd->dev, "unable to alloc pages.\n"); in atmel_tdes_buff_init()
345 dd->dma_addr_in = dma_map_single(dd->dev, dd->buf_in, in atmel_tdes_buff_init()
346 dd->buflen, DMA_TO_DEVICE); in atmel_tdes_buff_init()
347 if (dma_mapping_error(dd->dev, dd->dma_addr_in)) { in atmel_tdes_buff_init()
348 dev_err(dd->dev, "dma %zd bytes error\n", dd->buflen); in atmel_tdes_buff_init()
349 err = -EINVAL; in atmel_tdes_buff_init()
353 dd->dma_addr_out = dma_map_single(dd->dev, dd->buf_out, in atmel_tdes_buff_init()
354 dd->buflen, DMA_FROM_DEVICE); in atmel_tdes_buff_init()
355 if (dma_mapping_error(dd->dev, dd->dma_addr_out)) { in atmel_tdes_buff_init()
356 dev_err(dd->dev, "dma %zd bytes error\n", dd->buflen); in atmel_tdes_buff_init()
357 err = -EINVAL; in atmel_tdes_buff_init()
364 dma_unmap_single(dd->dev, dd->dma_addr_in, dd->buflen, in atmel_tdes_buff_init()
368 free_page((unsigned long)dd->buf_out); in atmel_tdes_buff_init()
369 free_page((unsigned long)dd->buf_in); in atmel_tdes_buff_init()
377 dma_unmap_single(dd->dev, dd->dma_addr_out, dd->buflen, in atmel_tdes_buff_cleanup()
379 dma_unmap_single(dd->dev, dd->dma_addr_in, dd->buflen, in atmel_tdes_buff_cleanup()
381 free_page((unsigned long)dd->buf_out); in atmel_tdes_buff_cleanup()
382 free_page((unsigned long)dd->buf_in); in atmel_tdes_buff_cleanup()
389 struct atmel_tdes_reqctx *rctx = skcipher_request_ctx(dd->req); in atmel_tdes_crypt_pdc()
392 dd->dma_size = length; in atmel_tdes_crypt_pdc()
394 if (!(dd->flags & TDES_FLAGS_FAST)) { in atmel_tdes_crypt_pdc()
395 dma_sync_single_for_device(dd->dev, dma_addr_in, length, in atmel_tdes_crypt_pdc()
399 switch (rctx->mode & TDES_FLAGS_OPMODE_MASK) { in atmel_tdes_crypt_pdc()
432 struct atmel_tdes_reqctx *rctx = skcipher_request_ctx(dd->req); in atmel_tdes_crypt_dma()
437 dd->dma_size = length; in atmel_tdes_crypt_dma()
439 if (!(dd->flags & TDES_FLAGS_FAST)) { in atmel_tdes_crypt_dma()
440 dma_sync_single_for_device(dd->dev, dma_addr_in, length, in atmel_tdes_crypt_dma()
444 switch (rctx->mode & TDES_FLAGS_OPMODE_MASK) { in atmel_tdes_crypt_dma()
458 dd->dma_lch_in.dma_conf.dst_addr_width = addr_width; in atmel_tdes_crypt_dma()
459 dd->dma_lch_out.dma_conf.src_addr_width = addr_width; in atmel_tdes_crypt_dma()
461 dmaengine_slave_config(dd->dma_lch_in.chan, &dd->dma_lch_in.dma_conf); in atmel_tdes_crypt_dma()
462 dmaengine_slave_config(dd->dma_lch_out.chan, &dd->dma_lch_out.dma_conf); in atmel_tdes_crypt_dma()
464 dd->flags |= TDES_FLAGS_DMA; in atmel_tdes_crypt_dma()
474 in_desc = dmaengine_prep_slave_sg(dd->dma_lch_in.chan, &sg[0], in atmel_tdes_crypt_dma()
478 return -EINVAL; in atmel_tdes_crypt_dma()
480 out_desc = dmaengine_prep_slave_sg(dd->dma_lch_out.chan, &sg[1], in atmel_tdes_crypt_dma()
484 return -EINVAL; in atmel_tdes_crypt_dma()
486 out_desc->callback = atmel_tdes_dma_callback; in atmel_tdes_crypt_dma()
487 out_desc->callback_param = dd; in atmel_tdes_crypt_dma()
490 dma_async_issue_pending(dd->dma_lch_out.chan); in atmel_tdes_crypt_dma()
493 dma_async_issue_pending(dd->dma_lch_in.chan); in atmel_tdes_crypt_dma()
504 if ((!dd->in_offset) && (!dd->out_offset)) { in atmel_tdes_crypt_start()
506 in = IS_ALIGNED((u32)dd->in_sg->offset, sizeof(u32)) && in atmel_tdes_crypt_start()
507 IS_ALIGNED(dd->in_sg->length, dd->ctx->block_size); in atmel_tdes_crypt_start()
508 out = IS_ALIGNED((u32)dd->out_sg->offset, sizeof(u32)) && in atmel_tdes_crypt_start()
509 IS_ALIGNED(dd->out_sg->length, dd->ctx->block_size); in atmel_tdes_crypt_start()
512 if (sg_dma_len(dd->in_sg) != sg_dma_len(dd->out_sg)) in atmel_tdes_crypt_start()
518 count = min_t(size_t, dd->total, sg_dma_len(dd->in_sg)); in atmel_tdes_crypt_start()
519 count = min_t(size_t, count, sg_dma_len(dd->out_sg)); in atmel_tdes_crypt_start()
521 err = dma_map_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); in atmel_tdes_crypt_start()
523 dev_err(dd->dev, "dma_map_sg() error\n"); in atmel_tdes_crypt_start()
524 return -EINVAL; in atmel_tdes_crypt_start()
527 err = dma_map_sg(dd->dev, dd->out_sg, 1, in atmel_tdes_crypt_start()
530 dev_err(dd->dev, "dma_map_sg() error\n"); in atmel_tdes_crypt_start()
531 dma_unmap_sg(dd->dev, dd->in_sg, 1, in atmel_tdes_crypt_start()
533 return -EINVAL; in atmel_tdes_crypt_start()
536 addr_in = sg_dma_address(dd->in_sg); in atmel_tdes_crypt_start()
537 addr_out = sg_dma_address(dd->out_sg); in atmel_tdes_crypt_start()
539 dd->flags |= TDES_FLAGS_FAST; in atmel_tdes_crypt_start()
543 count = atmel_tdes_sg_copy(&dd->in_sg, &dd->in_offset, in atmel_tdes_crypt_start()
544 dd->buf_in, dd->buflen, dd->total, 0); in atmel_tdes_crypt_start()
546 addr_in = dd->dma_addr_in; in atmel_tdes_crypt_start()
547 addr_out = dd->dma_addr_out; in atmel_tdes_crypt_start()
549 dd->flags &= ~TDES_FLAGS_FAST; in atmel_tdes_crypt_start()
552 dd->total -= count; in atmel_tdes_crypt_start()
554 if (dd->caps.has_dma) in atmel_tdes_crypt_start()
559 if (err && (dd->flags & TDES_FLAGS_FAST)) { in atmel_tdes_crypt_start()
560 dma_unmap_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); in atmel_tdes_crypt_start()
561 dma_unmap_sg(dd->dev, dd->out_sg, 1, DMA_TO_DEVICE); in atmel_tdes_crypt_start()
570 struct skcipher_request *req = dd->req; in atmel_tdes_set_iv_as_last_ciphertext_block()
575 if (req->cryptlen < ivsize) in atmel_tdes_set_iv_as_last_ciphertext_block()
578 if (rctx->mode & TDES_FLAGS_ENCRYPT) { in atmel_tdes_set_iv_as_last_ciphertext_block()
579 scatterwalk_map_and_copy(req->iv, req->dst, in atmel_tdes_set_iv_as_last_ciphertext_block()
580 req->cryptlen - ivsize, ivsize, 0); in atmel_tdes_set_iv_as_last_ciphertext_block()
582 if (req->src == req->dst) in atmel_tdes_set_iv_as_last_ciphertext_block()
583 memcpy(req->iv, rctx->lastc, ivsize); in atmel_tdes_set_iv_as_last_ciphertext_block()
585 scatterwalk_map_and_copy(req->iv, req->src, in atmel_tdes_set_iv_as_last_ciphertext_block()
586 req->cryptlen - ivsize, in atmel_tdes_set_iv_as_last_ciphertext_block()
593 struct skcipher_request *req = dd->req; in atmel_tdes_finish_req()
596 clk_disable_unprepare(dd->iclk); in atmel_tdes_finish_req()
598 dd->flags &= ~TDES_FLAGS_BUSY; in atmel_tdes_finish_req()
600 if (!err && (rctx->mode & TDES_FLAGS_OPMODE_MASK) != TDES_FLAGS_ECB) in atmel_tdes_finish_req()
603 req->base.complete(&req->base, err); in atmel_tdes_finish_req()
615 spin_lock_irqsave(&dd->lock, flags); in atmel_tdes_handle_queue()
617 ret = crypto_enqueue_request(&dd->queue, &req->base); in atmel_tdes_handle_queue()
618 if (dd->flags & TDES_FLAGS_BUSY) { in atmel_tdes_handle_queue()
619 spin_unlock_irqrestore(&dd->lock, flags); in atmel_tdes_handle_queue()
622 backlog = crypto_get_backlog(&dd->queue); in atmel_tdes_handle_queue()
623 async_req = crypto_dequeue_request(&dd->queue); in atmel_tdes_handle_queue()
625 dd->flags |= TDES_FLAGS_BUSY; in atmel_tdes_handle_queue()
626 spin_unlock_irqrestore(&dd->lock, flags); in atmel_tdes_handle_queue()
632 backlog->complete(backlog, -EINPROGRESS); in atmel_tdes_handle_queue()
637 dd->req = req; in atmel_tdes_handle_queue()
638 dd->total = req->cryptlen; in atmel_tdes_handle_queue()
639 dd->in_offset = 0; in atmel_tdes_handle_queue()
640 dd->in_sg = req->src; in atmel_tdes_handle_queue()
641 dd->out_offset = 0; in atmel_tdes_handle_queue()
642 dd->out_sg = req->dst; in atmel_tdes_handle_queue()
646 rctx->mode &= TDES_FLAGS_MODE_MASK; in atmel_tdes_handle_queue()
647 dd->flags = (dd->flags & ~TDES_FLAGS_MODE_MASK) | rctx->mode; in atmel_tdes_handle_queue()
648 dd->ctx = ctx; in atmel_tdes_handle_queue()
649 ctx->dd = dd; in atmel_tdes_handle_queue()
657 tasklet_schedule(&dd->queue_task); in atmel_tdes_handle_queue()
665 int err = -EINVAL; in atmel_tdes_crypt_dma_stop()
668 if (dd->flags & TDES_FLAGS_DMA) { in atmel_tdes_crypt_dma_stop()
670 if (dd->flags & TDES_FLAGS_FAST) { in atmel_tdes_crypt_dma_stop()
671 dma_unmap_sg(dd->dev, dd->out_sg, 1, DMA_FROM_DEVICE); in atmel_tdes_crypt_dma_stop()
672 dma_unmap_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); in atmel_tdes_crypt_dma_stop()
674 dma_sync_single_for_device(dd->dev, dd->dma_addr_out, in atmel_tdes_crypt_dma_stop()
675 dd->dma_size, DMA_FROM_DEVICE); in atmel_tdes_crypt_dma_stop()
678 count = atmel_tdes_sg_copy(&dd->out_sg, &dd->out_offset, in atmel_tdes_crypt_dma_stop()
679 dd->buf_out, dd->buflen, dd->dma_size, 1); in atmel_tdes_crypt_dma_stop()
680 if (count != dd->dma_size) { in atmel_tdes_crypt_dma_stop()
681 err = -EINVAL; in atmel_tdes_crypt_dma_stop()
697 if (!IS_ALIGNED(req->cryptlen, CFB8_BLOCK_SIZE)) { in atmel_tdes_crypt()
699 return -EINVAL; in atmel_tdes_crypt()
701 ctx->block_size = CFB8_BLOCK_SIZE; in atmel_tdes_crypt()
705 if (!IS_ALIGNED(req->cryptlen, CFB16_BLOCK_SIZE)) { in atmel_tdes_crypt()
707 return -EINVAL; in atmel_tdes_crypt()
709 ctx->block_size = CFB16_BLOCK_SIZE; in atmel_tdes_crypt()
713 if (!IS_ALIGNED(req->cryptlen, CFB32_BLOCK_SIZE)) { in atmel_tdes_crypt()
715 return -EINVAL; in atmel_tdes_crypt()
717 ctx->block_size = CFB32_BLOCK_SIZE; in atmel_tdes_crypt()
721 if (!IS_ALIGNED(req->cryptlen, DES_BLOCK_SIZE)) { in atmel_tdes_crypt()
723 return -EINVAL; in atmel_tdes_crypt()
725 ctx->block_size = DES_BLOCK_SIZE; in atmel_tdes_crypt()
729 rctx->mode = mode; in atmel_tdes_crypt()
732 !(mode & TDES_FLAGS_ENCRYPT) && req->src == req->dst) { in atmel_tdes_crypt()
735 if (req->cryptlen >= ivsize) in atmel_tdes_crypt()
736 scatterwalk_map_and_copy(rctx->lastc, req->src, in atmel_tdes_crypt()
737 req->cryptlen - ivsize, in atmel_tdes_crypt()
741 return atmel_tdes_handle_queue(ctx->dd, req); in atmel_tdes_crypt()
749 dd->dma_lch_in.chan = dma_request_chan(dd->dev, "tx"); in atmel_tdes_dma_init()
750 if (IS_ERR(dd->dma_lch_in.chan)) { in atmel_tdes_dma_init()
751 ret = PTR_ERR(dd->dma_lch_in.chan); in atmel_tdes_dma_init()
755 dd->dma_lch_in.dma_conf.dst_addr = dd->phys_base + in atmel_tdes_dma_init()
757 dd->dma_lch_in.dma_conf.src_maxburst = 1; in atmel_tdes_dma_init()
758 dd->dma_lch_in.dma_conf.src_addr_width = in atmel_tdes_dma_init()
760 dd->dma_lch_in.dma_conf.dst_maxburst = 1; in atmel_tdes_dma_init()
761 dd->dma_lch_in.dma_conf.dst_addr_width = in atmel_tdes_dma_init()
763 dd->dma_lch_in.dma_conf.device_fc = false; in atmel_tdes_dma_init()
765 dd->dma_lch_out.chan = dma_request_chan(dd->dev, "rx"); in atmel_tdes_dma_init()
766 if (IS_ERR(dd->dma_lch_out.chan)) { in atmel_tdes_dma_init()
767 ret = PTR_ERR(dd->dma_lch_out.chan); in atmel_tdes_dma_init()
771 dd->dma_lch_out.dma_conf.src_addr = dd->phys_base + in atmel_tdes_dma_init()
773 dd->dma_lch_out.dma_conf.src_maxburst = 1; in atmel_tdes_dma_init()
774 dd->dma_lch_out.dma_conf.src_addr_width = in atmel_tdes_dma_init()
776 dd->dma_lch_out.dma_conf.dst_maxburst = 1; in atmel_tdes_dma_init()
777 dd->dma_lch_out.dma_conf.dst_addr_width = in atmel_tdes_dma_init()
779 dd->dma_lch_out.dma_conf.device_fc = false; in atmel_tdes_dma_init()
784 dma_release_channel(dd->dma_lch_in.chan); in atmel_tdes_dma_init()
786 dev_err(dd->dev, "no DMA channel available\n"); in atmel_tdes_dma_init()
792 dma_release_channel(dd->dma_lch_in.chan); in atmel_tdes_dma_cleanup()
793 dma_release_channel(dd->dma_lch_out.chan); in atmel_tdes_dma_cleanup()
806 memcpy(ctx->key, key, keylen); in atmel_des_setkey()
807 ctx->keylen = keylen; in atmel_des_setkey()
822 memcpy(ctx->key, key, keylen); in atmel_tdes_setkey()
823 ctx->keylen = keylen; in atmel_tdes_setkey()
906 return -ENODEV; in atmel_tdes_init_tfm()
913 alg->base.cra_priority = ATMEL_TDES_PRIORITY; in atmel_tdes_skcipher_alg_init()
914 alg->base.cra_flags = CRYPTO_ALG_ASYNC; in atmel_tdes_skcipher_alg_init()
915 alg->base.cra_ctxsize = sizeof(struct atmel_tdes_ctx); in atmel_tdes_skcipher_alg_init()
916 alg->base.cra_module = THIS_MODULE; in atmel_tdes_skcipher_alg_init()
918 alg->init = atmel_tdes_init_tfm; in atmel_tdes_skcipher_alg_init()
924 .base.cra_driver_name = "atmel-ecb-des",
936 .base.cra_driver_name = "atmel-cbc-des",
949 .base.cra_driver_name = "atmel-cfb-des",
962 .base.cra_driver_name = "atmel-cfb8-des",
975 .base.cra_driver_name = "atmel-cfb16-des",
988 .base.cra_driver_name = "atmel-cfb32-des",
1001 .base.cra_driver_name = "atmel-ofb-des",
1014 .base.cra_driver_name = "atmel-ecb-tdes",
1026 .base.cra_driver_name = "atmel-cbc-tdes",
1039 .base.cra_driver_name = "atmel-ofb-tdes",
1064 if (!(dd->flags & TDES_FLAGS_DMA)) in atmel_tdes_done_task()
1069 if (dd->total && !err) { in atmel_tdes_done_task()
1070 if (dd->flags & TDES_FLAGS_FAST) { in atmel_tdes_done_task()
1071 dd->in_sg = sg_next(dd->in_sg); in atmel_tdes_done_task()
1072 dd->out_sg = sg_next(dd->out_sg); in atmel_tdes_done_task()
1073 if (!dd->in_sg || !dd->out_sg) in atmel_tdes_done_task()
1074 err = -EINVAL; in atmel_tdes_done_task()
1094 if (TDES_FLAGS_BUSY & tdes_dd->flags) in atmel_tdes_irq()
1095 tasklet_schedule(&tdes_dd->done_task); in atmel_tdes_irq()
1097 dev_warn(tdes_dd->dev, "TDES interrupt when no active requests.\n"); in atmel_tdes_irq()
1136 dd->caps.has_dma = 0; in atmel_tdes_get_cap()
1137 dd->caps.has_cfb_3keys = 0; in atmel_tdes_get_cap()
1140 switch (dd->hw_version & 0xf00) { in atmel_tdes_get_cap()
1142 dd->caps.has_dma = 1; in atmel_tdes_get_cap()
1143 dd->caps.has_cfb_3keys = 1; in atmel_tdes_get_cap()
1148 dev_warn(dd->dev, in atmel_tdes_get_cap()
1156 { .compatible = "atmel,at91sam9g46-tdes" },
1165 struct device *dev = &pdev->dev; in atmel_tdes_probe()
1169 tdes_dd = devm_kmalloc(&pdev->dev, sizeof(*tdes_dd), GFP_KERNEL); in atmel_tdes_probe()
1171 return -ENOMEM; in atmel_tdes_probe()
1173 tdes_dd->dev = dev; in atmel_tdes_probe()
1177 INIT_LIST_HEAD(&tdes_dd->list); in atmel_tdes_probe()
1178 spin_lock_init(&tdes_dd->lock); in atmel_tdes_probe()
1180 tasklet_init(&tdes_dd->done_task, atmel_tdes_done_task, in atmel_tdes_probe()
1182 tasklet_init(&tdes_dd->queue_task, atmel_tdes_queue_task, in atmel_tdes_probe()
1185 crypto_init_queue(&tdes_dd->queue, ATMEL_TDES_QUEUE_LENGTH); in atmel_tdes_probe()
1191 err = -ENODEV; in atmel_tdes_probe()
1194 tdes_dd->phys_base = tdes_res->start; in atmel_tdes_probe()
1197 tdes_dd->irq = platform_get_irq(pdev, 0); in atmel_tdes_probe()
1198 if (tdes_dd->irq < 0) { in atmel_tdes_probe()
1199 err = tdes_dd->irq; in atmel_tdes_probe()
1203 err = devm_request_irq(&pdev->dev, tdes_dd->irq, atmel_tdes_irq, in atmel_tdes_probe()
1204 IRQF_SHARED, "atmel-tdes", tdes_dd); in atmel_tdes_probe()
1211 tdes_dd->iclk = devm_clk_get(&pdev->dev, "tdes_clk"); in atmel_tdes_probe()
1212 if (IS_ERR(tdes_dd->iclk)) { in atmel_tdes_probe()
1214 err = PTR_ERR(tdes_dd->iclk); in atmel_tdes_probe()
1218 tdes_dd->io_base = devm_ioremap_resource(&pdev->dev, tdes_res); in atmel_tdes_probe()
1219 if (IS_ERR(tdes_dd->io_base)) { in atmel_tdes_probe()
1221 err = PTR_ERR(tdes_dd->io_base); in atmel_tdes_probe()
1235 if (tdes_dd->caps.has_dma) { in atmel_tdes_probe()
1241 dma_chan_name(tdes_dd->dma_lch_in.chan), in atmel_tdes_probe()
1242 dma_chan_name(tdes_dd->dma_lch_out.chan)); in atmel_tdes_probe()
1246 list_add_tail(&tdes_dd->list, &atmel_tdes.dev_list); in atmel_tdes_probe()
1259 list_del(&tdes_dd->list); in atmel_tdes_probe()
1261 if (tdes_dd->caps.has_dma) in atmel_tdes_probe()
1266 tasklet_kill(&tdes_dd->done_task); in atmel_tdes_probe()
1267 tasklet_kill(&tdes_dd->queue_task); in atmel_tdes_probe()
1278 return -ENODEV; in atmel_tdes_remove()
1280 list_del(&tdes_dd->list); in atmel_tdes_remove()
1285 tasklet_kill(&tdes_dd->done_task); in atmel_tdes_remove()
1286 tasklet_kill(&tdes_dd->queue_task); in atmel_tdes_remove()
1288 if (tdes_dd->caps.has_dma) in atmel_tdes_remove()
1309 MODULE_AUTHOR("Nicolas Royer - Eukréa Electromatique");