]>
Commit | Line | Data |
---|---|---|
abefd674 GBY |
1 | /* |
2 | * Copyright (C) 2012-2017 ARM Limited or its affiliates. | |
c8f17865 | 3 | * |
abefd674 GBY |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License version 2 as | |
6 | * published by the Free Software Foundation. | |
c8f17865 | 7 | * |
abefd674 GBY |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU General Public License for more details. | |
c8f17865 | 12 | * |
abefd674 GBY |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | |
15 | */ | |
16 | ||
17 | ||
18 | #include "ssi_config.h" | |
19 | #include <linux/kernel.h> | |
20 | #include <linux/platform_device.h> | |
21 | #include <linux/interrupt.h> | |
22 | #include <crypto/ctr.h> | |
23 | #include <linux/pm_runtime.h> | |
24 | #include "ssi_driver.h" | |
25 | #include "ssi_sram_mgr.h" | |
26 | #include "ssi_pm_ext.h" | |
27 | ||
28 | /* | |
ff7c2e41 DR |
29 | * This function should suspend the HW (if possiable), It should be implemented by |
30 | * the driver user. | |
31 | * The reference code clears the internal SRAM to imitate lose of state. | |
32 | */ | |
abefd674 GBY |
33 | void ssi_pm_ext_hw_suspend(struct device *dev) |
34 | { | |
35 | struct ssi_drvdata *drvdata = | |
36 | (struct ssi_drvdata *)dev_get_drvdata(dev); | |
37 | unsigned int val; | |
38 | void __iomem *cc_base = drvdata->cc_base; | |
39 | unsigned int sram_addr = 0; | |
40 | ||
41 | CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, SRAM_ADDR), sram_addr); | |
42 | ||
43 | for (;sram_addr < SSI_CC_SRAM_SIZE ; sram_addr+=4) { | |
44 | CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, SRAM_DATA), 0x0); | |
45 | ||
46 | do { | |
47 | val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, SRAM_DATA_READY)); | |
48 | } while (!(val &0x1)); | |
49 | } | |
50 | } | |
51 | ||
52 | /* | |
ff7c2e41 DR |
53 | * This function should resume the HW (if possiable).It should be implemented by |
54 | * the driver user. | |
55 | */ | |
abefd674 GBY |
56 | void ssi_pm_ext_hw_resume(struct device *dev) |
57 | { | |
58 | return; | |
59 | } | |
60 |