Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1475508imp; Fri, 22 Feb 2019 04:24:22 -0800 (PST) X-Google-Smtp-Source: AHgI3IYLRFO0alE9wNzQ636POErnFsr2zNAccAt4jgMpH/JFNj/yRFS5lTUG5Ncm5CP15nvr1hnS X-Received: by 2002:a17:902:b20c:: with SMTP id t12mr894686plr.340.1550838262316; Fri, 22 Feb 2019 04:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550838262; cv=none; d=google.com; s=arc-20160816; b=DRo36kHfQi0SfmuD8cgNq81B2xp1jAiuiY1sDe5Ff7+5NuP0npOEOXZ1FtBXCu1wgR ZpbScJUM+r14oECqJ8y11wSvHcZCI1/FCk10iqBWNszTBjfrkQvj4x7RXlai2JQ+Nmqs XIgPVY3KI03CGB/HA6Zg3kASngwt5QzfCIOyn3wlY5dqBbkJJ6y5FMlPZ9p+TgEsJTPq vHA/ZKLtZa5h60lVysZjcFMtbxYAy8mq25iXB/RaJ2VXPb/yxGR1IgN7ry47fFHCzTlz kfFNrC43icOFz55S4jSQfDlfQAH929C+HJ2+ZMKvEvt3ZbVuqiQh8JcGEDtWoOg4EdwV IEfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=VG6oAC5U9XTdjvMniG4O/CFb//GFZSZ9LzVAmwE443c=; b=mHXjflm6XAEbboDxUJTPBJfqmwMx8LKOAs8W8p2bJX587iWl5qXiTwvJgvrEgMytxw bFSP/c9iCLddLgtWZVs6iEWKyV/+1d7TzFEM3eckN8duo+tktGVQqM3ucRWsiEduJdmJ HRncAv+VATvnYPy4IGmw+EJscENlVjRwv5HbyQKmCqaDV1cRNE4jnCFCeRUyV9UvDLFZ 44NwbIOAOIJQWYe/gttt01XqzW32llw74B/8SvMVK8JsO46YwXmYfpFWtTkLUYxO8NYx FObe3T7nzG0WrZnmjg04TFigHarJh33b3ZfeQyQ8gZPAL4jEGJ5UvjUqApK+Q/EsywBm 9meQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PJpNeavy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si1243508pla.226.2019.02.22.04.24.06; Fri, 22 Feb 2019 04:24:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=PJpNeavy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727194AbfBVMWS (ORCPT + 99 others); Fri, 22 Feb 2019 07:22:18 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:33264 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbfBVMWI (ORCPT ); Fri, 22 Feb 2019 07:22:08 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190222122206euoutp020125c0d3e319aca7c681667a290ecd7b~Frw8hhWYv3245732457euoutp028 for ; Fri, 22 Feb 2019 12:22:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190222122206euoutp020125c0d3e319aca7c681667a290ecd7b~Frw8hhWYv3245732457euoutp028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1550838126; bh=VG6oAC5U9XTdjvMniG4O/CFb//GFZSZ9LzVAmwE443c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJpNeavyTvvuf7BNF9OP4tkGco4mef6DF69kUjaOLJKpUZU8VrXY/Ro55FmjkEY6Z 9A6cBYnyav1G71cYBb0i8Fc+ppl+SSCd1OdylpbG0smMITBqv/5xfFpSWyvtkLU/d/ Yx3j89BV3+i7F8Q0nX8bsAWQ1Z4o15UmcDGviB90= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190222122205eucas1p1fc5c2e5d5e76efead31ca6e8d6af7209~Frw8Jf-W-2093320933eucas1p1D; Fri, 22 Feb 2019 12:22:05 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id EE.BF.04441.D69EF6C5; Fri, 22 Feb 2019 12:22:05 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190222122204eucas1p1ee66c9d937bdf328588ececb1f005526~Frw7VHecE1233312333eucas1p1C; Fri, 22 Feb 2019 12:22:04 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190222122204eusmtrp11c8f8dec82bcb08e4fa381ec79d109cf~Frw7Gmifj1040810408eusmtrp12; Fri, 22 Feb 2019 12:22:04 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-c7-5c6fe96d0e63 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 16.6F.04128.C69EF6C5; Fri, 22 Feb 2019 12:22:04 +0000 (GMT) Received: from AMDC3218.DIGITAL.local (unknown [106.120.51.18]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190222122204eusmtip15dd7560288b814ad81af00aa6ad82deb~Frw6kiR6-1159911599eusmtip1W; Fri, 22 Feb 2019 12:22:04 +0000 (GMT) From: Kamil Konieczny To: k.konieczny@partner.samsung.com Cc: Krzysztof Kozlowski , Vladimir Zapolskiy , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [PATCH v4 3/3] crypto: s5p: add AES support for Exynos5433 Date: Fri, 22 Feb 2019 13:21:44 +0100 Message-Id: <20190222122144.19024-4-k.konieczny@partner.samsung.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190222122144.19024-1-k.konieczny@partner.samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCKsWRmVeSWpSXmKPExsWy7djPc7q5L/NjDDa8UbDYOGM9q8Wc8y0s Ft2vZCz69v1ntDh/fgO7xf17P5ksLu+aw2Yx4/w+Jou1R+6yW/z/1czswOWxZeVNJo9tB1Q9 Nq3qZPP4t3AKi8fBd3uYPPq2rGL0+LxJLoA9issmJTUnsyy1SN8ugStj4qbrjAWv5Cq2PnzG 2MB4Q6KLkZNDQsBEYllzC1sXIxeHkMAKRom5F7exQjhfGCWO9C5lgnA+M0r09L5mhml5PWM3 mC0ksJxRYskNfbiOyR+2MYIk2ATMJR5tP8MEYosIKEtMvjedGaSIWeA1k8SG26/AEsICzhIv dt1jAbFZBFQl7nW1sIPYvAIuEmunPYDaJi9xvncdWJxTwFWi4fcdRogaQYmTM5+A9TID1TRv nQ22QEJgE7vEvWWLgRwOIMdF4tATXog5whKvjm9hh7BlJE5P7mGBsMsldm99xg7R2wIMgMmL mCAS1hKHj19kBZnDLKApsX6XPsRIR4krr70gTD6JG28FIS7gk5i0bTrUUl6JjjYhiBm6Ev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SuINTQ3NLSwNzY3Njc0slMR5 zxtURgkJpCeWpGanphakFsH0MXFwSjUw9qZEdc5aeszYe75EV1y/OqvH260a29VsbCbz1Byd fJ5J5cKOSTxNCy6xsrIGXbztpVznXnua80muaoFd3StfybdFEdfXad5WFb+gw/L5uutGvvNH JrcdTzC/wbO42jamv4j//CplVqne2edsav9PbLA1e2N/2rL9qZFbntOzRxPjA7a7fv6ixFKc kWioxVxUnAgAmsFr/rUCAAA= X-CMS-MailID: 20190222122204eucas1p1ee66c9d937bdf328588ececb1f005526 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190222122204eucas1p1ee66c9d937bdf328588ececb1f005526 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190222122204eucas1p1ee66c9d937bdf328588ececb1f005526 References: <20190222122144.19024-1-k.konieczny@partner.samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add AES crypto HW acceleration for Exynos5433, with the help of SlimSSS IP. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Kamil Konieczny --- drivers/crypto/s5p-sss.c | 50 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index 0064be0e3941..3f45cc5cb94a 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -232,6 +232,7 @@ * struct samsung_aes_variant - platform specific SSS driver data * @aes_offset: AES register offset from SSS module's base. * @hash_offset: HASH register offset from SSS module's base. + * @clk_names: names of clocks needed to run SSS IP * * Specifies platform specific configuration of SSS module. * Note: A structure for driver specific platform data is used for future @@ -240,6 +241,7 @@ struct samsung_aes_variant { unsigned int aes_offset; unsigned int hash_offset; + const char *clk_names[]; }; struct s5p_aes_reqctx { @@ -296,6 +298,7 @@ struct s5p_aes_ctx { struct s5p_aes_dev { struct device *dev; struct clk *clk; + struct clk *pclk; void __iomem *ioaddr; void __iomem *aes_ioaddr; int irq_fc; @@ -384,11 +387,19 @@ struct s5p_hash_ctx { static const struct samsung_aes_variant s5p_aes_data = { .aes_offset = 0x4000, .hash_offset = 0x6000, + .clk_names = { "secss", }, }; static const struct samsung_aes_variant exynos_aes_data = { .aes_offset = 0x200, .hash_offset = 0x400, + .clk_names = { "secss", }, +}; + +static const struct samsung_aes_variant exynos5433_slim_aes_data = { + .aes_offset = 0x400, + .hash_offset = 0x800, + .clk_names = { "pclk", "aclk", }, }; static const struct of_device_id s5p_sss_dt_match[] = { @@ -400,6 +411,10 @@ static const struct of_device_id s5p_sss_dt_match[] = { .compatible = "samsung,exynos4210-secss", .data = &exynos_aes_data, }, + { + .compatible = "samsung,exynos5433-slim-sss", + .data = &exynos5433_slim_aes_data, + }, { }, }; MODULE_DEVICE_TABLE(of, s5p_sss_dt_match); @@ -2208,18 +2223,39 @@ static int s5p_aes_probe(struct platform_device *pdev) return PTR_ERR(pdata->ioaddr); } - pdata->clk = devm_clk_get(dev, "secss"); + pdata->clk = devm_clk_get(dev, variant->clk_names[0]); if (IS_ERR(pdata->clk)) { - dev_err(dev, "failed to find secss clock source\n"); + dev_err(dev, "failed to find secss clock %s\n", + variant->clk_names[0]); return -ENOENT; } err = clk_prepare_enable(pdata->clk); if (err < 0) { - dev_err(dev, "Enabling SSS clk failed, err %d\n", err); + dev_err(dev, "Enabling clock %s failed, err %d\n", + variant->clk_names[0], err); return err; } + if (variant->clk_names[1]) { + pdata->pclk = devm_clk_get(dev, variant->clk_names[1]); + if (IS_ERR(pdata->pclk)) { + dev_err(dev, "failed to find clock %s\n", + variant->clk_names[1]); + err = -ENOENT; + goto err_clk; + } + + err = clk_prepare_enable(pdata->pclk); + if (err < 0) { + dev_err(dev, "Enabling clock %s failed, err %d\n", + variant->clk_names[0], err); + goto err_clk; + } + } else { + pdata->pclk = NULL; + } + spin_lock_init(&pdata->lock); spin_lock_init(&pdata->hash_lock); @@ -2295,8 +2331,11 @@ static int s5p_aes_probe(struct platform_device *pdev) tasklet_kill(&pdata->tasklet); err_irq: - clk_disable_unprepare(pdata->clk); + if (pdata->pclk) + clk_disable_unprepare(pdata->pclk); +err_clk: + clk_disable_unprepare(pdata->clk); s5p_dev = NULL; return err; @@ -2323,6 +2362,9 @@ static int s5p_aes_remove(struct platform_device *pdev) pdata->use_hash = false; } + if (pdata->pclk) + clk_disable_unprepare(pdata->pclk); + clk_disable_unprepare(pdata->clk); s5p_dev = NULL; -- 2.20.1