964d793f34cca151a9c0c050b7ea17e30468df6d
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8825 / deep_sleep_phy_sc8810.h
1 /******************************************************************************
2  ** File Name:      dsp_sleep.h                                               *
3  ** Author:         Richard Yang                                              *
4  ** DATE:           08/25/2003                                                *
5  ** Copyright:      2003 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file defines the basic operation interfaces of       *
7  **                 DSP and MCU for deep sleep.                               *
8  ******************************************************************************
9
10  ******************************************************************************
11  **                        Edit History                                       *
12  ** ------------------------------------------------------------------------- *
13  ** DATE           NAME             DESCRIPTION                               *
14  ** 08/25/2003     Richard.Yang     Create.                                   *
15  ******************************************************************************/
16 #ifndef _DEEP_SLEEP_V3_MODULE_H
17 #define _DEEP_SLEEP_V3_MODULE_H
18
19 /**---------------------------------------------------------------------------*
20  **                         Dependencies                                      *
21  **---------------------------------------------------------------------------*/
22 #include "sci_types.h"
23 #include "arm_reg.h"
24
25 /**---------------------------------------------------------------------------*
26  **                         Compiler Flag                                     *
27  **---------------------------------------------------------------------------*/
28 #ifdef   __cplusplus
29 extern   "C"
30 {
31 #endif
32
33 #ifndef WIN32
34 #include "tx_api_thumb.h"
35 /**---------------------------------------------------------------------------*
36  **                         Constant Variables                                *
37  **---------------------------------------------------------------------------*/
38 #define NEW_SLEEP_ROUTINE
39 #define SLEEP_DRV_NONE          0
40 #define SLEEP_DRV_L1            BIT_0
41 #define SLEEP_DRV_MMI           BIT_1
42 #define SLEEP_DRV_SIM           BIT_2
43 #define SLEEP_DRV_AUDIO         BIT_3
44 #define SLEEP_DRV_LCD           BIT_4
45 #define SLEEP_DRV_CHARGE        BIT_5
46 #define SLEEP_DRV_ENGINEER      BIT_6
47 #define SLEEP_DRV_BT            BIT_7
48 #define SLEEP_DRV_PCM           BIT_8
49 #define SLEEP_DRV_BTCLK         BIT_9
50 #define SLEEP_DRV_UPM           BIT_10
51 #define SLEEP_DRV_CALIBRATION   BIT_11
52 #define SLEEP_DRV_ATC           BIT_12
53 #define SLEEP_DRV_TV            BIT_13
54
55 #define MILLISECOND         180
56
57 #define ENABLE_DEEP_SLEEP       1
58 #define DISABLE_DEEP_SLEEP      0
59
60 #define ENABLE_AHB_SLEEP        1
61 #define DISABLE_AHB_SLEEP       0
62
63 //AHB_CTL0 bit define bit5,bit6 reserved
64 #define AHB_CTL0_DCAM_EB    BIT_1
65 #define AHB_CTL0_USBD_EB    BIT_2
66 #define AHB_CTL0_DMA_EB     BIT_3
67 #define AHB_DMA_SLEEP_MODE  BIT_4
68 #define AHB_CTL0_TIC_EB     BIT_7
69 #define AHB_CTL0_MON_EB     BIT_8
70 #define AHB_CTL0_EMC_EB     BIT_9
71 //APB REG related bit definition
72 #define MISC0_APB_FORCE_SLP  BIT_8
73 #define MISC0_APB_FORCE_ON   BIT_20
74 //Mcu_misc_en reg related bit definition
75 #define DSP_CLK_OUT_EN      BIT_15
76 #define MCU_MISC_HPASS      BIT_31
77
78 typedef enum
79 {
80     SLP_LDOABB_AUTO_DIS,
81     SLP_LDOVBO_AUTO_DIS,
82     SLP_LDOAUX1_AUTO_DIS,
83     SLP_LDOAUX2_AUTO_DIS,
84     SLP_LDORF_AUTO_DIS,
85     SLP_LDOUSB_AUTO_DIS,
86     SLP_LDOCORE_AUTO_CHANGE,
87     SLP_LDOALL_AUTO_DIS
88 } SLEEP_LDO_AUTO_CTRL_E;
89
90 typedef enum
91 {
92     MCU_XTLEN_EN,
93     MCU_PLL_EN,
94     MCU_FORCE_STOP_EN,
95     MCU_SYS_SLEEP_EN,
96     MCU_DEEP_SLEEP_EN,
97     DMA_AUTO_SLEEP_EN,
98     APB_STOP_EN,
99     APB_FORCE_ON_EN,
100     APB_FORCE_SLEEP_EN
101 } SLEEP_CLK_AUTO_CTRL_E;
102
103 typedef enum
104 {
105     MCU_SYS_SLEEP,
106     MCU_CORE_SLEEP,
107     MCU_DEEP_SLEEP,
108     MCU_APB_SLEEP,
109     MCU_DMA_SLEEP,
110     MCU_NONE_SLEEP
111 } SLEEP_TYPE_E;
112
113
114 /*sleep_mode's bit map
115 -------------------------------------------------------------------------
116 |   31   |   30   |   29   |   28   |   27   |   26   |   25   |   24   |
117 -------------------------------------------------------------------------
118 |        |        |        |        |        |        |        |        |
119 -------------------------------------------------------------------------
120 -------------------------------------------------------------------------
121 |   15   |   14   |   13   |   12   |   11   |   10   |   9    |   8    |
122 -------------------------------------------------------------------------
123 |        |        |        |   ATC  | Calibra|   UPM  | BT_CLK |  PCM   |
124 -------------------------------------------------------------------------
125 |   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
126 -------------------------------------------------------------------------
127 |   BT   |ENGINEER|  CHR   |  LCD   |  AUD   |  SIM   |  MMI   |  L1    |
128 -------------------------------------------------------------------------*/
129 /* Note: Please remember to modify the sleep_mode initial value
130  * in deep_sleep.c when you modify the struct definition!               */
131 typedef union _sleep_sturct
132 {
133     struct _sleep
134     {
135         uint   reserved     :18;
136         uint   tv           :1;
137         uint   atc          :1;
138         uint   calibration  :1;
139         uint   upm          :1;
140         uint   bt_clk       :1;
141         uint   pcm          :1;
142         uint   bt           :1;
143         uint   engineer     :1;
144         uint   charge       :1;
145         uint   lcd          :1;
146         uint   audio        :1;
147         uint   sim          :1;
148         uint   mmi          :1;
149         uint   L1           :1;
150     } mBits;
151     uint   dwValue ;
152 } DRV_SLEEP_U;
153
154 #define SLEEP_DRV_NONE          0
155 #define SLEEP_DRV_L1            BIT_0
156 #define SLEEP_DRV_MMI           BIT_1
157 #define SLEEP_DRV_SIM           BIT_2
158 #define SLEEP_DRV_AUDIO         BIT_3
159 #define SLEEP_DRV_LCD           BIT_4
160 #define SLEEP_DRV_CHARGE        BIT_5
161 #define SLEEP_DRV_ENGINEER      BIT_6
162 #define SLEEP_DRV_BT            BIT_7
163 #define SLEEP_DRV_PCM           BIT_8
164 #define SLEEP_DRV_BTCLK         BIT_9
165 #define SLEEP_DRV_UPM           BIT_10
166 #define SLEEP_DRV_CALIBRATION   BIT_11
167 #define SLEEP_DRV_ATC           BIT_12
168 #define SLEEP_DRV_AP            BIT_13
169
170 /*ahb_sleep_mode's bit map
171 -------------------------------------------------------------------------
172 |   31   |   30   |   29   |   28   |   27   |   26   |   25   |   24   |
173 -------------------------------------------------------------------------
174 |       |        |        |        |        |        |        |        |
175 -------------------------------------------------------------------------
176 -------------------------------------------------------------------------
177 |   15   |   14   |   13   |   12   |   11   |   10   |   9    |   8    |
178 -------------------------------------------------------------------------
179 |        |        |        |        |        | Arch_eb| emc_eb |Busmon_eb|
180 -------------------------------------------------------------------------
181 |   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
182 -------------------------------------------------------------------------
183 |Tic_eb  |RESERVED|RESERVED|dma_s_mod|  dma_eb| Usbd_en| Dcam_eb|        |
184 -------------------------------------------------------------------------*/
185 /* Note: Please remember to modify the g_ahb_sleep_mode initial value
186    in deep_sleep.c when you modify the struct definition!*/
187 typedef union _ahb_sleep_sturct
188 {
189     struct _ahb_sleep
190     {
191         uint   reserved     :27;
192         uint   sdio         :1;
193         uint   dma          :1;
194         uint   dcam         :1;
195         uint   isp          :1;
196         uint   lcdc         :1;
197     } mBits;
198     uint   dwValue ;
199 } DRV_AHB_SLEEP_U;
200
201 /*apb_sleep_mode's bit map*/
202
203 /*GEN0*/
204 /*-------------------------------------------------------------------------
205 |   31   |   30   |   29   |   28   |   27   |   26   |   25   |   24   |
206 -------------------------------------------------------------------------
207 |       |        |        |        |        |        |        |        |
208 -------------------------------------------------------------------------
209 -------------------------------------------------------------------------
210 |   15   |   14   |   13   |   12   |   11   |   10   |   9    |   8    |
211 -------------------------------------------------------------------------
212 |        |        |        |        |        |        |        |        |
213 -----------------------------------------------------------------------------------
214 |   7    |   6    |   5    |   4    |   3      |   2       |   1      |   0       |
215 -----------------------------------------------------------------------------------
216 |        |  pwm   |  tpc    |  i2c_eb| sim_eb   |           |   adc_eb|
217 ----------------------------------------------------------------------------------*/
218 /*GEN1*/
219 /*-------------------------------------------------------------------------
220 |   31   |   30   |   29   |   28   |   27   |   26   |   25   |   24  | 23   | 22 |
221 -------------------------------------------------------------------------
222 |       |        |        |         |  pin   |   spi1  |   iis  |   spi0| uart1 | uart0 |
223 -------------------------------------------------------------------------
224 -------------------------------------------------------------------------
225 |   15   |   14   |   13   |   12   |   11   |   10   |   9    |   8    |
226 -------------------------------------------------------------------------
227 |        |        |        |        |        |        |        | gea_eb |
228 -----------------------------------------------------------------------------------
229 |   7    |   6    |   5    |   4    |   3      |   2       |   1      |   0       |
230 -----------------------------------------------------------------------------------
231 |        |        |        |        |          |           |          |           |
232 ----------------------------------------------------------------------------------*/
233 /* Note: Please remember to modify the g_apb_sleep_mode initial value
234    in deep_sleep.c when you modify the struct definition!               */
235 typedef union _apb_sleep_sturct
236 {
237     struct _apb_sleep
238     {
239         uint   reserved    :16;
240         uint   pwma         :1;
241         uint   pwmb         :1; 
242         uint   pwmc         :1;
243         uint   pwmd         :1;
244         uint   tpc         :1;
245         uint   i2c         :1;
246         uint   sim         :1;
247         uint   adc         :1;
248         uint   pin         :1;
249         uint   spi1        :1;
250         uint   iis         :1;
251         uint   spi0        :1;
252         uint   uart2       :1;
253         uint   uart1       :1;
254         uint   uart0       :1;
255         uint   gea         :1;
256     } mBits;
257     uint   dwValue ;
258 } DRV_APB_SLEEP_U;
259
260 #endif
261 /**---------------------------------------------------------------------------*
262  **                         Compiler Flag                                     *
263  **---------------------------------------------------------------------------*/
264 #ifdef   __cplusplus
265 }
266 #endif //
267 #endif // End of _DEEP_SLEEP_V0_MODULE_H
268