提交 d96542ac 编写于 作者: T Timur Tabi 提交者: Herbert Xu

crypto: qcom-rng - Add ACPI support

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: NTimur Tabi <timur@codeaurora.org>
Tested-by: NJeffrey Hugo <jhugo@codeaurora.org>
[port to crypto API]
Signed-off-by: NVinod Koul <vkoul@kernel.org>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 ba3ab637
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// Based on msm-rng.c and downstream driver // Based on msm-rng.c and downstream driver
#include <crypto/internal/rng.h> #include <crypto/internal/rng.h>
#include <linux/acpi.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/crypto.h> #include <linux/crypto.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -168,9 +169,13 @@ static int qcom_rng_probe(struct platform_device *pdev) ...@@ -168,9 +169,13 @@ static int qcom_rng_probe(struct platform_device *pdev)
if (IS_ERR(rng->base)) if (IS_ERR(rng->base))
return PTR_ERR(rng->base); return PTR_ERR(rng->base);
rng->clk = devm_clk_get(&pdev->dev, "core"); /* ACPI systems have clk already on, so skip clk_get */
if (IS_ERR(rng->clk)) if (!has_acpi_companion(&pdev->dev)) {
return PTR_ERR(rng->clk); 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); rng->skip_init = (unsigned long)device_get_match_data(&pdev->dev);
...@@ -193,6 +198,14 @@ static int qcom_rng_remove(struct platform_device *pdev) ...@@ -193,6 +198,14 @@ static int qcom_rng_remove(struct platform_device *pdev)
return 0; 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[] = { static const struct of_device_id qcom_rng_of_match[] = {
{ .compatible = "qcom,prng", .data = (void *)0}, { .compatible = "qcom,prng", .data = (void *)0},
{ .compatible = "qcom,prng-ee", .data = (void *)1}, { .compatible = "qcom,prng-ee", .data = (void *)1},
...@@ -206,6 +219,7 @@ static struct platform_driver qcom_rng_driver = { ...@@ -206,6 +219,7 @@ static struct platform_driver qcom_rng_driver = {
.driver = { .driver = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.of_match_table = of_match_ptr(qcom_rng_of_match), .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); module_platform_driver(qcom_rng_driver);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册