From patchwork Mon Jul 9 06:19:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141543 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2284682ljj; Sun, 8 Jul 2018 23:20:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfqLLK+9zWbZY4iA/Y5AEqDq73lanoQJcxMzqwBeqz2n/5EBPMpVUyEie7OhSH4mocgp+ux X-Received: by 2002:a63:1b17:: with SMTP id b23-v6mr17874763pgb.275.1531117229777; Sun, 08 Jul 2018 23:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531117229; cv=none; d=google.com; s=arc-20160816; b=yPOEDhDQyXNEPSNShOTCeRgqSk0jtiPkRxQ2BkafwPEf5/kE4vb4nPCUboj2JE6hHR JBtarTZozFNrLJcMIu8XoOrffWmphU2VQiCqkm9sRmsub9fc60WU2aYTP72a/RkWuhiH 8Qn4I360zB79FUke2RLkqr8T5kEL1HaDlCdPkA8PHyagOWpy5hmTcZB8kM6sKVK6XMbs gbKisCsaHienLwBuVtjnwgZFfERDmxRQ/GLG20q0sVswQ0YIZPlwi8yfOG+Jj9sPQwPu R+3NVeTC6OZAJBesT2XrdGgPWZ1frZy2B3EBAVZgF1Gsmhhkjnl/LLrFN+dDrS7kzfMS Uk0g== 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=IZpPT5oPZSxkYzrWCSwCrootpm33EPcvkrN65smU6ea4vrsSgMJafVIpaB4NwJy8F5 HcS4LLzNPSptSDlb57PWSljSlb/revlY/hLLFD3GfsuF9MfQv1yDavLNntL8yAib6ghi gEmcHlQLsDbsPX3V/VjRcMRuLA4J3Ikw39up7EqShwao0scUTMplFwZPnblji3k/a/x7 qwXul/iPL4JLXxa1lIL+2aUF71zCFd99Di6y3rvHeCRkxmAGQucEE/yOEJSTxoHYlJqi KJQYGY2VXC4+fgItO7/eON3rXXncRiinRFes8Uq6DpHwoz9VRdicM6HCZlsAXMmOwae7 BpwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=default header.b=r+aSVRaf; 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 k20-v6si13108647pgb.115.2018.07.08.23.20.29; Sun, 08 Jul 2018 23:20:29 -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=r+aSVRaf; 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 S1754631AbeGIGU0 (ORCPT + 13 others); Mon, 9 Jul 2018 02:20:26 -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-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);