mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
hwrng: iproc-rng200 - Implement suspend and resume calls
[ Upstream commit8e03dd62e5] Chips such as BCM7278 support system wide suspend/resume which will cause the HWRNG block to lose its state and reset to its power on reset register values. We need to cleanup and re-initialize the HWRNG for it to be functional coming out of a system suspend cycle. Fixes:c3577f6100("hwrng: iproc-rng200 - Add support for BCM7278") Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
49729fc472
commit
97ccf9f195
@@ -195,6 +195,8 @@ static int iproc_rng200_probe(struct platform_device *pdev)
|
|||||||
return PTR_ERR(priv->base);
|
return PTR_ERR(priv->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev_set_drvdata(dev, priv);
|
||||||
|
|
||||||
priv->rng.name = "iproc-rng200";
|
priv->rng.name = "iproc-rng200";
|
||||||
priv->rng.read = iproc_rng200_read;
|
priv->rng.read = iproc_rng200_read;
|
||||||
priv->rng.init = iproc_rng200_init;
|
priv->rng.init = iproc_rng200_init;
|
||||||
@@ -212,6 +214,28 @@ static int iproc_rng200_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __maybe_unused iproc_rng200_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
struct iproc_rng200_dev *priv = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
iproc_rng200_cleanup(&priv->rng);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __maybe_unused iproc_rng200_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
struct iproc_rng200_dev *priv = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
iproc_rng200_init(&priv->rng);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct dev_pm_ops iproc_rng200_pm_ops = {
|
||||||
|
SET_SYSTEM_SLEEP_PM_OPS(iproc_rng200_suspend, iproc_rng200_resume)
|
||||||
|
};
|
||||||
|
|
||||||
static const struct of_device_id iproc_rng200_of_match[] = {
|
static const struct of_device_id iproc_rng200_of_match[] = {
|
||||||
{ .compatible = "brcm,bcm2711-rng200", },
|
{ .compatible = "brcm,bcm2711-rng200", },
|
||||||
{ .compatible = "brcm,bcm7211-rng200", },
|
{ .compatible = "brcm,bcm7211-rng200", },
|
||||||
@@ -225,6 +249,7 @@ static struct platform_driver iproc_rng200_driver = {
|
|||||||
.driver = {
|
.driver = {
|
||||||
.name = "iproc-rng200",
|
.name = "iproc-rng200",
|
||||||
.of_match_table = iproc_rng200_of_match,
|
.of_match_table = iproc_rng200_of_match,
|
||||||
|
.pm = &iproc_rng200_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = iproc_rng200_probe,
|
.probe = iproc_rng200_probe,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user