From patchwork Mon Jul 9 06:19:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 141541 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2284723ljj; Sun, 8 Jul 2018 23:20:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcHut6IUdFjNtIUnXKHCuz1/TB9ABkxHNYOU7i5zF3FVbooH2U8y1+XqtbeFQrabMq+y+f9 X-Received: by 2002:a17:902:9a8a:: with SMTP id w10-v6mr19276252plp.333.1531117232333; Sun, 08 Jul 2018 23:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531117232; cv=none; d=google.com; s=arc-20160816; b=vIbje2wPStDFkrzK8J6cyTTkd4fwzDV1BeM7+3WyVtndobkusBg1FzVXa7jYav74Jq JVNb9JFjmhJhOB5FQcKJKF+sEdrfDbWycEVdYxcQcb00yWXNOohqPmJ7jRrCe16xDIfR loulXm9u7/uhrIWmCLIGbZPkZGMnz20YyuY6mki7iXEv9A6xtIhxVnd/3Gd2A/Kic2gQ l3RtwiJ3+VrqV6YxExQ7cYmiDFx+FVUxvVRrQq8d0QQVH31rL/NOgxF67kABBrinqYn8 5A1OZGO37ZsmSb7A4Tin8RM8yDTG+oV2qhDiI9DoCwAEIr35MVE6gnJqMg8DNpRPs7wN WA2Q== 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=5f9zNpPW89LVmdxUi5DTZ+CR6jDeHFlhJQPz2Xj83SY=; b=wR2AOiZvyWse62GMJFIJaVubFu4DhnIp0xvZHLZD7rmGjyOsUtcq3GrHhIoE6k3WAq O/Set4bPFu5d2l6VGbOKy3SBN54HEUjN9PXImMyik1+v+6cvmzuiNE0oSzcuQHrMbd6Z g9WNGsq6eqbiynRhUWkwLaYZYfYzIxoZDAgdgSu974vBQh9aweIxEdHdaRsoTi/W5RQt PE4+O/pj8HH0KJdt5XuNOf36OQs2sL9H8KHaODlEBnY90tELloocIe/hi8puNCOwwJtk czoigX3ylTHjo2CVvJXmqIQv+x8ZBGUjNR4qsnMN2VcZtuaY7o5t5r+zyKKSBq1hz77I FBkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uUGntY4J; 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 k20-v6si13108647pgb.115.2018.07.08.23.20.32; Sun, 08 Jul 2018 23:20:32 -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=uUGntY4J; 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 S1754693AbeGIGUb (ORCPT + 29 others); Mon, 9 Jul 2018 02:20:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:45616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750996AbeGIGUZ (ORCPT ); Mon, 9 Jul 2018 02:20:25 -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 D603D208A3; Mon, 9 Jul 2018 06:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531117224; bh=dZVwobq8XmsF4Lr32T/vrEXCLRzjLZZNHTsrNIIKwLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uUGntY4JrKS25p9EAmMiXYMQzEA9gD35sB5jBQ/O+1W37MCeV0OocFfNX09lRmLGJ S67xkW0EK1+q+zSOOXs+d04X7xhWyXnu9gPY1+Gc8IbKd6X7gU9NDDX60AXgkHeTXN ybeSQSwTC2FguoW3QgwD1a6Xb3N3rPy0I45caC1A= 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 6/6] crypto: qcom: Add ACPI support Date: Mon, 9 Jul 2018 11:49:25 +0530 Message-Id: <20180709061925.20276-7-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 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 [port to crypto API] Signed-off-by: Vinod Koul --- drivers/crypto/qcom-rng.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) -- 2.14.4 diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c index f1bd86acaf9d..8118d4cd93b2 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,13 +169,17 @@ 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); - rng->skip_init = (unsigned long)of_device_get_match_data(&pdev->dev); + /* 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); qcom_rng_dev = rng; + ret = crypto_register_rng(&qcom_rng_alg); if (ret) { dev_err(&pdev->dev, "Register crypto rng failed: %d\n", ret); @@ -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);