From patchwork Wed Jul 4 11:44:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141558 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp705787ljj; Wed, 4 Jul 2018 04:45:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdEEOJ84Ro0Eh1KIYgGBnIoKuoGNLYTzjmIfPmnLmxfFrkPdGKr+/aGJ6+NHJTXqfeCxUqO X-Received: by 2002:a63:b02:: with SMTP id 2-v6mr1554915pgl.301.1530704726897; Wed, 04 Jul 2018 04:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530704726; cv=none; d=google.com; s=arc-20160816; b=TmFIM/+V5ca1HrgzE6ItNE4Wt1WRbMWfoZHq6Ilfmm/3z1ukrGe3UXrXAuCbUAWPZo IBh3DyLdCkAU/mhSdAL5R11lgzlANkJxatKEAvdJkegKdVLVE0HvhDRjbXVV2AE33H06 pXdNRAZsZMYuJJ3MsWzf0qyqgIInM5xNq1kMGDEqKLuJUW2j6xycAHvrDkSWlfEKc623 wWCDBbPhdtBz/sxvYaEPCb6EI/i3Ud9iblbWtUPVBDIi2W/H2cuAT9pSphVuRUWMf0Hp MWFgYMu57bL1B3nGHUZQlADktneI69DzgrHK3Gjgarq//oBFQqo3Ixn3jEu0xSkg1Ayk 4pAA== 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=Jk2JAnjORiMwAqoSHawqC9xPT3EMi5svE98yavwIn/k=; b=nAHQb0xgD1iGfRBVwKrHkhkQq5/wv4T/oo0m+BqN0LFzGYshTuVn4XTHIS+J+6bouu gE7QXk31p7BkqECt880ZDEgjD1SosfUsW0mmk/IEQrpfpPT55ILqXyocvsQcxdHf6NrV WyUEVoW/f3aMyadNVgPRIFrj1HSHrLy9HIWdN4hoTrSYKGWur8VjCU1FKp818wNh5tAN 6qLa1cZsxSbjldeENknoVyqPdw8SpIC95tFz09/dWwQ3gg0uonB3s8uHK14vwCx+nEbK Dr1D4f2W8ztjtivKe1MjnP6oAE4dKTSFjPrlltxNv5OIvRtSLrvkggs6p2UVZOD3MpKr MKBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=FGYXnl2u; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 e189-v6si3477789pfe.80.2018.07.04.04.45.26; Wed, 04 Jul 2018 04:45:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=FGYXnl2u; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934443AbeGDLpZ (ORCPT + 13 others); Wed, 4 Jul 2018 07:45:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:38716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934330AbeGDLpX (ORCPT ); Wed, 4 Jul 2018 07:45:23 -0400 Received: from localhost.localdomain (unknown [122.167.70.177]) (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 1F97D21456; Wed, 4 Jul 2018 11:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1530704723; bh=9F2j0qU4EuKw6U0ANvByv1DweXfo29Cp44sdPkaPidg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FGYXnl2uZte/nJHFvFBKMKNXHmLLNz0ypf132sZB97sXsJIh3ZKuKy0AT3Jq3tbuy W8QYYuqMNzqS/P89UaKr98MyqoYQn4569pjzgDCIacZuI7or4G3PVp4gOXoMUGfeZ2 rvRsjPoI7PDGElnFr5c5IGih2I8pES2gAycvx7bk= 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 v4 5/6] crypto: qcom: Add support for prng-ee Date: Wed, 4 Jul 2018 17:14:26 +0530 Message-Id: <20180704114427.29953-6-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180704114427.29953-1-vkoul@kernel.org> References: <20180704114427.29953-1-vkoul@kernel.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c index 53e1d276e05e..f1bd86acaf9d 100644 --- a/drivers/crypto/qcom-rng.c +++ b/drivers/crypto/qcom-rng.c @@ -28,6 +28,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);