2018-04-23 15:04:24

by Lionel Debieve

[permalink] [raw]
Subject: [PATCH 0/2] Fix stm32-rng for default state and suspend

This series are fixing the default build state for stm32-rng that
activate the driver with arm multi_v7_defconfig.
Second patch is fixing the power suspend/resume behavior which was
not working.

Lionel Debieve (2):
hwrng: stm32 - define default state for rng driver
hwrng: stm32-rng: Fix pm_suspend issue

drivers/char/hw_random/Kconfig | 1 +
drivers/char/hw_random/stm32-rng.c | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)

--
2.15.1


2018-04-23 15:04:25

by Lionel Debieve

[permalink] [raw]
Subject: [PATCH 1/2] hwrng: stm32 - define default state for rng driver

Define default state for stm32_rng driver. It will
be default selected with multi_v7_defconfig

Signed-off-by: Lionel Debieve <[email protected]>
---
drivers/char/hw_random/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index d53541e96bee..c34b257d852d 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -347,6 +347,7 @@ config HW_RANDOM_STM32
tristate "STMicroelectronics STM32 random number generator"
depends on HW_RANDOM && (ARCH_STM32 || COMPILE_TEST)
depends on HAS_IOMEM
+ default HW_RANDOM
help
This driver provides kernel-side support for the Random Number
Generator hardware found on STM32 microcontrollers.
--
2.15.1

2018-04-23 15:04:26

by Lionel Debieve

[permalink] [raw]
Subject: [PATCH 2/2] hwrng: stm32-rng - fix pm_suspend issue

When suspend is called after pm_runtime_suspend,
same callback is used and access to rng register is
freezing system. By calling the pm_runtime_force_suspend,
it first checks that runtime has been already done.

Signed-off-by: Lionel Debieve <[email protected]>
---
drivers/char/hw_random/stm32-rng.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c
index 0d2328da3b76..042860d97b15 100644
--- a/drivers/char/hw_random/stm32-rng.c
+++ b/drivers/char/hw_random/stm32-rng.c
@@ -187,8 +187,13 @@ static int stm32_rng_runtime_resume(struct device *dev)
}
#endif

-static UNIVERSAL_DEV_PM_OPS(stm32_rng_pm_ops, stm32_rng_runtime_suspend,
- stm32_rng_runtime_resume, NULL);
+static const struct dev_pm_ops stm32_rng_pm_ops = {
+ SET_RUNTIME_PM_OPS(stm32_rng_runtime_suspend,
+ stm32_rng_runtime_resume, NULL)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+ pm_runtime_force_resume)
+};
+

static const struct of_device_id stm32_rng_match[] = {
{
--
2.15.1

2018-05-05 07:16:51

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 0/2] Fix stm32-rng for default state and suspend

On Mon, Apr 23, 2018 at 05:04:24PM +0200, Lionel Debieve wrote:
> This series are fixing the default build state for stm32-rng that
> activate the driver with arm multi_v7_defconfig.
> Second patch is fixing the power suspend/resume behavior which was
> not working.
>
> Lionel Debieve (2):
> hwrng: stm32 - define default state for rng driver
> hwrng: stm32-rng: Fix pm_suspend issue
>
> drivers/char/hw_random/Kconfig | 1 +
> drivers/char/hw_random/stm32-rng.c | 9 +++++++--
> 2 files changed, 8 insertions(+), 2 deletions(-)

All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt