Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp777951imm; Mon, 2 Jul 2018 23:06:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcGYyPgKvZlc3QC3bU+cwCrZYKG8n0h2K7lQ942KzF6PIPCTBZkzZsjqAx9OGUvTXgPOAVO X-Received: by 2002:a65:4d05:: with SMTP id i5-v6mr19873608pgt.58.1530598003323; Mon, 02 Jul 2018 23:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530598003; cv=none; d=google.com; s=arc-20160816; b=Fizl1XSHNmB45Sg3adEaxJk7oDy495wRUpf/C1EwHIQdFt09yWZmJVs4kVowVVLzvs vAgOaAMDASbdtf/P0FCu4bJ/elwkiyMnIX7s3ijin1aF0IuSHkBJ/vAAVP2HO+Cy31O2 yVy3LYqTBhDjcUmV5DTbMTGV+LqBVjL9ebGX7uY65eGC717ttIj6q9+IpTL+R96Q5nT9 kbUT4ygRQcRI7ngC4NikG1Jl2dCoZYriS6R/iLuhBgiPNbL3Qg5wzb4uTFgJDM07DzeG LruhvtC6vYjabZazOsumIb3eO0WYVY5zpCm9Hp+t0VUefVLRrMd5Xte3nRaPprqV69B4 aFNQ== 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 l189-v6si361071pfc.356.2018.07.02.23.06.28; Mon, 02 Jul 2018 23:06:43 -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 S932790AbeGCGF2 (ORCPT + 99 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(-) 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); -- 2.14.4