Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp195077imm; Sun, 8 Jul 2018 23:21:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd97+DN3iCT1gGXmsyOBakKQM2WANfrJiF4xsu9KgwLXeQxAFa3yiW4SxrkxUw3wnnRL21V X-Received: by 2002:a65:55c6:: with SMTP id k6-v6mr17549199pgs.6.1531117318313; Sun, 08 Jul 2018 23:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531117318; cv=none; d=google.com; s=arc-20160816; b=O+WPqwmCeppXLDyr4flBepBMs1H5teezhj321pcmnxRI89L8wzkVwXBXXq8KluaRxo dC6gfdOhRLlRQ4DBvN5QBI5KdGv+jYytyA9A6c4Sp2Zgu2Gbq+nNOJU13+WG4lxOvFRq aa1mgaP54zbRFXvtwW7+wQqZpSG6O3hFR3+i4hb7ZEfLFH1KwZ+ex/8CuHKk1StTe8fB uyl9Bvq17TipjAPG3xpn0zukRBTzPjeLATLC6MoGokMcF46Aksq3KdjUYRzTFhT6Gy2k zge3X0u1cFaZOtT7ywvCahgZz0igXE6Ko/fNTEhFRHjkdgi/utn8Sg4mVVIXyCwBEzka XT5Q== 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 b8-v6si13634963ple.469.2018.07.08.23.21.44; Sun, 08 Jul 2018 23:21:58 -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 S1754688AbeGIGUa (ORCPT + 99 others); Mon, 9 Jul 2018 02:20:30 -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(-) 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); -- 2.14.4