dpmc.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Miscellaneous IOCTL commands for Dynamic Power Management Controller Driver
  3. *
  4. * Copyright (C) 2004-2009 Analog Device Inc.
  5. *
  6. * Licensed under the GPL-2
  7. */
  8. #ifndef _BLACKFIN_DPMC_H_
  9. #define _BLACKFIN_DPMC_H_
  10. #include <mach/pll.h>
  11. /* PLL_CTL Masks */
  12. #define DF 0x0001 /* 0: PLL = CLKIN, 1: PLL = CLKIN/2 */
  13. #define PLL_OFF 0x0002 /* PLL Not Powered */
  14. #define STOPCK 0x0008 /* Core Clock Off */
  15. #define PDWN 0x0020 /* Enter Deep Sleep Mode */
  16. #ifdef __ADSPBF539__
  17. # define IN_DELAY 0x0014 /* Add 200ps Delay To EBIU Input Latches */
  18. # define OUT_DELAY 0x00C0 /* Add 200ps Delay To EBIU Output Signals */
  19. #else
  20. # define IN_DELAY 0x0040 /* Add 200ps Delay To EBIU Input Latches */
  21. # define OUT_DELAY 0x0080 /* Add 200ps Delay To EBIU Output Signals */
  22. #endif
  23. #define BYPASS 0x0100 /* Bypass the PLL */
  24. #define MSEL 0x7E00 /* Multiplier Select For CCLK/VCO Factors */
  25. #define SPORT_HYST 0x8000 /* Enable Additional Hysteresis on SPORT Input Pins */
  26. #define SET_MSEL(x) (((x)&0x3F) << 0x9) /* Set MSEL = 0-63 --> VCO = CLKIN*MSEL */
  27. /* PLL_DIV Masks */
  28. #define SSEL 0x000F /* System Select */
  29. #define CSEL 0x0030 /* Core Select */
  30. #define CSEL_DIV1 0x0000 /* CCLK = VCO / 1 */
  31. #define CSEL_DIV2 0x0010 /* CCLK = VCO / 2 */
  32. #define CSEL_DIV4 0x0020 /* CCLK = VCO / 4 */
  33. #define CSEL_DIV8 0x0030 /* CCLK = VCO / 8 */
  34. #define CCLK_DIV1 CSEL_DIV1
  35. #define CCLK_DIV2 CSEL_DIV2
  36. #define CCLK_DIV4 CSEL_DIV4
  37. #define CCLK_DIV8 CSEL_DIV8
  38. #define SET_SSEL(x) ((x) & 0xF) /* Set SSEL = 0-15 --> SCLK = VCO/SSEL */
  39. #define SCLK_DIV(x) (x) /* SCLK = VCO / x */
  40. /* PLL_STAT Masks */
  41. #define ACTIVE_PLLENABLED 0x0001 /* Processor In Active Mode With PLL Enabled */
  42. #define FULL_ON 0x0002 /* Processor In Full On Mode */
  43. #define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */
  44. #define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */
  45. #define RTCWS 0x0400 /* RTC/Reset Wake-Up Status */
  46. #define CANWS 0x0800 /* CAN Wake-Up Status */
  47. #define USBWS 0x2000 /* USB Wake-Up Status */
  48. #define KPADWS 0x4000 /* Keypad Wake-Up Status */
  49. #define ROTWS 0x8000 /* Rotary Wake-Up Status */
  50. #define GPWS 0x1000 /* General-Purpose Wake-Up Status */
  51. /* VR_CTL Masks */
  52. #if defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
  53. #define FREQ 0x3000 /* Switching Oscillator Frequency For Regulator */
  54. #define FREQ_1000 0x3000 /* Switching Frequency Is 1 MHz */
  55. #else
  56. #define FREQ 0x0003 /* Switching Oscillator Frequency For Regulator */
  57. #define FREQ_333 0x0001 /* Switching Frequency Is 333 kHz */
  58. #define FREQ_667 0x0002 /* Switching Frequency Is 667 kHz */
  59. #define FREQ_1000 0x0003 /* Switching Frequency Is 1 MHz */
  60. #endif
  61. #define HIBERNATE 0x0000 /* Powerdown/Bypass On-Board Regulation */
  62. #define GAIN 0x000C /* Voltage Level Gain */
  63. #define GAIN_5 0x0000 /* GAIN = 5 */
  64. #define GAIN_10 0x0004 /* GAIN = 1 */
  65. #define GAIN_20 0x0008 /* GAIN = 2 */
  66. #define GAIN_50 0x000C /* GAIN = 5 */
  67. #define VLEV 0x00F0 /* Internal Voltage Level */
  68. #ifdef __ADSPBF52x__
  69. #define VLEV_085 0x0040 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
  70. #define VLEV_090 0x0050 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
  71. #define VLEV_095 0x0060 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
  72. #define VLEV_100 0x0070 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
  73. #define VLEV_105 0x0080 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
  74. #define VLEV_110 0x0090 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
  75. #define VLEV_115 0x00A0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
  76. #define VLEV_120 0x00B0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
  77. #else
  78. #define VLEV_085 0x0060 /* VLEV = 0.85 V (-5% - +10% Accuracy) */
  79. #define VLEV_090 0x0070 /* VLEV = 0.90 V (-5% - +10% Accuracy) */
  80. #define VLEV_095 0x0080 /* VLEV = 0.95 V (-5% - +10% Accuracy) */
  81. #define VLEV_100 0x0090 /* VLEV = 1.00 V (-5% - +10% Accuracy) */
  82. #define VLEV_105 0x00A0 /* VLEV = 1.05 V (-5% - +10% Accuracy) */
  83. #define VLEV_110 0x00B0 /* VLEV = 1.10 V (-5% - +10% Accuracy) */
  84. #define VLEV_115 0x00C0 /* VLEV = 1.15 V (-5% - +10% Accuracy) */
  85. #define VLEV_120 0x00D0 /* VLEV = 1.20 V (-5% - +10% Accuracy) */
  86. #define VLEV_125 0x00E0 /* VLEV = 1.25 V (-5% - +10% Accuracy) */
  87. #define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */
  88. #endif
  89. #define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
  90. #define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */
  91. #define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */
  92. #define GPWE 0x0400 /* General-Purpose Wake-Up Enable */
  93. #define MXVRWE 0x0400 /* Enable MXVR Wakeup From Hibernate */
  94. #define KPADWE 0x1000 /* Keypad Wake-Up Enable */
  95. #define ROTWE 0x2000 /* Rotary Wake-Up Enable */
  96. #define CLKBUFOE 0x4000 /* CLKIN Buffer Output Enable */
  97. #define SCKELOW 0x8000 /* Do Not Drive SCKE High During Reset After Hibernate */
  98. #if defined(__ADSPBF52x__) || defined(__ADSPBF51x__)
  99. #define USBWE 0x0200 /* Enable USB Wakeup From Hibernate */
  100. #else
  101. #define USBWE 0x0800 /* Enable USB Wakeup From Hibernate */
  102. #endif
  103. #ifndef __ASSEMBLY__
  104. void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
  105. void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
  106. void do_hibernate(int wakeup);
  107. void set_dram_srfs(void);
  108. void unset_dram_srfs(void);
  109. #define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16))
  110. #ifdef CONFIG_CPU_FREQ
  111. #define CPUFREQ_CPU 0
  112. #endif
  113. struct bfin_dpmc_platform_data {
  114. const unsigned int *tuple_tab;
  115. unsigned short tabsize;
  116. unsigned short vr_settling_time; /* in us */
  117. };
  118. #endif
  119. #endif /*_BLACKFIN_DPMC_H_*/