From patchwork Tue Jul 3 06:04:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141565 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp764527ljj; Mon, 2 Jul 2018 23:05:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe2lXABcOFTVgUqyeW8E/qSxAt6snx1jKFHKL2dRWnOGXuna2GK3DTsOQ/HL+14ajBO5Jez X-Received: by 2002:a17:902:7407:: with SMTP id g7-v6mr21451004pll.85.1530597933580; Mon, 02 Jul 2018 23:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530597933; cv=none; d=google.com; s=arc-20160816; b=VrBRYA9lL2IKOW38lGOU45da3+qhhrfBPAo9upx+BSg6IbLJTQYpgoZaJZOZlKewNW H6xqGk+U0jtFTCkmg8AYKiU1Ccda0bvc+H5u+gY78PcO7q11kluWcobuH7v2FNoD1jTQ kRUQhgpfxe8j7diUnRIa6l4AWeyKBcNp0An3RwRm1njwcP/YnFLm1Zqfc5hhZ8MjPneK IVJGb9ouYKy0nUgN3jqDPJaeGT9urmlO4ayCvnlPLk478SdwIX8UTbvp2qFbTasx4yxT KflpeV7bLvp+GorLGDA30zdP7+nFfEAPi6dDF+ipHm9sdOlsBMgQFr76zLieA42hvanR U9HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tY8Q2mteuwLk/wFMf5gsx3w4xRXrLy07rmem73NVOxs=; b=wUGX48b3wF2vlQaN3Yt/piDa+sX1q2AtydnPdDn2qdV24MqzktFm9PS0aHUOMMT/+1 M3TEZPGrbgu409thh3GDASRs6n9JUWEl8aNHFDp3rqoE/UVxD7ey3Wx4xsqIOIjHzFde V7L+SWkNxLS8X2x5xZfYW+3BO/WEilNXLRVzi5uJ8k5gZOOGoJa3+SMRJD0+09Meance e17Ky1bTwDsf4lrPN6pje6xJmorbhhQ6VJICUeNVziGPa/GmFU1Y656kag8UTS3ZyO3B X9yQvtxjWj5hD6P9dO/syAuEBx0PiEJmVZ/QsttWLU4OOryFa1bs/UR+7WyWnT5yzqoN R1jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y1g8T5R6; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4-v6si362140pgm.441.2018.07.02.23.05.33; Mon, 02 Jul 2018 23:05:33 -0700 (PDT) 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=@kernel.org header.s=default header.b=Y1g8T5R6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932824AbeGCGF2 (ORCPT + 31 others); Tue, 3 Jul 2018 02:05:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:48878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754330AbeGCGFZ (ORCPT ); Tue, 3 Jul 2018 02:05:25 -0400 Received: from localhost.localdomain (unknown [171.61.87.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 606AE22B3E; Tue, 3 Jul 2018 06:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530597925; bh=8JNS2DZGAsTgZ58HUrqCCs42FBM2QkfnS+kA/MKmZtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1g8T5R6acSZ6FJ/ITJ1nk/UHMaCBCb3Cbyaoe3n+CtX9SdrIt3NAJsZX0c0lz4D1 dYVjbtvTPyLLDR4MoMA20QgJ/6EX6+bDO29AYhPyOSd3PlVovHTuQWeKoOGrgZZ5dq Yd+D1V1r8OhmT59wRkwbh61+0N8Ct07wZ9jitqW4= From: Vinod Koul To: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bjorn Andersson , Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Stephen Boyd , Timur Tabi , Vinod Koul Subject: [PATCH v3 5/6] crypto: qcom: Add support for prng-ee Date: Tue, 3 Jul 2018 11:34:33 +0530 Message-Id: <20180703060434.19293-6-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180703060434.19293-1-vkoul@kernel.org> References: <20180703060434.19293-1-vkoul@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Qcom 8996 and later chips features multiple Execution Environments (EE) and secure world is typically responsible for configuring the prng. Add driver data for qcom,prng as 0 and qcom,prng-ee as 1 and use that to skip initialization routine. Signed-off-by: Vinod Koul --- drivers/crypto/qcom-rng.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.14.4 diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c index e235a35359d3..fdbbcac7bcb8 100644 --- a/drivers/crypto/qcom-rng.c +++ b/drivers/crypto/qcom-rng.c @@ -30,6 +30,7 @@ struct qcom_rng { struct mutex lock; void __iomem *base; struct clk *clk; + unsigned int skip_init; }; struct qcom_rng_ctx { @@ -128,7 +129,10 @@ static int qcom_rng_init(struct crypto_tfm *tfm) ctx->rng = qcom_rng_dev; - return qcom_rng_enable(ctx->rng); + if (!ctx->rng->skip_init) + return qcom_rng_enable(ctx->rng); + + return 0; } static struct rng_alg qcom_rng_alg = { @@ -168,6 +172,8 @@ static int qcom_rng_probe(struct platform_device *pdev) if (IS_ERR(rng->clk)) return PTR_ERR(rng->clk); + rng->skip_init = (unsigned long)of_device_get_match_data(&pdev->dev); + qcom_rng_dev = rng; ret = crypto_register_rng(&qcom_rng_alg); if (ret) { @@ -188,7 +194,8 @@ static int qcom_rng_remove(struct platform_device *pdev) } static const struct of_device_id qcom_rng_of_match[] = { - { .compatible = "qcom,prng" }, + { .compatible = "qcom,prng", .data = (void *)0}, + { .compatible = "qcom,prng-ee", .data = (void *)1}, {} }; MODULE_DEVICE_TABLE(of, qcom_rng_of_match);