layerscape: add patches-5.4
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 804-crypto-0023-MLK-10036-crypto-caam-add-support-for-DSM-with-Mega-.patch
1 From 1ffdfbcd42dbb87f2841e45c0719a3fbcb2fe926 Mon Sep 17 00:00:00 2001
2 From: Victoria Milhoan <vicki.milhoan@freescale.com>
3 Date: Thu, 18 Dec 2014 14:06:50 -0700
4 Subject: [PATCH] MLK-10036 crypto: caam - add support for DSM with Mega/Fast
5 mix on
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This patch allows CAAM to be enabled as a wakeup source for the
11 Mega/Fast mix domain. If CAAM is enabled as a wakeup source, it
12 will continue to be powered on across Deep Sleep Mode (DSM). This
13 allows CAAM to be functional after the system resumes from DSM.
14
15 Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com>
16 (cherry picked from commit 290744e3b40a563319324e234fa5a65b49fd4d82)
17 Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
18 Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
19 (cherry picked from commit 0bf9c6f84f1d74d9e6d9384c4b11bbdf9301c94e)
20
21 Changed commit headline prefix.
22
23 Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
24 ---
25 drivers/crypto/caam/jr.c | 33 +++++++++++++++++++++++++++++++++
26 1 file changed, 33 insertions(+)
27
28 --- a/drivers/crypto/caam/jr.c
29 +++ b/drivers/crypto/caam/jr.c
30 @@ -561,11 +561,41 @@ static int caam_jr_probe(struct platform
31
32 atomic_set(&jrpriv->tfm_count, 0);
33
34 + device_init_wakeup(&pdev->dev, 1);
35 + device_set_wakeup_enable(&pdev->dev, false);
36 +
37 register_algs(jrdev->parent);
38
39 return 0;
40 }
41
42 +#ifdef CONFIG_PM
43 +static int caam_jr_suspend(struct device *dev)
44 +{
45 + struct platform_device *pdev = to_platform_device(dev);
46 + struct caam_drv_private_jr *jrpriv = platform_get_drvdata(pdev);
47 +
48 + if (device_may_wakeup(&pdev->dev))
49 + enable_irq_wake(jrpriv->irq);
50 +
51 + return 0;
52 +}
53 +
54 +static int caam_jr_resume(struct device *dev)
55 +{
56 + struct platform_device *pdev = to_platform_device(dev);
57 + struct caam_drv_private_jr *jrpriv = platform_get_drvdata(pdev);
58 +
59 + if (device_may_wakeup(&pdev->dev))
60 + disable_irq_wake(jrpriv->irq);
61 +
62 + return 0;
63 +}
64 +
65 +static SIMPLE_DEV_PM_OPS(caam_jr_pm_ops, caam_jr_suspend,
66 + caam_jr_resume);
67 +#endif
68 +
69 static const struct of_device_id caam_jr_match[] = {
70 {
71 .compatible = "fsl,sec-v4.0-job-ring",
72 @@ -581,6 +611,9 @@ static struct platform_driver caam_jr_dr
73 .driver = {
74 .name = "caam_jr",
75 .of_match_table = caam_jr_match,
76 +#ifdef CONFIG_PM
77 + .pm = &caam_jr_pm_ops,
78 +#endif
79 },
80 .probe = caam_jr_probe,
81 .remove = caam_jr_remove,