From patchwork Mon Jul 16 05:50:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141973 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2013228ljj; Sun, 15 Jul 2018 22:51:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePm+Run4BROfCvXgVNk+yGkaSnY7Xk3Z2M59dAqsuzbdoY0Odm1RxEkiW4sYy0rhP6JcmY X-Received: by 2002:a17:902:82c7:: with SMTP id u7-v6mr15358639plz.83.1531720287731; Sun, 15 Jul 2018 22:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531720287; cv=none; d=google.com; s=arc-20160816; b=nmIMqouFfXW1m319hd9/7iofGyVbDCD0Wp8Uw8WVwcNSOq4WPgXMNnwZkQ2Dev9NQc eQaVWRCNI7RP9wVRD7k2XX07rPPEpl4Oyez7Y/A/8fQtRiZlpTJWYD5iJRBvrNH7HpSJ JDe+eywfoOLZ1eeM2d1U9TiiLxYASNf52dfDXuWBBEhpvwIv89AG1dT8pOMrQdoaby6N NLASjpA94nvTm/rDkGO5vCBuAi+qMSNbr/RSJ7vbCSzpw3DgL+CWQCXKWPpgMA309ZOn aZOdFxAFvS85zYx1sSeAEb4+ojgiyrhR/nXyxrwC/vSu63HAdMkbmfatLhB4H47aWg5S 6X9Q== 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=HrnfW+X+ddbcVcrKikUnUyWZjT4DcbSHTFDpxO+pYZ8=; b=bdCImLEQHRvfHjBW/QPU0ISd2qljFYRnZVrA8Q6A/WA1ehUZiRofpzFw3pOpzCvupV t8FSSItvCJOFTOC5zzHuKlTNhYNDL49IcfVvGmL/ShNnUKuOuwGKL3LqYu3yM1dSVRoz LWorKQ2lngCiaXGViKftfiaiPY33UZVsAKZRPFU6ALKKzIoQBh0n4nGtTMPHe7xJXKRD cDfKmPB/Yh/wL9Rd+5cle12tt/N7EAUrO9EAJmDHfBXp850lV7FCjPhUV8CKOWpjUrch 4ZAsmQ6poSQdbe9BBlfDLSy3wKEHoPUPKLTjT8ZtgJzkDP1ri+wmJiyM0q0zLOvcfw8y tzmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wysWJdlW; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 a20-v6si6589657pls.237.2018.07.15.22.51.27; Sun, 15 Jul 2018 22:51:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=wysWJdlW; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S1727620AbeGPGRH (ORCPT + 1 other); Mon, 16 Jul 2018 02:17:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:37232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726811AbeGPGRH (ORCPT ); Mon, 16 Jul 2018 02:17:07 -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 893452086E; Mon, 16 Jul 2018 05:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531720285; bh=a0oCxzbLOLjauSDG5VT9Xqo7iareLoHIOesk54QZWgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wysWJdlWyo9b/U7mhIu3jbQrE47m+qfjEq3dnj2pH323XmLoKd0yx4UiGwOB3iseb VE9Nbs2Pz62Nn0w6R7TJ6Ggp6AAnXKvhhPFQsceQT1YqPFO7IUCN39Sl7UOU8kRgcg 1QXYEp9/ovRdw1NF3heWNUzj3ibpByhyS1Kn6L8M= 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 6/6] crypto: qcom: Add ACPI support Date: Mon, 16 Jul 2018 11:20:27 +0530 Message-Id: <20180716055027.3048-7-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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Timur Tabi Add support for probing on ACPI systems, with ACPI HID QCOM8160. On ACPI systems, clocks are always enabled, the PRNG should already be enabled, and the register region is read-only. The driver only verifies that the hardware is already enabled never tries to disable or configure it. Signed-off-by: Timur Tabi Tested-by: Jeffrey Hugo [port to crypto API] Signed-off-by: Vinod Koul --- drivers/crypto/qcom-rng.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) -- 2.14.4 diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c index 80544326e310..e54249ccc009 100644 --- a/drivers/crypto/qcom-rng.c +++ b/drivers/crypto/qcom-rng.c @@ -4,6 +4,7 @@ // Based on msm-rng.c and downstream driver #include +#include #include #include #include @@ -168,9 +169,13 @@ static int qcom_rng_probe(struct platform_device *pdev) if (IS_ERR(rng->base)) return PTR_ERR(rng->base); - rng->clk = devm_clk_get(&pdev->dev, "core"); - if (IS_ERR(rng->clk)) - return PTR_ERR(rng->clk); + /* ACPI systems have clk already on, so skip clk_get */ + if (!has_acpi_companion(&pdev->dev)) { + rng->clk = devm_clk_get(&pdev->dev, "core"); + if (IS_ERR(rng->clk)) + return PTR_ERR(rng->clk); + } + rng->skip_init = (unsigned long)device_get_match_data(&pdev->dev); @@ -193,6 +198,14 @@ static int qcom_rng_remove(struct platform_device *pdev) return 0; } +#if IS_ENABLED(CONFIG_ACPI) +static const struct acpi_device_id qcom_rng_acpi_match[] = { + { .id = "QCOM8160", .driver_data = 1 }, + {} +}; +MODULE_DEVICE_TABLE(acpi, qcom_rng_acpi_match); +#endif + static const struct of_device_id qcom_rng_of_match[] = { { .compatible = "qcom,prng", .data = (void *)0}, { .compatible = "qcom,prng-ee", .data = (void *)1}, @@ -206,6 +219,7 @@ static struct platform_driver qcom_rng_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = of_match_ptr(qcom_rng_of_match), + .acpi_match_table = ACPI_PTR(qcom_rng_acpi_match), } }; module_platform_driver(qcom_rng_driver);