Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp195618imm; Sun, 8 Jul 2018 23:22:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd20kv7SbqqjgJ5BFr4OnqCvDjL/umea3xKtAIOoESTBuFR6ENoF+rkfgrCy51gCz0WyKhq X-Received: by 2002:a62:3e1a:: with SMTP id l26-v6mr20055029pfa.214.1531117367551; Sun, 08 Jul 2018 23:22:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531117367; cv=none; d=google.com; s=arc-20160816; b=VCSbt16aHWleINf9KirZwoywxUtg0hXfrDCeTBdpra9W4mO4w2YTYrVU8RaK6g1H6G Xzpew3KJd09BtRu4yx1pljkaBKMHTQPyn44Ed/Sy3Tr2yneiiGs9YFbeRWS3G0YIoglA jpOp7Alqa/D5D78oIhAKXBSXSkKRKos7WJkeJhi4+Hycs+iTWoYoyrhGaB655bjOJLUl qzfPKx0jcz/9IPqKZey/dPInI65XEGrHXCoY3aGpcg2gJlWeLwag+12Rxo+h/KC3VgJ1 o9Q7uoMalO2VN14/W8PdOxOXnfkzG7lHc75jQk5CJpYlZJCnt8VOxepD8N/8Px5AvUeS YNUw== 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=DAglOgRLBxabHpdkY+ZFrnh4Wd1Nwg6YZBf4qdpAYymQylLViRyfAGnlF4JhPjXs6Q F9Xa3CQ6nhrKIn6cJA5QzHjoZ6mHxy8hVDsqg68A4frSM92sWeztRdNXR2gekTADxrRU QSFBjZl2zXIRq2rLo4payiWXy9JGwGar7tQ4ARCs0tR1xWOaTFoo8iQeDk1+7gr78ooe /ffhS12dG5fNDojFZGrtVK4Oeo6aUyIWvCsqmLf+LHBdpgs5CzO19btcpcCKpbK6uA0V EVXrVrisDxtmM9bXzGgnfPJCCxs5VhdOLDENNNh5Ew968vTJlcO85pIYZ1neraiSHz7C xMPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r+aSVRaf; 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 33-v6si13883548plg.260.2018.07.08.23.22.33; Sun, 08 Jul 2018 23:22:47 -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=r+aSVRaf; 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 S1754645AbeGIGU2 (ORCPT + 99 others); Mon, 9 Jul 2018 02:20:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:45530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754627AbeGIGUV (ORCPT ); Mon, 9 Jul 2018 02:20:21 -0400 Received: from localhost.localdomain (unknown [106.201.46.178]) (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 2761E208E1; Mon, 9 Jul 2018 06:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531117221; bh=9F2j0qU4EuKw6U0ANvByv1DweXfo29Cp44sdPkaPidg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+aSVRafL1foLthjb68y309NmYBjuAPT4pKvHbyapCkJZc5W3em8lJ4//eCuOlKn9 IU2kU8NkPHNLnTMqh5AcFGGufiec3+zDCsnGmzmGy8Qxds+GXmND8RyPLLFLEuw6ed 5tF5ZiWIFJ0ofhNLsSQzNCnXJXalsedssQX7Iyp4= From: Vinod Koul To: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bjorn Andersson , Matt Mackall , Herbert Xu , Arnd Bergmann , linux-arm-msm@vger.kernel.org, Stephen Boyd , Timur Tabi , Jeffrey Hugo , Vinod Koul Subject: [PATCH v5 5/6] crypto: qcom: Add support for prng-ee Date: Mon, 9 Jul 2018 11:49:24 +0530 Message-Id: <20180709061925.20276-6-vkoul@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180709061925.20276-1-vkoul@kernel.org> References: <20180709061925.20276-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