diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2008-07-19 04:57:32 -0400 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-07-19 04:57:32 -0400 |
commit | 1efc80b53eb54770139219f99657abd92595fc86 (patch) | |
tree | 254c76b3aaf22110b116e67a8118945006cacce6 /include | |
parent | 4f13f548cef5af1717cbbc341a1a3474f3e7466e (diff) |
Blackfin arch: Functional power management support
Enable: PM_SUSPEND_MEM -> Blackfin Hibernate to SDRAM
This feature requires a special bootloader (u-boot)
supporting return from hibernate.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-blackfin/dma.h | 8 | ||||
-rw-r--r-- | include/asm-blackfin/dpmc.h | 82 | ||||
-rw-r--r-- | include/asm-blackfin/gpio.h | 19 | ||||
-rw-r--r-- | include/asm-blackfin/mach-bf548/gpio.h | 8 |
4 files changed, 54 insertions, 63 deletions
diff --git a/include/asm-blackfin/dma.h b/include/asm-blackfin/dma.h index c0d5259e315b..3cd4b522aa3f 100644 --- a/include/asm-blackfin/dma.h +++ b/include/asm-blackfin/dma.h | |||
@@ -144,8 +144,16 @@ struct dma_channel { | |||
144 | void *data; | 144 | void *data; |
145 | unsigned int dma_enable_flag; | 145 | unsigned int dma_enable_flag; |
146 | unsigned int loopback_flag; | 146 | unsigned int loopback_flag; |
147 | #ifdef CONFIG_PM | ||
148 | unsigned short saved_peripheral_map; | ||
149 | #endif | ||
147 | }; | 150 | }; |
148 | 151 | ||
152 | #ifdef CONFIG_PM | ||
153 | int blackfin_dma_suspend(void); | ||
154 | void blackfin_dma_resume(void); | ||
155 | #endif | ||
156 | |||
149 | /******************************************************************************* | 157 | /******************************************************************************* |
150 | * DMA API's | 158 | * DMA API's |
151 | *******************************************************************************/ | 159 | *******************************************************************************/ |
diff --git a/include/asm-blackfin/dpmc.h b/include/asm-blackfin/dpmc.h index 7f34cd384f12..de28e6e018b3 100644 --- a/include/asm-blackfin/dpmc.h +++ b/include/asm-blackfin/dpmc.h | |||
@@ -7,63 +7,18 @@ | |||
7 | #ifndef _BLACKFIN_DPMC_H_ | 7 | #ifndef _BLACKFIN_DPMC_H_ |
8 | #define _BLACKFIN_DPMC_H_ | 8 | #define _BLACKFIN_DPMC_H_ |
9 | 9 | ||
10 | #define SLEEP_MODE 1 | ||
11 | #define DEEP_SLEEP_MODE 2 | ||
12 | #define ACTIVE_PLL_DISABLED 3 | ||
13 | #define FULLON_MODE 4 | ||
14 | #define ACTIVE_PLL_ENABLED 5 | ||
15 | #define HIBERNATE_MODE 6 | ||
16 | |||
17 | #define IOCTL_FULL_ON_MODE _IO('s', 0xA0) | ||
18 | #define IOCTL_ACTIVE_MODE _IO('s', 0xA1) | ||
19 | #define IOCTL_SLEEP_MODE _IO('s', 0xA2) | ||
20 | #define IOCTL_DEEP_SLEEP_MODE _IO('s', 0xA3) | ||
21 | #define IOCTL_HIBERNATE_MODE _IO('s', 0xA4) | ||
22 | #define IOCTL_CHANGE_FREQUENCY _IOW('s', 0xA5, unsigned long) | ||
23 | #define IOCTL_CHANGE_VOLTAGE _IOW('s', 0xA6, unsigned long) | ||
24 | #define IOCTL_SET_CCLK _IOW('s', 0xA7, unsigned long) | ||
25 | #define IOCTL_SET_SCLK _IOW('s', 0xA8, unsigned long) | ||
26 | #define IOCTL_GET_PLLSTATUS _IOW('s', 0xA9, unsigned long) | ||
27 | #define IOCTL_GET_CORECLOCK _IOW('s', 0xAA, unsigned long) | ||
28 | #define IOCTL_GET_SYSTEMCLOCK _IOW('s', 0xAB, unsigned long) | ||
29 | #define IOCTL_GET_VCO _IOW('s', 0xAC, unsigned long) | ||
30 | #define IOCTL_DISABLE_WDOG_TIMER _IO('s', 0xAD) | ||
31 | #define IOCTL_UNMASK_WDOG_WAKEUP_EVENT _IO('s',0xAE) | ||
32 | #define IOCTL_PROGRAM_WDOG_TIMER _IOW('s',0xAF,unsigned long) | ||
33 | #define IOCTL_CLEAR_WDOG_WAKEUP_EVENT _IO('s',0xB0) | ||
34 | #define IOCTL_SLEEP_DEEPER_MODE _IO('s',0xB1) | ||
35 | |||
36 | #define DPMC_MINOR 254 | ||
37 | |||
38 | #define ON 0 | ||
39 | #define OFF 1 | ||
40 | |||
41 | #ifdef __KERNEL__ | 10 | #ifdef __KERNEL__ |
11 | #ifndef __ASSEMBLY__ | ||
42 | 12 | ||
43 | unsigned long calc_volt(void); | ||
44 | int calc_vlev(int vlt); | ||
45 | unsigned long change_voltage(unsigned long volt); | ||
46 | int calc_msel(int vco_hz); | ||
47 | unsigned long change_frequency(unsigned long vco_mhz); | ||
48 | int set_pll_div(unsigned short sel, unsigned char flag); | ||
49 | int get_vco(void); | ||
50 | unsigned long change_system_clock(unsigned long clock); | ||
51 | unsigned long change_core_clock(unsigned long clock); | ||
52 | unsigned long get_pll_status(void); | ||
53 | void change_baud(int baud); | ||
54 | void fullon_mode(void); | ||
55 | void active_mode(void); | ||
56 | void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); | 13 | void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); |
57 | void deep_sleep(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); | 14 | void deep_sleep(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); |
58 | void hibernate_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); | 15 | void hibernate_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); |
59 | void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); | 16 | void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); |
60 | void program_wdog_timer(unsigned long); | 17 | void do_hibernate(int wakeup); |
61 | void unmask_wdog_wakeup_evt(void); | 18 | void set_dram_srfs(void); |
62 | void clear_wdog_wakeup_evt(void); | 19 | void unset_dram_srfs(void); |
63 | void disable_wdog_timer(void); | ||
64 | 20 | ||
65 | extern unsigned long get_cclk(void); | 21 | #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16)) |
66 | extern unsigned long get_sclk(void); | ||
67 | 22 | ||
68 | struct bfin_dpmc_platform_data { | 23 | struct bfin_dpmc_platform_data { |
69 | const unsigned int *tuple_tab; | 24 | const unsigned int *tuple_tab; |
@@ -71,8 +26,33 @@ struct bfin_dpmc_platform_data { | |||
71 | unsigned short vr_settling_time; /* in us */ | 26 | unsigned short vr_settling_time; /* in us */ |
72 | }; | 27 | }; |
73 | 28 | ||
74 | #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16)) | 29 | #else |
30 | |||
31 | #define PM_PUSH(x) \ | ||
32 | R0 = [P0 + (x - SRAM_BASE_ADDRESS)];\ | ||
33 | [--SP] = R0;\ | ||
34 | |||
35 | #define PM_POP(x) \ | ||
36 | R0 = [SP++];\ | ||
37 | [P0 + (x - SRAM_BASE_ADDRESS)] = R0;\ | ||
38 | |||
39 | #define PM_SYS_PUSH(x) \ | ||
40 | R0 = [P0 + (x - PLL_CTL)];\ | ||
41 | [--SP] = R0;\ | ||
42 | |||
43 | #define PM_SYS_POP(x) \ | ||
44 | R0 = [SP++];\ | ||
45 | [P0 + (x - PLL_CTL)] = R0;\ | ||
46 | |||
47 | #define PM_SYS_PUSH16(x) \ | ||
48 | R0 = w[P0 + (x - PLL_CTL)];\ | ||
49 | [--SP] = R0;\ | ||
50 | |||
51 | #define PM_SYS_POP16(x) \ | ||
52 | R0 = [SP++];\ | ||
53 | w[P0 + (x - PLL_CTL)] = R0;\ | ||
75 | 54 | ||
55 | #endif | ||
76 | #endif /* __KERNEL__ */ | 56 | #endif /* __KERNEL__ */ |
77 | 57 | ||
78 | #endif /*_BLACKFIN_DPMC_H_*/ | 58 | #endif /*_BLACKFIN_DPMC_H_*/ |
diff --git a/include/asm-blackfin/gpio.h b/include/asm-blackfin/gpio.h index ff95e9d88342..168f1251eb4d 100644 --- a/include/asm-blackfin/gpio.h +++ b/include/asm-blackfin/gpio.h | |||
@@ -376,8 +376,12 @@ struct gpio_port_t { | |||
376 | #endif | 376 | #endif |
377 | 377 | ||
378 | #ifdef CONFIG_PM | 378 | #ifdef CONFIG_PM |
379 | unsigned int bfin_pm_setup(void); | 379 | |
380 | void bfin_pm_restore(void); | 380 | unsigned int bfin_pm_standby_setup(void); |
381 | void bfin_pm_standby_restore(void); | ||
382 | |||
383 | void bfin_gpio_pm_hibernate_restore(void); | ||
384 | void bfin_gpio_pm_hibernate_suspend(void); | ||
381 | 385 | ||
382 | #ifndef CONFIG_BF54x | 386 | #ifndef CONFIG_BF54x |
383 | #define PM_WAKE_RISING 0x1 | 387 | #define PM_WAKE_RISING 0x1 |
@@ -392,17 +396,8 @@ void gpio_pm_wakeup_free(unsigned gpio); | |||
392 | 396 | ||
393 | struct gpio_port_s { | 397 | struct gpio_port_s { |
394 | unsigned short data; | 398 | unsigned short data; |
395 | unsigned short data_clear; | ||
396 | unsigned short data_set; | ||
397 | unsigned short toggle; | ||
398 | unsigned short maska; | 399 | unsigned short maska; |
399 | unsigned short maska_clear; | ||
400 | unsigned short maska_set; | ||
401 | unsigned short maska_toggle; | ||
402 | unsigned short maskb; | 400 | unsigned short maskb; |
403 | unsigned short maskb_clear; | ||
404 | unsigned short maskb_set; | ||
405 | unsigned short maskb_toggle; | ||
406 | unsigned short dir; | 401 | unsigned short dir; |
407 | unsigned short polar; | 402 | unsigned short polar; |
408 | unsigned short edge; | 403 | unsigned short edge; |
@@ -411,10 +406,10 @@ struct gpio_port_s { | |||
411 | 406 | ||
412 | unsigned short fer; | 407 | unsigned short fer; |
413 | unsigned short reserved; | 408 | unsigned short reserved; |
409 | unsigned short mux; | ||
414 | }; | 410 | }; |
415 | #endif /*CONFIG_BF54x*/ | 411 | #endif /*CONFIG_BF54x*/ |
416 | #endif /*CONFIG_PM*/ | 412 | #endif /*CONFIG_PM*/ |
417 | |||
418 | /*********************************************************** | 413 | /*********************************************************** |
419 | * | 414 | * |
420 | * FUNCTIONS: Blackfin GPIO Driver | 415 | * FUNCTIONS: Blackfin GPIO Driver |
diff --git a/include/asm-blackfin/mach-bf548/gpio.h b/include/asm-blackfin/mach-bf548/gpio.h index cb8b0f15c9a6..bba82dc75f16 100644 --- a/include/asm-blackfin/mach-bf548/gpio.h +++ b/include/asm-blackfin/mach-bf548/gpio.h | |||
@@ -209,3 +209,11 @@ struct gpio_port_t { | |||
209 | unsigned short dummy7; | 209 | unsigned short dummy7; |
210 | unsigned int port_mux; | 210 | unsigned int port_mux; |
211 | }; | 211 | }; |
212 | |||
213 | struct gpio_port_s { | ||
214 | unsigned short fer; | ||
215 | unsigned short data; | ||
216 | unsigned short dir; | ||
217 | unsigned short inen; | ||
218 | unsigned int mux; | ||
219 | }; | ||