Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp711868imm; Wed, 4 Jul 2018 04:46:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIh4l0z33zOru0ot5XnPFawdQWavCLfYEu+jUT3nritIFAOeXbB8Xp/9Y04g5gC60hiA9e X-Received: by 2002:a63:5c10:: with SMTP id q16-v6mr1616289pgb.452.1530704808589; Wed, 04 Jul 2018 04:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530704808; cv=none; d=google.com; s=arc-20160816; b=ROVPBAe+epBBtU8Jz6jqb+5TauwoA3XVWp177kKDNTR31Cq2Chky8TGYB8VNmmsamY /yesi2FpveXrDWvukyukMDLcJ9zsB6aMVFR1P9INb06KjkiWn8BA9xnvem+kaUATZ1Qt PrSBbSdAF5Fn/DDnPSCS+zLwFMqhWzMexra6vti+zQVtTTYWcjFnJ1yfgi+YpHxlt7TD fxDaD4MutOzmn1N7LWNZvgJy79DGlXRFpQSMrV/VbWdztLNMzdVBuFkuPWjaNo9+ZBQK mgSMgYstfxRUEz53J/RmXDVh+NXrI3wvCK5zvtNALTMpliFlgSqcySSCOxbO13aZLw2z vYEA== 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=3KqnO8rpTfVrINT6l0ln8Rte/Ac953+ViGyrU+sErfM=; b=Vfs+hwhARjfXZk+fjs884iyLjNugk6NUAw6jgasom/Tyru11HEV5HCdfOYU+vhnxVk EbWRcyqh9Xq5+8lcHCNIIJab6YFjwAl/9DTQxLLa+6FQlvAaoBrADF4xXxnbmYeyUWbU n9HuIW9+lSUCThDIOqLhPwis98OlmrXjCkfVqoEQY982wioXyE2Qa0dXmbsUtgEIVQft TbhDTcnY83So6dwgQJqMBku99/nzsTg89kr57KajBAjO61rMUUmuminFQWHpAJYzuHF9 ouELGgatdYamvzaaDVO1QC0k2ekbW9Id6gU2Fg/zVjsjY6gc4jj9vZ63o4V5of9i29qf 5b7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FGYXnl2u; 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 e7-v6si3481052plt.325.2018.07.04.04.46.34; Wed, 04 Jul 2018 04:46:48 -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=FGYXnl2u; 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 S934481AbeGDLpZ (ORCPT + 99 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-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 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); -- 2.14.4