hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/crypto/mediatek/mtk-platform.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Driver for EIP97 cryptographic accelerator.
34 *
45 * Copyright (c) 2016 Ryder Lee <ryder.lee@mediatek.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
106 */
117
128 #include <linux/clk.h>
....@@ -189,8 +185,6 @@
189185
190186 static int mtk_dfe_dse_reset(struct mtk_cryp *cryp)
191187 {
192
- int err;
193
-
194188 /* Reset DSE/DFE and correct system priorities for all rings. */
195189 writel(MTK_DFSE_THR_CTRL_RESET, cryp->base + DFE_THR_CTRL);
196190 writel(0, cryp->base + DFE_PRIO_0);
....@@ -204,11 +198,7 @@
204198 writel(0, cryp->base + DSE_PRIO_2);
205199 writel(0, cryp->base + DSE_PRIO_3);
206200
207
- err = mtk_dfe_dse_state_check(cryp);
208
- if (err)
209
- return err;
210
-
211
- return 0;
201
+ return mtk_dfe_dse_state_check(cryp);
212202 }
213203
214204 static void mtk_cmd_desc_ring_setup(struct mtk_cryp *cryp,
....@@ -453,17 +443,17 @@
453443 if (!ring[i])
454444 goto err_cleanup;
455445
456
- ring[i]->cmd_base = dma_zalloc_coherent(cryp->dev,
457
- MTK_DESC_RING_SZ,
458
- &ring[i]->cmd_dma,
459
- GFP_KERNEL);
446
+ ring[i]->cmd_base = dma_alloc_coherent(cryp->dev,
447
+ MTK_DESC_RING_SZ,
448
+ &ring[i]->cmd_dma,
449
+ GFP_KERNEL);
460450 if (!ring[i]->cmd_base)
461451 goto err_cleanup;
462452
463
- ring[i]->res_base = dma_zalloc_coherent(cryp->dev,
464
- MTK_DESC_RING_SZ,
465
- &ring[i]->res_dma,
466
- GFP_KERNEL);
453
+ ring[i]->res_base = dma_alloc_coherent(cryp->dev,
454
+ MTK_DESC_RING_SZ,
455
+ &ring[i]->res_dma,
456
+ GFP_KERNEL);
467457 if (!ring[i]->res_base)
468458 goto err_cleanup;
469459
....@@ -485,7 +475,6 @@
485475
486476 static int mtk_crypto_probe(struct platform_device *pdev)
487477 {
488
- struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
489478 struct mtk_cryp *cryp;
490479 int i, err;
491480
....@@ -493,16 +482,14 @@
493482 if (!cryp)
494483 return -ENOMEM;
495484
496
- cryp->base = devm_ioremap_resource(&pdev->dev, res);
485
+ cryp->base = devm_platform_ioremap_resource(pdev, 0);
497486 if (IS_ERR(cryp->base))
498487 return PTR_ERR(cryp->base);
499488
500489 for (i = 0; i < MTK_IRQ_NUM; i++) {
501490 cryp->irq[i] = platform_get_irq(pdev, i);
502
- if (cryp->irq[i] < 0) {
503
- dev_err(cryp->dev, "no IRQ:%d resource info\n", i);
491
+ if (cryp->irq[i] < 0)
504492 return cryp->irq[i];
505
- }
506493 }
507494
508495 cryp->clk_cryp = devm_clk_get(&pdev->dev, "cryp");