1
0
mirror of https://git.yoctoproject.org/meta-ti synced 2026-07-16 22:38:04 +00:00
Files
meta-ti/recipes-kernel/linux/linux-am335x-psp-3.2/0010-hwrng-omap4-rng-Convert-to-use-pm_runtime-API.patch
Franklin S. Cooper Jr 6efc27aedc linux-am335x: Update to latest 3.2 kernel release
* Update to the latest PSP release (version 04.06.00.10) of the 3.2 kernel.
* Rename recipe to match meta-ti kernel recipe naming convention.
* Use in tree defconfig instead of providing a separate defconfig. These
  defconfigs were the same anyway.
* Add additional crypto patches that were needed to fix suspend and resume
  issues.

Signed-off-by: Franklin S. Cooper Jr <fcooper@ti.com>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
2013-04-22 16:20:27 -04:00

92 lines
2.5 KiB
Diff

From 1b4d57c404a14b263b39e251e0bc5dc76fc95932 Mon Sep 17 00:00:00 2001
From: "Mark A. Greer" <mgreer@animalcreek.com>
Date: Wed, 12 Dec 2012 20:13:49 -0700
Subject: [PATCH 10/10] hwrng: omap4-rng: Convert to use pm_runtime API
Convert the omap4-rng driver to use the pm_runtime
API instead of the clk API.
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
---
drivers/char/hw_random/omap4-rng.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/char/hw_random/omap4-rng.c b/drivers/char/hw_random/omap4-rng.c
index 523ec63..98c96c1 100644
--- a/drivers/char/hw_random/omap4-rng.c
+++ b/drivers/char/hw_random/omap4-rng.c
@@ -23,7 +23,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/random.h>
-#include <linux/clk.h>
+#include <linux/pm_runtime.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/hw_random.h>
@@ -111,7 +111,6 @@
static void __iomem *rng_base;
-static struct clk *rng_fck;
static struct platform_device *rng_dev;
#define trng_read(reg) \
@@ -172,13 +171,8 @@ static int __devinit omap4_rng_probe(struct platform_device *pdev)
if (rng_dev)
return -EBUSY;
- rng_fck = clk_get(&pdev->dev, "rng_fck");
- if (IS_ERR(rng_fck)) {
- dev_err(&pdev->dev, "Could not get rng_fck\n");
- ret = PTR_ERR(rng_fck);
- return ret;
- } else
- clk_enable(rng_fck);
+ pm_runtime_enable(&pdev->dev);
+ pm_runtime_get_sync(&pdev->dev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -223,8 +217,8 @@ err_register:
err_ioremap:
release_mem_region(res->start, resource_size(res));
err_region:
- clk_disable(rng_fck);
- clk_put(rng_fck);
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
return ret;
}
@@ -238,8 +232,8 @@ static int __exit omap4_rng_remove(struct platform_device *pdev)
iounmap(rng_base);
- clk_disable(rng_fck);
- clk_put(rng_fck);
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
release_mem_region(res->start, resource_size(res));
rng_base = NULL;
@@ -252,11 +246,15 @@ static int omap4_rng_suspend(struct platform_device *pdev, pm_message_t message)
{
trng_write(trng_read(CONTROL) & ~RNG_REG_CONTROL_ENABLE_TRNG, CONTROL);
+ pm_runtime_put_sync(&pdev->dev);
+
return 0;
}
static int omap4_rng_resume(struct platform_device *pdev)
{
+ pm_runtime_get_sync(&pdev->dev);
+
trng_write(trng_read(CONTROL) | RNG_REG_CONTROL_ENABLE_TRNG, CONTROL);
return 0;
--
1.7.12