From: Vinod Koul <vkoul@kernel.org>
To: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
Matt Mackall <mpm@selenic.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Arnd Bergmann <arnd@arndb.de>,
linux-arm-msm@vger.kernel.org, Stephen Boyd <swboyd@chromium.org>,
Timur Tabi <timur@codeaurora.org>,
Jeffrey Hugo <jhugo@codeaurora.org>,
Vinod Koul <vkoul@kernel.org>
Subject: [PATCH v5 6/6] crypto: qcom: Add ACPI support
Date: Mon, 9 Jul 2018 11:49:25 +0530 [thread overview]
Message-ID: <20180709061925.20276-7-vkoul@kernel.org> (raw)
In-Reply-To: <20180709061925.20276-1-vkoul@kernel.org>
From: Timur Tabi <timur@codeaurora.org>
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 <timur@codeaurora.org>
[port to crypto API]
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
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 <crypto/internal/rng.h>
+#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/crypto.h>
#include <linux/module.h>
@@ -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
next prev parent reply other threads:[~2018-07-09 6:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-09 6:19 [PATCH v5 0/6] crypto: Add Qcom PRNG support Vinod Koul
2018-07-09 6:19 ` [PATCH v5 1/6] hwrng: remove msm hw_random driver Vinod Koul
2018-07-09 6:19 ` [PATCH v5 2/6] dt-bindings: crypto: Move prng binding to crypto Vinod Koul
2018-07-09 6:19 ` [PATCH v5 3/6] crypto: Add Qcom prng driver Vinod Koul
2018-07-14 10:16 ` Linus Walleij
2018-07-16 4:15 ` Vinod
2018-07-16 5:29 ` Vinod
2018-07-09 6:19 ` [PATCH v5 4/6] dt-bindings: crypto: Add new compatible qcom,prng-ee Vinod Koul
2018-07-09 6:19 ` [PATCH v5 5/6] crypto: qcom: Add support for prng-ee Vinod Koul
2018-07-09 6:19 ` Vinod Koul [this message]
2018-07-10 17:27 ` [PATCH v5 6/6] crypto: qcom: Add ACPI support Jeffrey Hugo
2018-07-10 23:37 ` Timur Tabi
2018-07-11 4:09 ` Vinod
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180709061925.20276-7-vkoul@kernel.org \
--to=vkoul@kernel.org \
--cc=arnd@arndb.de \
--cc=bjorn.andersson@linaro.org \
--cc=herbert@gondor.apana.org.au \
--cc=jhugo@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=swboyd@chromium.org \
--cc=timur@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).