diff options
author | Steven Miao <realmz6@gmail.com> | 2012-05-16 06:26:10 -0400 |
---|---|---|
committer | Bob Liu <lliubbo@gmail.com> | 2012-05-21 02:54:24 -0400 |
commit | 93f89519fd31c21e5d606faf4091f5905db38412 (patch) | |
tree | 642d8605e14281e8f69a54e2130a7898754289ba /arch/blackfin/mach-common/pm.c | |
parent | b2cfc653a513f347114c85ed8e75456ea0159c18 (diff) |
blackfin: bf60x: add power management support
Add bf60x cpu pm callbacks and change blackfin pm framework to support bf60x.
Signed-off-by: Steven Miao <realmz6@gmail.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Diffstat (limited to 'arch/blackfin/mach-common/pm.c')
-rw-r--r-- | arch/blackfin/mach-common/pm.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c index 3c648a077e75..c25c2f1c819c 100644 --- a/arch/blackfin/mach-common/pm.c +++ b/arch/blackfin/mach-common/pm.c | |||
@@ -19,20 +19,33 @@ | |||
19 | #include <asm/gpio.h> | 19 | #include <asm/gpio.h> |
20 | #include <asm/dma.h> | 20 | #include <asm/dma.h> |
21 | #include <asm/dpmc.h> | 21 | #include <asm/dpmc.h> |
22 | #include <asm/pm.h> | ||
22 | 23 | ||
24 | #ifdef CONFIG_BF60x | ||
25 | struct bfin_cpu_pm_fns *bfin_cpu_pm; | ||
26 | #endif | ||
23 | 27 | ||
24 | void bfin_pm_suspend_standby_enter(void) | 28 | void bfin_pm_suspend_standby_enter(void) |
25 | { | 29 | { |
30 | #ifndef CONFIG_BF60x | ||
26 | bfin_pm_standby_setup(); | 31 | bfin_pm_standby_setup(); |
32 | #endif | ||
27 | 33 | ||
28 | #ifdef CONFIG_PM_BFIN_SLEEP_DEEPER | 34 | #ifdef CONFIG_BF60x |
29 | sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); | 35 | bfin_cpu_pm->enter(PM_SUSPEND_STANDBY); |
30 | #else | 36 | #else |
37 | # ifdef CONFIG_PM_BFIN_SLEEP_DEEPER | ||
38 | sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); | ||
39 | # else | ||
31 | sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); | 40 | sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); |
41 | # endif | ||
32 | #endif | 42 | #endif |
33 | 43 | ||
44 | #ifndef CONFIG_BF60x | ||
34 | bfin_pm_standby_restore(); | 45 | bfin_pm_standby_restore(); |
46 | #endif | ||
35 | 47 | ||
48 | #ifndef CONFIG_BF60x | ||
36 | #ifdef SIC_IWR0 | 49 | #ifdef SIC_IWR0 |
37 | bfin_write_SIC_IWR0(IWR_DISABLE_ALL); | 50 | bfin_write_SIC_IWR0(IWR_DISABLE_ALL); |
38 | # ifdef SIC_IWR1 | 51 | # ifdef SIC_IWR1 |
@@ -52,6 +65,8 @@ void bfin_pm_suspend_standby_enter(void) | |||
52 | #else | 65 | #else |
53 | bfin_write_SIC_IWR(IWR_DISABLE_ALL); | 66 | bfin_write_SIC_IWR(IWR_DISABLE_ALL); |
54 | #endif | 67 | #endif |
68 | |||
69 | #endif | ||
55 | } | 70 | } |
56 | 71 | ||
57 | int bf53x_suspend_l1_mem(unsigned char *memptr) | 72 | int bf53x_suspend_l1_mem(unsigned char *memptr) |
@@ -83,10 +98,13 @@ int bf53x_resume_l1_mem(unsigned char *memptr) | |||
83 | } | 98 | } |
84 | 99 | ||
85 | #if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK) | 100 | #if defined(CONFIG_BFIN_EXTMEM_WRITEBACK) || defined(CONFIG_BFIN_L2_WRITEBACK) |
101 | # ifdef CONFIG_BF60x | ||
102 | __attribute__((l1_text)) | ||
103 | # endif | ||
86 | static void flushinv_all_dcache(void) | 104 | static void flushinv_all_dcache(void) |
87 | { | 105 | { |
88 | u32 way, bank, subbank, set; | 106 | register u32 way, bank, subbank, set; |
89 | u32 status, addr; | 107 | register u32 status, addr; |
90 | u32 dmem_ctl = bfin_read_DMEM_CONTROL(); | 108 | u32 dmem_ctl = bfin_read_DMEM_CONTROL(); |
91 | 109 | ||
92 | for (bank = 0; bank < 2; ++bank) { | 110 | for (bank = 0; bank < 2; ++bank) { |
@@ -133,7 +151,11 @@ int bfin_pm_suspend_mem_enter(void) | |||
133 | return -ENOMEM; | 151 | return -ENOMEM; |
134 | } | 152 | } |
135 | 153 | ||
154 | #ifndef CONFIG_BF60x | ||
136 | wakeup = bfin_read_VR_CTL() & ~FREQ; | 155 | wakeup = bfin_read_VR_CTL() & ~FREQ; |
156 | #else | ||
157 | |||
158 | #endif | ||
137 | wakeup |= SCKELOW; | 159 | wakeup |= SCKELOW; |
138 | 160 | ||
139 | #ifdef CONFIG_PM_BFIN_WAKE_PH6 | 161 | #ifdef CONFIG_PM_BFIN_WAKE_PH6 |
@@ -159,7 +181,11 @@ int bfin_pm_suspend_mem_enter(void) | |||
159 | _disable_icplb(); | 181 | _disable_icplb(); |
160 | bf53x_suspend_l1_mem(memptr); | 182 | bf53x_suspend_l1_mem(memptr); |
161 | 183 | ||
184 | #ifndef CONFIG_BF60x | ||
162 | do_hibernate(wakeup | vr_wakeup); /* See you later! */ | 185 | do_hibernate(wakeup | vr_wakeup); /* See you later! */ |
186 | #else | ||
187 | bfin_cpu_pm->enter(PM_SUSPEND_MEM); | ||
188 | #endif | ||
163 | 189 | ||
164 | bf53x_resume_l1_mem(memptr); | 190 | bf53x_resume_l1_mem(memptr); |
165 | 191 | ||