Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-blackfin/dpmc.h - Miscellaneous IOCTL commands for Dynamic Power |
| 3 | * Management Controller Driver. |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 4 | * Copyright (C) 2004-2008 Analog Device Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | * |
| 6 | */ |
| 7 | #ifndef _BLACKFIN_DPMC_H_ |
| 8 | #define _BLACKFIN_DPMC_H_ |
| 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__ |
| 42 | |
| 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); |
Michael Hennerich | cfefe3c | 2008-02-09 04:12:37 +0800 | [diff] [blame] | 56 | 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); |
| 58 | 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); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 60 | void program_wdog_timer(unsigned long); |
| 61 | void unmask_wdog_wakeup_evt(void); |
| 62 | void clear_wdog_wakeup_evt(void); |
| 63 | void disable_wdog_timer(void); |
| 64 | |
| 65 | extern unsigned long get_cclk(void); |
| 66 | extern unsigned long get_sclk(void); |
| 67 | |
Michael Hennerich | 14b0320 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 68 | struct bfin_dpmc_platform_data { |
| 69 | const unsigned int *tuple_tab; |
| 70 | unsigned short tabsize; |
| 71 | unsigned short vr_settling_time; /* in us */ |
| 72 | }; |
| 73 | |
| 74 | #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16)) |
| 75 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 76 | #endif /* __KERNEL__ */ |
| 77 | |
| 78 | #endif /*_BLACKFIN_DPMC_H_*/ |