From patchwork Mon Jul 16 05:50: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: 141972 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2013186ljj; Sun, 15 Jul 2018 22:51:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpftMOz2YpqialAUhM+Onw+QGxGuHuUk9ErCvORFdvkBkFG/Dnbk9su6IhLTecwG7EPmltzd X-Received: by 2002:a62:1603:: with SMTP id 3-v6mr612119pfw.245.1531720284455; Sun, 15 Jul 2018 22:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531720284; cv=none; d=google.com; s=arc-20160816; b=qgAnjj78CKgzMz+l5WEzRgEXqJIcu4vgYSvkPgmXihB0k2yHVuL4SalSRkFVo3KoR9 Eau5Z6CN3XQR5r4EukduRCtfia6LplD4lIQqTPQoq3TzQ2vKBgPTlydr4BbThuNfsea7 xO8YiQe5B4uGajpfDybuLnxEF5CxZEwXBV5Hs+rgvdbTlAu8f8Wwkks/d4RNAQEk9NYP 8ok4qRM2b7OWHkuJ8qPCQ8nJWCc8mcGaXRXb/YJEbxWvx2uu7WawclunhRuS1np/3z/h nGFARS7Bbj6YMAsW1GGDgSK6dEYa6m3S5ZRTVRU4njd30KPaIhnNRBC5HVqLe1NCEnrB OutQ== 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=MfdC0goG16COzhpyCoxsPpOb4DMrB0oefmbFNAiUpNA=; b=ueFXRDhr8K2RLAvnb9EwdDP+aEcz2HDwllxHSnOHEV/bCDXhMeoxIRoUQHksUCkXQU TZJ8a3qjLJhH1x5N5nyync21xjOhZ9M6UHebwilsH5IsEdNIc1AdNHA7fkT5/nfh2xvi Qc7qfSePNkIC11sDdsr5HcxZm6W9zBynuxcOkssxYckUkdxF7YDlJWZ28vokkN1r5dyA Hxy9Nc+cqeiD2z3GpfB2OgTpKUB0vMSl7dRuixABluAeJyA+z2p00GBK7MEBpZyrcByR GnZarQVWqXARCk95FHpAdEcKVwqU/MHhbgFRsYR3se9h3PUiCCst9qC0Ytnus87xU0s4 Zz4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=VYns+j2t; 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 a20-v6si6589657pls.237.2018.07.15.22.51.24; Sun, 15 Jul 2018 22:51:24 -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=VYns+j2t; 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 S1727616AbeGPGRE (ORCPT + 13 others); Mon, 16 Jul 2018 02:17:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:37214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726811AbeGPGRE (ORCPT ); Mon, 16 Jul 2018 02:17:04 -0400 Received: from localhost.localdomain (unknown [122.178.242.94]) (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 B73DB208DB; Mon, 16 Jul 2018 05:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531720283; bh=OCd2g3/jbI7ACjQAqu6Un7n6IMFJQYto2K/y7juv+9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VYns+j2t2H/kI/mbBXK1JWJrrWEScajSRvmO8y7d3+52BbKvC/n1oY9Cw7gb42Nkr hxQC78MIw37HD//VM428s6G/jCNlbAr4lG3eeRhm4Fs4YuZDbpEPK7j0wiLBcpD0OS hMUc2eJPj1jOO3ggUZ0/o9NdtNVQGyO+6tmfWaYk= From: Vinod Koul To: linux-crypto@vger.kernel.org Cc: Bjorn Andersson , Matt Mackall , Herbert Xu , linux-arm-msm@vger.kernel.org, Stephen Boyd , Timur Tabi , Jeffrey Hugo , Vinod Koul Subject: [PATCH v6 5/6] crypto: qcom: Add support for prng-ee Date: Mon, 16 Jul 2018 11:20:26 +0530 Message-Id: <20180716055027.3048-6-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180716055027.3048-1-vkoul@kernel.org> References: <20180716055027.3048-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 e921382099d7..80544326e310 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)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);