1 /******************************************************************************
2 ** File Name: chip_phy_v3.c *
3 ** Author: Richard Yang *
5 ** Copyright: 2002 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file defines the basic information on chip. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 08/14/2002 Richard.Yang Create. *
14 ** 09/16/2003 Xueliang.Wang Modify CR4013 *
15 ** 08/23/2004 JImmy.Jia Modify for SC6600D *
16 ******************************************************************************/
18 /**---------------------------------------------------------------------------*
20 **---------------------------------------------------------------------------*/
22 #include "asm/arch/sc_reg.h"
23 #include "asm/arch/adi_hal_internal.h"
24 #include "asm/arch/wdg_drvapi.h"
25 #include "asm/arch/sprd_reg.h"
26 #include "asm/arch/boot_drvapi.h"
27 /**---------------------------------------------------------------------------*
29 **---------------------------------------------------------------------------*/
35 /**---------------------------------------------------------------------------*
37 **---------------------------------------------------------------------------*/
38 #define DDR_PHY_IND_ADDR 0x30010184
39 #define DDR_PHY_IND_ADDR1 0x30040000
40 #define DDR_PHY_IND_ADDR2 0x402e3048
41 #define DDR_PHY_IND_PHY_ALIVE 0x00000001
42 /**---------------------------------------------------------------------------*
44 **---------------------------------------------------------------------------*/
45 /**---------------------------------------------------------------------------*
47 **---------------------------------------------------------------------------*/
49 /**---------------------------------------------------------------------------*
50 ** Function Definitions *
51 **---------------------------------------------------------------------------*/
52 /**---------------------------------------------------------------------------*
54 **---------------------------------------------------------------------------*/
55 struct dcdc_core_ds_step_info{
62 /*****************************************************************************/
63 // Description : This function is used to reset MCU.
64 // Global resource dependence :
65 // Author : Xueliang.Wang
67 /*****************************************************************************/
68 void CHIP_ResetMCU (void) //reset interrupt disable??
70 // This loop is very important to let the reset process work well on V3 board
82 volatile uint32 tick1 = SCI_GetTickCount();
83 volatile uint32 tick2 = SCI_GetTickCount();
85 while ( (tick2 - tick1) < 500)
87 tick2 = SCI_GetTickCount();
92 /*****************************************************************************/
93 // Description: Returns the HW_RST register address.
95 // Note : Because there is no register which can restore information
96 // when watchdog resets the system, so we choose IRAM.
97 /*****************************************************************************/
98 LOCAL uint32 CHIP_PHY_GetHwRstAddr (void)
100 // Returns a DWORD of IRAM shared with DCAM
101 return ANA_REG_GLB_WDG_RST_MONITOR;
104 /*****************************************************************************/
105 // Description: Returns the reset mode register address.
108 /*****************************************************************************/
109 LOCAL uint32 CHIP_PHY_GetRstModeAddr (void)
111 return ANA_REG_GLB_POR_RST_MONITOR;
114 /*****************************************************************************/
115 // Description: Gets the register in analog die to judge the reset mode.
117 // Note: !It is called before __main now, so it can not call the adi
118 // interface because it contains SCI_DisableIRQ inside, below
119 // writes the adi read interface individually. Because the la-
120 // ckless of SCI_DisableIRQ, so this function must be called
121 // before system interrupt is turnned on!
122 /*****************************************************************************/
123 LOCAL uint32 CHIP_PHY_GetANAReg (void)
125 return ANA_REG_GET(ANA_REG_GLB_POR_RST_MONITOR);
128 /*****************************************************************************/
129 // Description: This fuction returns the HW_RST value written before reset.
132 /*****************************************************************************/
133 LOCAL uint32 CHIP_PHY_GetHWFlag (void)
135 // Switch IRAM from DCAM to ARM
136 return ANA_REG_GET (CHIP_PHY_GetHwRstAddr ());
139 /*****************************************************************************/
140 // Description: PHY layer realization of BOOT_SetRstMode.
142 // Note: The valid bit filed is from bit15 to bit0
143 /*****************************************************************************/
144 PUBLIC void CHIP_PHY_SetRstMode (uint32 val)
146 ANA_REG_AND (CHIP_PHY_GetRstModeAddr (), ~0xFFFF);
147 ANA_REG_OR (CHIP_PHY_GetRstModeAddr (), (val&0xFFFF));
150 /*****************************************************************************/
151 // Description: This fuction returns the reset mode value.
154 /*****************************************************************************/
155 PUBLIC uint32 CHIP_PHY_GetRstMode (void)
157 return (ANA_REG_GET (CHIP_PHY_GetRstModeAddr ()) & 0xFFFF);
160 /*****************************************************************************/
161 // Description: PHY layer realization of BOOT_ResetHWFlag. It resets the HW
162 // reset register after system initialization.
164 // Note: The valid bit filed of analog register is from bit11 to bit0.
165 // | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 |
166 // |ALL_HRST_MONITOR | POR_HRST_MONITOR| WDG_HRST_MONITOR |
168 // The valid bit filed of HW_RST is from bit11 to bit0.
169 /*****************************************************************************/
170 PUBLIC void CHIP_PHY_ResetHWFlag (uint32 val)
172 // Reset the analog die register
173 ANA_REG_AND(ANA_REG_GLB_POR_RST_MONITOR, ~0xFFF);
174 ANA_REG_OR (ANA_REG_GLB_POR_RST_MONITOR, (val&0xFFF));
177 ANA_REG_AND(CHIP_PHY_GetHwRstAddr (), ~0xFFFF);
178 ANA_REG_OR (CHIP_PHY_GetHwRstAddr (), (val&0xFFFF));
181 /*****************************************************************************/
182 // Description: PHY layer realization of BOOT_SetWDGHWFlag. It Writes flag
183 // to the register which would not be reset by watchdog reset.
185 // Note: The valid bit filed is from bit15 to bit0
186 /*****************************************************************************/
187 PUBLIC void CHIP_PHY_SetWDGHWFlag (WDG_HW_FLAG_T type, uint32 val)
189 if(TYPE_RESET == type)
191 ANA_REG_AND(CHIP_PHY_GetHwRstAddr (), ~0xFFFF);
192 ANA_REG_OR (CHIP_PHY_GetHwRstAddr (), (val&0xFFFF));
201 /*****************************************************************************/
202 // Description: PHY layer realization of __BOOT_IRAM_EN.
204 // Note: Do nothing. There are 32KB internal ram dedicated for ARM.
205 /*****************************************************************************/
206 PUBLIC void CHIP_PHY_BootIramEn ()
210 /*****************************************************************************/
211 // Description : This function returns whether the watchdog reset is caused
212 // by software reset or system halted.
214 // Note : The valid bit filed is from bit15 to bit0
215 /*****************************************************************************/
216 PUBLIC BOOLEAN CHIP_PHY_IsWDGRstByMCU (uint32 flag)
218 // Copy the value of HW_RST register to the register specific to reset mode
219 ANA_REG_SET (CHIP_PHY_GetRstModeAddr (),
220 (CHIP_PHY_GetHWFlag () & 0xFFFF));
222 if ((CHIP_PHY_GetHWFlag () & 0xFFFF) == (flag & 0xFFFF))
232 /*****************************************************************************/
233 // Description : This function returns whether the reset is caused by power
236 // Note : | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 |
237 // |ALL_HRST_MONITOR | POR_HRST_MONITOR| WDG_HRST_MONITOR |
238 /*****************************************************************************/
239 PUBLIC BOOLEAN CHIP_PHY_IsResetByPowerUp()
241 if ((CHIP_PHY_GetANAReg () & 0xF0) == 0x0)
251 /*****************************************************************************/
252 // Description : This function returns whether the reset is caused by watch-
255 // Note : | 11 10 9 8 | 7 6 5 4 | 3 2 1 0 |
256 // |ALL_HRST_MONITOR | POR_HRST_MONITOR| WDG_HRST_MONITOR |
257 /*****************************************************************************/
258 PUBLIC BOOLEAN CHIP_PHY_IsResetByWatchDog()
260 if ((CHIP_PHY_GetANAReg () & 0xF) == 0x0)
270 /************************************************************
271 *select TDPLL's reference crystal,
272 *(1)--RF0---------xtlbuf0-----------
273 * -?-tdpll_ref_sel-----TDPLL
274 *(2)--RF1---------xtlbuf1-----------
275 1)rf_id = 0,TDPLL will select (1), or select (2)
276 ************************************************************/
277 PUBLIC uint32 TDPllRefConfig(TDPLL_REF_T rf_id)
279 #if !defined(CONFIG_ARCH_SCX35L)
281 /* before switch reference crystal, it must be sure that no module is using TDPLL */
282 pll_reg = readl(REG_AP_CLK_AP_AHB_CFG);
283 pll_reg &= ~AP_AHB_CLK_SEL_MASK;
284 writel(pll_reg, REG_AP_CLK_AP_AHB_CFG);
286 pll_reg = readl(REG_AON_CLK_PUB_AHB_CFG);
287 pll_reg &= ~PUB_AHB_CLK_SEL_MASK;
288 writel(pll_reg, REG_AON_CLK_PUB_AHB_CFG);
290 pll_reg = readl(REG_AP_CLK_AP_APB_CFG);
291 pll_reg &= ~AP_APB_CLK_SEL_MASK;
292 writel(pll_reg, REG_AP_CLK_AP_APB_CFG);
294 pll_reg = readl(REG_AON_CLK_AON_APB_CFG);
295 pll_reg &= ~PUB_APB_CLK_SEL_MASK;
296 writel(pll_reg, REG_AON_CLK_AON_APB_CFG);
298 pll_reg = readl(REG_AON_APB_PLL_SOFT_CNT_DONE);
299 pll_reg &= ~(BIT_TDPLL_SOFT_CNT_DONE);
300 writel(pll_reg, REG_AON_APB_PLL_SOFT_CNT_DONE);
303 /* switch TDPLL reference crystal */
304 if (rf_id == TDPLL_REF0)
306 pll_reg = readl(REG_PMU_APB_TDPLL_REL_CFG);
307 pll_reg &= ~(0x1 << 4);
308 writel(pll_reg, REG_PMU_APB_TDPLL_REL_CFG);
310 pll_reg = readl(REG_PMU_APB_XTL0_REL_CFG);
311 pll_reg |= BIT_XTL1_AP_SEL;
312 writel(pll_reg, REG_PMU_APB_XTL0_REL_CFG);
314 pll_reg = readl(REG_PMU_APB_XTLBUF0_REL_CFG);
315 pll_reg |= BIT_XTLBUF1_AP_SEL;
316 writel(pll_reg, REG_PMU_APB_XTLBUF0_REL_CFG);
318 else if(rf_id == TDPLL_REF1)
320 pll_reg = readl(REG_PMU_APB_TDPLL_REL_CFG);
321 pll_reg |= (0x1 << 4);
322 writel(pll_reg, REG_PMU_APB_TDPLL_REL_CFG);
324 pll_reg = readl(REG_PMU_APB_XTL1_REL_CFG);
325 pll_reg |= BIT_XTL1_AP_SEL;
326 writel(pll_reg, REG_PMU_APB_XTL1_REL_CFG);
328 pll_reg = readl(REG_PMU_APB_XTLBUF1_REL_CFG);
329 pll_reg |= BIT_XTLBUF1_AP_SEL;
330 writel(pll_reg, REG_PMU_APB_XTLBUF1_REL_CFG);
335 pll_reg = readl(REG_AON_APB_PLL_SOFT_CNT_DONE);
336 pll_reg |= (BIT_TDPLL_SOFT_CNT_DONE);
337 writel(pll_reg, REG_AON_APB_PLL_SOFT_CNT_DONE);
341 /* after switch, up ahb clock to 128M, APB to 64M */
342 pll_reg = readl(REG_AP_CLK_AP_AHB_CFG);
344 writel(pll_reg, REG_AP_CLK_AP_AHB_CFG);
346 pll_reg = readl(REG_AON_CLK_PUB_AHB_CFG);
348 writel(pll_reg, REG_AON_CLK_PUB_AHB_CFG);
350 pll_reg = readl(REG_AP_CLK_AP_APB_CFG);
352 writel(pll_reg, REG_AP_CLK_AP_APB_CFG);
354 pll_reg = readl(REG_AON_CLK_AON_APB_CFG);
356 writel(pll_reg, REG_AON_CLK_AON_APB_CFG);
361 void pmu_commom_config(void)
363 #if defined(CONFIG_ARCH_SCX35L)
364 #if defined(CONFIG_ARCH_SCX20L)
365 //reserved register,need not config
366 //CHIP_REG_SET(REG_PMU_APB_PD_CP0_SYS_CFG,
370 CHIP_REG_SET(REG_PMU_APB_PD_CP0_ARM9_0_CFG,
371 BIT_PD_CP0_ARM9_0_FORCE_SHUTDOWN |
372 //BIT_PD_CP0_ARM9_0_AUTO_SHUTDOWN_EN |
373 BITS_PD_CP0_ARM9_0_PWR_ON_DLY(0x08) |
374 BITS_PD_CP0_ARM9_0_PWR_ON_SEQ_DLY(0x06) |
375 BITS_PD_CP0_ARM9_0_ISO_ON_DLY(0x02) |
379 CHIP_REG_SET(REG_PMU_APB_PD_CP0_ARM9_1_CFG,
380 BIT_PD_CP0_ARM9_1_FORCE_SHUTDOWN |
381 //BIT_PD_CP0_ARM9_1_AUTO_SHUTDOWN_EN |
382 BITS_PD_CP0_ARM9_1_PWR_ON_DLY(0x08) |
383 BITS_PD_CP0_ARM9_1_PWR_ON_SEQ_DLY(0x06) |
384 BITS_PD_CP0_ARM9_1_ISO_ON_DLY(0x02) |
387 CHIP_REG_SET(REG_PMU_APB_PD_CP0_GSM_0_CFG,
388 //BIT_PD_CP0_GSM_0_FORCE_SHUTDOWN |
389 BIT_PD_CP0_GSM_0_AUTO_SHUTDOWN_EN |
390 BITS_PD_CP0_GSM_0_PWR_ON_DLY(0x08) |
391 BITS_PD_CP0_GSM_0_PWR_ON_SEQ_DLY(0x06) |
392 BITS_PD_CP0_GSM_0_ISO_ON_DLY(0x02) |
396 CHIP_REG_SET(REG_PMU_APB_PD_CP0_GSM_1_CFG,
397 BIT_PD_CP0_GSM_1_FORCE_SHUTDOWN |
398 //BIT_PD_CP0_GSM_1_AUTO_SHUTDOWN_EN |
399 BITS_PD_CP0_GSM_1_PWR_ON_DLY(0x08) |
400 BITS_PD_CP0_GSM_1_PWR_ON_SEQ_DLY(0x04) |
401 BITS_PD_CP0_GSM_1_ISO_ON_DLY(0x04) |
404 CHIP_REG_SET(REG_PMU_APB_PD_CP0_CEVA_0_CFG,
405 //BIT_PD_CP0_CEVA_0_FORCE_SHUTDOWN |
406 BIT_PD_CP0_CEVA_0_AUTO_SHUTDOWN_EN |
407 BITS_PD_CP0_CEVA_0_PWR_ON_DLY(0x08) |
408 BITS_PD_CP0_CEVA_0_PWR_ON_SEQ_DLY(0x06) |
409 BITS_PD_CP0_CEVA_0_ISO_ON_DLY(0x02) |
413 CHIP_REG_SET(REG_PMU_APB_PD_CP0_CEVA_1_CFG,
414 BIT_PD_CP0_CEVA_1_FORCE_SHUTDOWN |
415 //BIT_PD_CP0_CEVA_1_AUTO_SHUTDOWN_EN |
416 BITS_PD_CP0_CEVA_1_PWR_ON_DLY(0x08) |
417 BITS_PD_CP0_CEVA_1_PWR_ON_SEQ_DLY(0x06) |
418 BITS_PD_CP0_CEVA_1_ISO_ON_DLY(0x02) |
422 CHIP_REG_SET(REG_PMU_APB_PD_CP0_HU3GE_CFG,
423 BIT_PD_CP0_HU3GE_FORCE_SHUTDOWN |
424 //BIT_PD_CP0_HU3GE_AUTO_SHUTDOWN_EN |
425 BITS_PD_CP0_HU3GE_PWR_ON_DLY(0x08) |
426 BITS_PD_CP0_HU3GE_PWR_ON_SEQ_DLY(0x02) |
427 BITS_PD_CP0_HU3GE_ISO_ON_DLY(0x04) |
430 CHIP_REG_SET(REG_PMU_APB_PD_CP0_TD_CFG,
431 //BIT_PD_CP0_TD_FORCE_SHUTDOWN |
432 BIT_PD_CP0_TD_AUTO_SHUTDOWN_EN |
433 BITS_PD_CP0_TD_PWR_ON_DLY(0x08) |
434 BITS_PD_CP0_TD_PWR_ON_SEQ_DLY(0x02) |
435 BITS_PD_CP0_TD_ISO_ON_DLY(0x04) |
438 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C0_CFG,
439 //BIT_PD_CA7_C0_WFI_SHUTDOWN_EN |
440 //BIT_PD_CA7_C0_DBG_SHUTDOWN_EN |
441 //BIT_PD_CA7_C0_FORCE_SHUTDOWN |
442 BIT_PD_CA7_C0_AUTO_SHUTDOWN_EN |
443 BITS_PD_CA7_C0_PWR_ON_DLY(0x08) |
444 BITS_PD_CA7_C0_PWR_ON_SEQ_DLY(0x06) |
445 BITS_PD_CA7_C0_ISO_ON_DLY(0x02) |
448 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C1_CFG,
449 //BIT_PD_CA7_C1_WFI_SHUTDOWN_EN |
450 //BIT_PD_CA7_C1_DBG_SHUTDOWN_EN |
451 BIT_PD_CA7_C1_FORCE_SHUTDOWN |
452 //BIT_PD_CA7_C1_AUTO_SHUTDOWN_EN |
453 BITS_PD_CA7_C1_PWR_ON_DLY(0x08) |
454 BITS_PD_CA7_C1_PWR_ON_SEQ_DLY(0x04) |
455 BITS_PD_CA7_C1_ISO_ON_DLY(0x02) |
459 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C2_CFG,
460 //BIT_PD_CA7_C2_WFI_SHUTDOWN_EN |
461 //BIT_PD_CA7_C2_DBG_SHUTDOWN_EN |
462 BIT_PD_CA7_C2_FORCE_SHUTDOWN |
463 //BIT_PD_CA7_C2_AUTO_SHUTDOWN_EN |
464 BITS_PD_CA7_C2_PWR_ON_DLY(0x08) |
465 BITS_PD_CA7_C2_PWR_ON_SEQ_DLY(0x04) |
466 BITS_PD_CA7_C2_ISO_ON_DLY(0x02) |
470 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C3_CFG,
471 //BIT_PD_CA7_C3_WFI_SHUTDOWN_EN |
472 //BIT_PD_CA7_C3_DBG_SHUTDOWN_EN |
473 BIT_PD_CA7_C3_FORCE_SHUTDOWN |
474 //BIT_PD_CA7_C3_AUTO_SHUTDOWN_EN |
475 BITS_PD_CA7_C3_PWR_ON_DLY(0x08) |
476 BITS_PD_CA7_C3_PWR_ON_SEQ_DLY(0x04) |
477 BITS_PD_CA7_C3_ISO_ON_DLY(0x02) |
480 CHIP_REG_SET(REG_PMU_APB_PD_AP_SYS_CFG,
481 //BIT_PD_AP_SYS_FORCE_SHUTDOWN |
482 BIT_PD_AP_SYS_AUTO_SHUTDOWN_EN |
483 BITS_PD_AP_SYS_PWR_ON_DLY(0x08) |
484 BITS_PD_AP_SYS_PWR_ON_SEQ_DLY(0x00) |
485 BITS_PD_AP_SYS_ISO_ON_DLY(0x06) |
488 CHIP_REG_SET(REG_PMU_APB_PD_GPU_TOP_CFG ,
489 BIT_PD_GPU_TOP_FORCE_SHUTDOWN |
490 //BIT_PD_GPU_TOP_AUTO_SHUTDOWN_EN |
491 BITS_PD_GPU_TOP_PWR_ON_DLY(0x08) |
492 BITS_PD_GPU_TOP_PWR_ON_SEQ_DLY(0x00) |
493 BITS_PD_GPU_TOP_ISO_ON_DLY(0x04) |
496 CHIP_REG_SET(REG_PMU_APB_PD_MM_TOP_CFG,
497 BIT_PD_MM_TOP_FORCE_SHUTDOWN |
498 //BIT_PD_MM_TOP_AUTO_SHUTDOWN_EN |
499 BITS_PD_MM_TOP_PWR_ON_DLY(0x08) |
500 BITS_PD_MM_TOP_PWR_ON_SEQ_DLY(0x00) |
501 BITS_PD_MM_TOP_ISO_ON_DLY(0x04) |
504 CHIP_REG_SET(REG_PMU_APB_PD_CP1_CA5_CFG,
505 //BIT_PD_CP1_CA5_FORCE_SHUTDOWN |
506 BIT_PD_CP1_CA5_AUTO_SHUTDOWN_EN |
507 BITS_PD_CP1_CA5_PWR_ON_DLY(0x08) |
508 BITS_PD_CP1_CA5_PWR_ON_SEQ_DLY(0x02) |
509 BITS_PD_CP1_CA5_ISO_ON_DLY(0x04) |
512 CHIP_REG_SET(REG_PMU_APB_PD_CP1_LTE_P1_CFG,
513 //BIT_PD_CP1_LTE_P1_FORCE_SHUTDOWN |
514 BIT_PD_CP1_LTE_P1_AUTO_SHUTDOWN_EN |
515 BITS_PD_CP1_LTE_P1_PWR_ON_DLY(0x08) |
516 BITS_PD_CP1_LTE_P1_PWR_ON_SEQ_DLY(0x02) |
517 BITS_PD_CP1_LTE_P1_ISO_ON_DLY(0x04) |
520 CHIP_REG_SET(REG_PMU_APB_PD_CP1_LTE_P2_CFG,
521 //BIT_PD_CP1_LTE_P2_FORCE_SHUTDOWN |
522 BIT_PD_CP1_LTE_P2_AUTO_SHUTDOWN_EN |
523 BITS_PD_CP1_LTE_P2_PWR_ON_DLY(0x08) |
524 BITS_PD_CP1_LTE_P2_PWR_ON_SEQ_DLY(0x02) |
525 BITS_PD_CP1_LTE_P2_ISO_ON_DLY(0x04) |
528 CHIP_REG_SET(REG_PMU_APB_PD_CP1_CEVA_CFG,
529 //BIT_PD_CP1_CEVA_FORCE_SHUTDOWN |
530 BIT_PD_CP1_CEVA_AUTO_SHUTDOWN_EN |
531 BITS_PD_CP1_CEVA_PWR_ON_DLY(0x08) |
532 BITS_PD_CP1_CEVA_PWR_ON_SEQ_DLY(0x02) |
533 BITS_PD_CP1_CEVA_ISO_ON_DLY(0x04) |
536 CHIP_REG_SET(REG_PMU_APB_PD_CP1_COMWRAP_CFG,
537 //BIT_PD_CP1_COMWRAP_FORCE_SHUTDOWN |
538 BIT_PD_CP1_COMWRAP_AUTO_SHUTDOWN_EN |
539 BITS_PD_CP1_COMWRAP_PWR_ON_DLY(0x08) |
540 BITS_PD_CP1_COMWRAP_PWR_ON_SEQ_DLY(0x02) |
541 BITS_PD_CP1_COMWRAP_ISO_ON_DLY(0x04) |
544 CHIP_REG_SET(REG_PMU_APB_PD_PUB_SYS_CFG,
545 //BIT_PD_PUB_SYS_FORCE_SHUTDOWN |
546 BIT_PD_PUB_SYS_AUTO_SHUTDOWN_EN |
547 BITS_PD_PUB_SYS_PWR_ON_DLY(0x08) |
548 BITS_PD_PUB_SYS_PWR_ON_SEQ_DLY(0x00) |
549 BITS_PD_PUB_SYS_ISO_ON_DLY(0x06) |
552 CHIP_REG_SET(REG_PMU_APB_PD_CA7_TOP_CFG,
553 //BIT_PD_CA7_TOP_DBG_SHUTDOWN_EN |
554 //BIT_PD_CA7_TOP_FORCE_SHUTDOWN |
555 BIT_PD_CA7_TOP_AUTO_SHUTDOWN_EN |
556 BITS_PD_CA7_TOP_PWR_ON_DLY(0x08) |
557 BITS_PD_CA7_TOP_PWR_ON_SEQ_DLY(0x02) |
558 BITS_PD_CA7_TOP_ISO_ON_DLY(0x04) |
561 CHIP_REG_SET(REG_PMU_APB_XTL_WAIT_CNT,
562 BITS_XTL1_WAIT_CNT(0x39) |
563 BITS_XTL0_WAIT_CNT(0x39) |
566 CHIP_REG_SET(REG_PMU_APB_XTLBUF_WAIT_CNT,
567 BITS_XTLBUF1_WAIT_CNT(7) |
568 BITS_XTLBUF0_WAIT_CNT(7) |
571 CHIP_REG_SET(REG_PMU_APB_PLL_WAIT_CNT1,
572 BITS_LTEPLL_WAIT_CNT(7) |
573 BITS_TWPLL_WAIT_CNT(7) |
574 BITS_DPLL_WAIT_CNT(7) |
575 BITS_MPLL_WAIT_CNT(7) |
578 CHIP_REG_SET(REG_PMU_APB_PLL_WAIT_CNT2,
579 BITS_LVDSDIS_PLL_WAIT_CNT(7) |
583 CHIP_REG_SET(REG_PMU_APB_PWR_CNT_WAIT_CFG0,
584 BITS_VCP0_PWR_WAIT_CNT(0x17) |
585 BITS_CP1_PWR_WAIT_CNT(0x17) |
586 BITS_CP0_PWR_WAIT_CNT(0x17) |
587 BITS_AP_PWR_WAIT_CNT(0x17) |
590 CHIP_REG_SET(REG_PMU_APB_PWR_CNT_WAIT_CFG1,
591 BITS_ARM7_PWR_WAIT_CNT(0x17) |
592 BITS_VCP1_PWR_WAIT_CNT(0x17) |
596 CHIP_REG_SET(REG_PMU_APB_PD_CP0_SYS_CFG,
599 CHIP_REG_SET(REG_PMU_APB_PD_CP0_ARM9_0_CFG,
600 //BIT_PD_CP0_ARM9_0_FORCE_SHUTDOWN |
601 BIT_PD_CP0_ARM9_0_AUTO_SHUTDOWN_EN |
602 BITS_PD_CP0_ARM9_0_PWR_ON_DLY(0x08) |
603 BITS_PD_CP0_ARM9_0_PWR_ON_SEQ_DLY(0x06) |
604 BITS_PD_CP0_ARM9_0_ISO_ON_DLY(0x02) |
607 CHIP_REG_SET(REG_PMU_APB_PD_CP0_ARM9_1_CFG,
608 //BIT_PD_CP0_ARM9_1_FORCE_SHUTDOWN |
609 BIT_PD_CP0_ARM9_1_AUTO_SHUTDOWN_EN |
610 BITS_PD_CP0_ARM9_1_PWR_ON_DLY(0x08) |
611 BITS_PD_CP0_ARM9_1_PWR_ON_SEQ_DLY(0x06) |
612 BITS_PD_CP0_ARM9_1_ISO_ON_DLY(0x02) |
615 CHIP_REG_SET(REG_PMU_APB_PD_CP0_GSM_0_CFG,
616 //BIT_PD_CP0_GSM_0_FORCE_SHUTDOWN |
617 BIT_PD_CP0_GSM_0_AUTO_SHUTDOWN_EN |
618 BITS_PD_CP0_GSM_0_PWR_ON_DLY(0x08) |
619 BITS_PD_CP0_GSM_0_PWR_ON_SEQ_DLY(0x06) |
620 BITS_PD_CP0_GSM_0_ISO_ON_DLY(0x02) |
623 CHIP_REG_SET(REG_PMU_APB_PD_CP0_GSM_1_CFG,
624 //BIT_PD_CP0_GSM_1_FORCE_SHUTDOWN |
625 BIT_PD_CP0_GSM_1_AUTO_SHUTDOWN_EN |
626 BITS_PD_CP0_GSM_1_PWR_ON_DLY(0x08) |
627 BITS_PD_CP0_GSM_1_PWR_ON_SEQ_DLY(0x04) |
628 BITS_PD_CP0_GSM_1_ISO_ON_DLY(0x04) |
631 CHIP_REG_SET(REG_PMU_APB_PD_CP0_CEVA_0_CFG,
632 //BIT_PD_CP0_CEVA_0_FORCE_SHUTDOWN |
633 BIT_PD_CP0_CEVA_0_AUTO_SHUTDOWN_EN |
634 BITS_PD_CP0_CEVA_0_PWR_ON_DLY(0x08) |
635 BITS_PD_CP0_CEVA_0_PWR_ON_SEQ_DLY(0x06) |
636 BITS_PD_CP0_CEVA_0_ISO_ON_DLY(0x02) |
639 CHIP_REG_SET(REG_PMU_APB_PD_CP0_CEVA_1_CFG,
640 //BIT_PD_CP0_CEVA_1_FORCE_SHUTDOWN |
641 BIT_PD_CP0_CEVA_1_AUTO_SHUTDOWN_EN |
642 BITS_PD_CP0_CEVA_1_PWR_ON_DLY(0x08) |
643 BITS_PD_CP0_CEVA_1_PWR_ON_SEQ_DLY(0x06) |
644 BITS_PD_CP0_CEVA_1_ISO_ON_DLY(0x02) |
647 CHIP_REG_SET(REG_PMU_APB_PD_CP0_HU3GE_CFG,
648 //BIT_PD_CP0_HU3GE_FORCE_SHUTDOWN |
649 BIT_PD_CP0_HU3GE_AUTO_SHUTDOWN_EN |
650 BITS_PD_CP0_HU3GE_PWR_ON_DLY(0x08) |
651 BITS_PD_CP0_HU3GE_PWR_ON_SEQ_DLY(0x02) |
652 BITS_PD_CP0_HU3GE_ISO_ON_DLY(0x04) |
655 CHIP_REG_SET(REG_PMU_APB_PD_CP0_TD_CFG,
656 //BIT_PD_CP0_TD_FORCE_SHUTDOWN |
657 BIT_PD_CP0_TD_AUTO_SHUTDOWN_EN |
658 BITS_PD_CP0_TD_PWR_ON_DLY(0x08) |
659 BITS_PD_CP0_TD_PWR_ON_SEQ_DLY(0x02) |
660 BITS_PD_CP0_TD_ISO_ON_DLY(0x04) |
663 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C0_CFG,
664 //BIT_PD_CA7_C0_WFI_SHUTDOWN_EN |
665 //BIT_PD_CA7_C0_DBG_SHUTDOWN_EN |
666 //BIT_PD_CA7_C0_FORCE_SHUTDOWN |
667 BIT_PD_CA7_C0_AUTO_SHUTDOWN_EN |
668 BITS_PD_CA7_C0_PWR_ON_DLY(0x08) |
669 BITS_PD_CA7_C0_PWR_ON_SEQ_DLY(0x06) |
670 BITS_PD_CA7_C0_ISO_ON_DLY(0x02) |
673 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C1_CFG,
674 //BIT_PD_CA7_C1_WFI_SHUTDOWN_EN |
675 //BIT_PD_CA7_C1_DBG_SHUTDOWN_EN |
676 BIT_PD_CA7_C1_FORCE_SHUTDOWN |
677 //BIT_PD_CA7_C1_AUTO_SHUTDOWN_EN |
678 BITS_PD_CA7_C1_PWR_ON_DLY(0x08) |
679 BITS_PD_CA7_C1_PWR_ON_SEQ_DLY(0x04) |
680 BITS_PD_CA7_C1_ISO_ON_DLY(0x02) |
683 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C2_CFG,
684 //BIT_PD_CA7_C2_WFI_SHUTDOWN_EN |
685 //BIT_PD_CA7_C2_DBG_SHUTDOWN_EN |
686 BIT_PD_CA7_C2_FORCE_SHUTDOWN |
687 //BIT_PD_CA7_C2_AUTO_SHUTDOWN_EN |
688 BITS_PD_CA7_C2_PWR_ON_DLY(0x08) |
689 BITS_PD_CA7_C2_PWR_ON_SEQ_DLY(0x04) |
690 BITS_PD_CA7_C2_ISO_ON_DLY(0x02) |
693 CHIP_REG_SET(REG_PMU_APB_PD_CA7_C3_CFG,
694 //BIT_PD_CA7_C3_WFI_SHUTDOWN_EN |
695 //BIT_PD_CA7_C3_DBG_SHUTDOWN_EN |
696 BIT_PD_CA7_C3_FORCE_SHUTDOWN |
697 //BIT_PD_CA7_C3_AUTO_SHUTDOWN_EN |
698 BITS_PD_CA7_C3_PWR_ON_DLY(0x08) |
699 BITS_PD_CA7_C3_PWR_ON_SEQ_DLY(0x04) |
700 BITS_PD_CA7_C3_ISO_ON_DLY(0x02) |
703 CHIP_REG_SET(REG_PMU_APB_PD_AP_SYS_CFG,
704 //BIT_PD_AP_SYS_FORCE_SHUTDOWN |
705 BIT_PD_AP_SYS_AUTO_SHUTDOWN_EN |
706 BITS_PD_AP_SYS_PWR_ON_DLY(0x08) |
707 BITS_PD_AP_SYS_PWR_ON_SEQ_DLY(0x00) |
708 BITS_PD_AP_SYS_ISO_ON_DLY(0x06) |
711 CHIP_REG_SET(REG_PMU_APB_PD_GPU_TOP_CFG ,
712 BIT_PD_GPU_TOP_FORCE_SHUTDOWN |
713 //BIT_PD_GPU_TOP_AUTO_SHUTDOWN_EN |
714 BITS_PD_GPU_TOP_PWR_ON_DLY(0x08) |
715 BITS_PD_GPU_TOP_PWR_ON_SEQ_DLY(0x00) |
716 BITS_PD_GPU_TOP_ISO_ON_DLY(0x04) |
719 CHIP_REG_SET(REG_PMU_APB_PD_MM_TOP_CFG,
720 BIT_PD_MM_TOP_FORCE_SHUTDOWN |
721 //BIT_PD_MM_TOP_AUTO_SHUTDOWN_EN |
722 BITS_PD_MM_TOP_PWR_ON_DLY(0x08) |
723 BITS_PD_MM_TOP_PWR_ON_SEQ_DLY(0x00) |
724 BITS_PD_MM_TOP_ISO_ON_DLY(0x04) |
727 CHIP_REG_SET(REG_PMU_APB_PD_CP1_CA5_CFG,
728 //BIT_PD_CP1_CA5_FORCE_SHUTDOWN |
729 BIT_PD_CP1_CA5_AUTO_SHUTDOWN_EN |
730 BITS_PD_CP1_CA5_PWR_ON_DLY(0x08) |
731 BITS_PD_CP1_CA5_PWR_ON_SEQ_DLY(0x02) |
732 BITS_PD_CP1_CA5_ISO_ON_DLY(0x04) |
735 CHIP_REG_SET(REG_PMU_APB_PD_CP1_LTE_P1_CFG,
736 //BIT_PD_CP1_LTE_P1_FORCE_SHUTDOWN |
737 BIT_PD_CP1_LTE_P1_AUTO_SHUTDOWN_EN |
738 BITS_PD_CP1_LTE_P1_PWR_ON_DLY(0x08) |
739 BITS_PD_CP1_LTE_P1_PWR_ON_SEQ_DLY(0x02) |
740 BITS_PD_CP1_LTE_P1_ISO_ON_DLY(0x04) |
743 CHIP_REG_SET(REG_PMU_APB_PD_CP1_LTE_P2_CFG,
744 //BIT_PD_CP1_LTE_P2_FORCE_SHUTDOWN |
745 BIT_PD_CP1_LTE_P2_AUTO_SHUTDOWN_EN |
746 BITS_PD_CP1_LTE_P2_PWR_ON_DLY(0x08) |
747 BITS_PD_CP1_LTE_P2_PWR_ON_SEQ_DLY(0x02) |
748 BITS_PD_CP1_LTE_P2_ISO_ON_DLY(0x04) |
752 CHIP_REG_SET(REG_PMU_APB_PD_CP1_CEVA_CFG,
753 //BIT_PD_CP1_CEVA_FORCE_SHUTDOWN |
754 BIT_PD_CP1_CEVA_AUTO_SHUTDOWN_EN |
755 BITS_PD_CP1_CEVA_PWR_ON_DLY(0x08) |
756 BITS_PD_CP1_CEVA_PWR_ON_SEQ_DLY(0x02) |
757 BITS_PD_CP1_CEVA_ISO_ON_DLY(0x04) |
760 CHIP_REG_SET(REG_PMU_APB_PD_CP1_COMWRAP_CFG,
761 //BIT_PD_CP1_COMWRAP_FORCE_SHUTDOWN |
762 BIT_PD_CP1_COMWRAP_AUTO_SHUTDOWN_EN |
763 BITS_PD_CP1_COMWRAP_PWR_ON_DLY(0x08) |
764 BITS_PD_CP1_COMWRAP_PWR_ON_SEQ_DLY(0x02) |
765 BITS_PD_CP1_COMWRAP_ISO_ON_DLY(0x04) |
768 CHIP_REG_SET(REG_PMU_APB_PD_PUB_SYS_CFG,
769 //BIT_PD_PUB_SYS_FORCE_SHUTDOWN |
770 BIT_PD_PUB_SYS_AUTO_SHUTDOWN_EN |
771 BITS_PD_PUB_SYS_PWR_ON_DLY(0x08) |
772 BITS_PD_PUB_SYS_PWR_ON_SEQ_DLY(0x00) |
773 BITS_PD_PUB_SYS_ISO_ON_DLY(0x06) |
776 CHIP_REG_SET(REG_PMU_APB_PD_CA7_TOP_CFG,
777 //BIT_PD_CA7_TOP_DBG_SHUTDOWN_EN |
778 //BIT_PD_CA7_TOP_FORCE_SHUTDOWN |
779 BIT_PD_CA7_TOP_AUTO_SHUTDOWN_EN |
780 BITS_PD_CA7_TOP_PWR_ON_DLY(0x08) |
781 BITS_PD_CA7_TOP_PWR_ON_SEQ_DLY(0x02) |
782 BITS_PD_CA7_TOP_ISO_ON_DLY(0x04) |
785 CHIP_REG_SET(REG_PMU_APB_XTL_WAIT_CNT,
786 BITS_XTL1_WAIT_CNT(0x39) |
787 BITS_XTL0_WAIT_CNT(0x39) |
790 CHIP_REG_SET(REG_PMU_APB_XTLBUF_WAIT_CNT,
791 BITS_XTLBUF1_WAIT_CNT(7) |
792 BITS_XTLBUF0_WAIT_CNT(7) |
795 CHIP_REG_SET(REG_PMU_APB_PLL_WAIT_CNT1,
796 BITS_LTEPLL_WAIT_CNT(7) |
797 BITS_TWPLL_WAIT_CNT(7) |
798 BITS_DPLL_WAIT_CNT(7) |
799 BITS_MPLL_WAIT_CNT(7) |
802 CHIP_REG_SET(REG_PMU_APB_PLL_WAIT_CNT2,
803 BITS_LVDSDIS_PLL_WAIT_CNT(7) |
807 CHIP_REG_SET(REG_PMU_APB_PWR_CNT_WAIT_CFG0,
808 BITS_VCP0_PWR_WAIT_CNT(8) |
809 BITS_CP1_PWR_WAIT_CNT(8) |
810 BITS_CP0_PWR_WAIT_CNT(8) |
811 BITS_AP_PWR_WAIT_CNT(0x17) |
815 CHIP_REG_SET(REG_PMU_APB_PWR_CNT_WAIT_CFG1,
816 BITS_ARM7_PWR_WAIT_CNT(8) |
817 BITS_VCP1_PWR_WAIT_CNT(8) |
825 static void setup_autopd_mode(void)
827 /*enable the emc auto gate en*/
828 CHIP_REG_SET(REG_AON_APB_EMC_AUTO_GATE_EN,
829 BIT_CP1_PUB_AUTO_GATE_EN |
830 BIT_CP0_PUB_AUTO_GATE_EN |
831 BIT_AP_PUB_AUTO_GATE_EN |
832 BIT_AON_APB_PUB_AUTO_GATE_EN |
833 BIT_CP1_EMC_AUTO_GATE_EN |
834 BIT_CP0_EMC_AUTO_GATE_EN |
835 //BIT_AP_EMC_AUTO_GATE_EN |
836 BIT_CA7_EMC_AUTO_GATE_EN |
841 static void dcdc_optimize_config(unsigned int para)
843 #if defined(CONFIG_ADIE_SC2723S) || defined(CONFIG_ADIE_SC2723)
844 unsigned short dcdc_ctrl[]={
852 0x0808,/*mem & core*/
858 for(i=0;i<sizeof(dcdc_ctrl)/sizeof(dcdc_ctrl[0]);i++)
860 sci_adi_write(ANA_REG_GLB_DCDC_CTRL0 + (i << 2),dcdc_ctrl[i],0xffff);
865 struct dcdc_sleep_reg_ctrl{
866 volatile unsigned int magic_header;
867 volatile unsigned int is_auto_ds;
868 volatile unsigned int magic_ender;
870 struct dcdc_sleep_reg_ctrl ds_cfg=
873 #if defined(CONFIG_ARCH_SCX20L)
880 static void dcdc_core_ds_config(unsigned int para)
882 #if defined(CONFIG_ADIE_SC2723S) || defined(CONFIG_ADIE_SC2723)
884 uint32 dcdc_core_ctl_ds = -1;
885 uint32 dcdc_core_cal_ds = -1;
886 uint32 dcdc_core_cal_adi = 0;
887 uint32 dcdc_core_ctl_adi = -1;
888 uint32 reg_val_cal = 0;
889 static uint32 step_cal = 3;
890 uint32 step_cal_flag = 0;
891 uint32 core_adi_val = 0;
892 uint32 reg_chip_id = 0;
894 reg_chip_id =(ANA_REG_GET(ANA_REG_GLB_CHIP_ID_HIGH) & 0xFFFF) << 16;
895 reg_chip_id |= (ANA_REG_GET(ANA_REG_GLB_CHIP_ID_LOW) & 0xFFFF);
897 #if defined(CONFIG_ARCH_SCX20L)
898 if(reg_chip_id == 0x2723a000) {
899 /*disable the DCDC_CORE_SLEEP_OUT_STEP for sc2723a000 otp no value*/
900 reg_val = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
902 core_adi_val |= reg_val << 5;
903 reg_val_cal = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
904 reg_val_cal &= 0x1F << 5;
905 core_adi_val |= reg_val_cal >> 5;
906 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, core_adi_val);
907 /*disable the DCDC_CORE_SLEEP_OUT_STEP for dcdc core step down */
908 ANA_REG_AND(ANA_REG_GLB_DCDC_SLP_CTRL0,~(0x3));
910 if(0x00000007 == ds_cfg.is_auto_ds) {
911 //ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, 0x13);
912 /*enable the DCDC_CORE_SLEEP_OUT_STEP for dcdc core step down */
913 ANA_REG_AND(ANA_REG_GLB_DCDC_SLP_CTRL0, ~(0x3));
915 /*SLEEP_VDDCORE equal NOMAL_VDDCORE*/
916 reg_val = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
918 core_adi_val |= reg_val << 5;
919 reg_val_cal = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
920 reg_val_cal &= 0x1F << 5;
921 core_adi_val |= reg_val_cal >> 5;
922 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, core_adi_val);
923 /*enable the DCDC_CORE_SLEEP_OUT_STEP for dcdc core step down */
924 //ANA_REG_OR(ANA_REG_GLB_DCDC_SLP_CTRL0, 0x3);
925 /*disable the DCDC_CORE_SLEEP_OUT_STEP */
926 ANA_REG_AND(ANA_REG_GLB_DCDC_SLP_CTRL0, ~(0x3));
930 static struct dcdc_core_ds_step_info step_info[5]={
931 {ANA_REG_GLB_DCDC_SLP_CTRL2, 0, ANA_REG_GLB_DCDC_SLP_CTRL4, 0},
932 {ANA_REG_GLB_DCDC_SLP_CTRL2, 5, ANA_REG_GLB_DCDC_SLP_CTRL4, 5},
933 {ANA_REG_GLB_DCDC_SLP_CTRL2, 10, ANA_REG_GLB_DCDC_SLP_CTRL4,10},
934 {ANA_REG_GLB_DCDC_SLP_CTRL3, 0, ANA_REG_GLB_DCDC_SLP_CTRL5, 0},
935 {ANA_REG_GLB_DCDC_SLP_CTRL3, 5, ANA_REG_GLB_DCDC_SLP_CTRL5, 5}
938 static char dcdc_core_down_volt[]={4,1,1,2,3,5,0,6};
939 static char dcdc_core_up_volt[]={6,2,3,4,0,1,7,7};
941 /*1100,700,800,900,1000,650,1200,1300*/
942 static uint32 step_ratio[]={8,8,4,4,4};
944 /*sleep dcdc cal transformer for sc2723*/
945 dcdc_core_cal_adi = (ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI)) & 0x1F;
946 /*step_cal = 3, so 3*3mV=9mV ~ 0.01V*/
947 dcdc_core_cal_ds = dcdc_core_cal_adi+step_cal;
949 if(dcdc_core_cal_ds >= 0x1F) {
950 /*if cal > 1,set step_cal_flag = 1,carry bit*/
951 dcdc_core_cal_ds = dcdc_core_cal_ds - 0x1F;
957 reg_val_cal = ANA_REG_GET(ANA_REG_GLB_DCDC_SLP_CTRL1);
958 reg_val_cal &= ~ ( 0x1F << 5);
959 reg_val_cal |= dcdc_core_cal_ds << 5;
961 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, reg_val_cal);
963 /*sleep dcdc ctl transformer for sc2723*/
964 dcdc_core_ctl_adi = (ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI) >> 5) & 0x1F;
965 if(0x1 == step_cal_flag) {
966 /*if step_cal_flag = 1,the ctl will first down and after up, so it no change*/
967 dcdc_core_ctl_ds = dcdc_core_ctl_adi;
970 dcdc_core_ctl_ds = dcdc_core_down_volt[dcdc_core_ctl_adi];
973 reg_val = ANA_REG_GET(ANA_REG_GLB_DCDC_SLP_CTRL1);
975 reg_val |= dcdc_core_ctl_ds;
977 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, reg_val);
979 dcdc_core_ctl_ds = ANA_REG_GET(ANA_REG_GLB_DCDC_SLP_CTRL1) & 0x1F;
980 dcdc_core_ctl_adi = (ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI) >> 5) & 0x1F;
981 dcdc_core_cal_adi = (ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI)) & 0x1F;
983 if(dcdc_core_ctl_ds < dcdc_core_ctl_adi){
985 reg_val = dcdc_core_cal_adi + step_ratio[i];
986 if(reg_val <= 0x1F) {
987 sci_adi_write(step_info[i].ctl_reg,dcdc_core_ctl_ds<<step_info[i].ctl_sht,0x1F <<step_info[i].ctl_sht);
988 sci_adi_write(step_info[i].cal_reg,reg_val<<step_info[i].cal_sht,0x1F << step_info[i].cal_sht);
989 dcdc_core_cal_adi = reg_val;
991 sci_adi_write(step_info[i].ctl_reg,dcdc_core_up_volt[dcdc_core_ctl_ds]<<step_info[i].ctl_sht,
992 0x1F << step_info[i].ctl_sht);
993 sci_adi_write(step_info[i].cal_reg,(reg_val-0x1F)<<step_info[i].cal_sht,0x1F << step_info[i].cal_sht);
994 dcdc_core_ctl_ds = dcdc_core_up_volt[dcdc_core_ctl_ds];
995 dcdc_core_cal_adi = reg_val - 0x1F;
1000 /*every step should equal function mode*/
1001 sci_adi_write(step_info[i].ctl_reg,dcdc_core_ctl_adi<<step_info[i].ctl_sht,0x1F << step_info[i].ctl_sht);
1002 sci_adi_write(step_info[i].cal_reg,dcdc_core_cal_adi<<step_info[i].cal_sht,0x1F << step_info[i].cal_sht);
1006 if(reg_chip_id == 0x2723a000) {
1007 /*disable the DCDC_CORE_SLEEP_OUT_STEP for sc2723a000 otp no value*/
1008 reg_val = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
1010 core_adi_val |= reg_val << 5;
1011 reg_val_cal = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
1012 reg_val_cal &= 0x1F << 5;
1013 core_adi_val |= reg_val_cal >> 5;
1014 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, core_adi_val);
1015 /*disable the DCDC_CORE_SLEEP_OUT_STEP for sc2723a000 otp no value*/
1016 ANA_REG_AND(ANA_REG_GLB_DCDC_SLP_CTRL0,~(0x3));
1018 if(0x00000007 == ds_cfg.is_auto_ds) {
1019 /*disable the DCDC_CORE_SLEEP_OUT_STEP for sc2723a000 otp no value*/
1020 reg_val = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
1022 core_adi_val |= reg_val << 5;
1023 reg_val_cal = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
1024 reg_val_cal &= 0x1F << 5;
1025 core_adi_val |= reg_val_cal >> 5;
1026 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, core_adi_val);
1027 /*enable the DCDC_CORE_SLEEP_OUT_STEP for dcdc core step down */
1028 ANA_REG_OR(ANA_REG_GLB_DCDC_SLP_CTRL0, 0x3);
1030 /*SLEEP_VDDCORE equal NOMAL_VDDCORE*/
1031 reg_val = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
1033 core_adi_val |= reg_val << 5;
1034 reg_val_cal = ANA_REG_GET(ANA_REG_GLB_DCDC_CORE_ADI);
1035 reg_val_cal &= 0x1F << 5;
1036 core_adi_val |= reg_val_cal >> 5;
1037 ANA_REG_SET(ANA_REG_GLB_DCDC_SLP_CTRL1, core_adi_val);
1038 /*enable the DCDC_CORE_SLEEP_OUT_STEP for dcdc core step down */
1039 //ANA_REG_OR(ANA_REG_GLB_DCDC_SLP_CTRL0, 0x3);
1041 /*disable the DCDC_CORE_SLEEP_OUT_STEP */
1042 ANA_REG_AND(ANA_REG_GLB_DCDC_SLP_CTRL0, ~(0x3));
1049 static void setup_ap_cp_sync_sleep_code(unsigned int start_addr)
1051 unsigned int *sa = (unsigned int*)start_addr;
1052 /*always on the pub sys power*/
1053 CHIP_REG_AND(REG_PMU_APB_PD_PUB_SYS_CFG,~(0x3 << 24));
1054 /*set for indcate phy is alive*/
1055 CHIP_REG_OR(DDR_PHY_IND_ADDR1,DDR_PHY_IND_PHY_ALIVE);
1056 /** set flag for indicate phy is alive*/
1057 CHIP_REG_OR(DDR_PHY_IND_ADDR,DDR_PHY_IND_PHY_ALIVE);
1058 /* set flag for indicate phy is alive*/
1059 *(volatile unsigned int*)DDR_PHY_IND_ADDR2 = DDR_PHY_IND_PHY_ALIVE;
1060 /*close umctl and phy and publ auto retention*/
1061 *(volatile unsigned int*)REG_PMU_APB_DDR_OP_MODE_CFG &= ~((0x3 << 27)|(0x1 << 25));
1064 void CSP_Init(unsigned int gen_para)
1066 unsigned int reg_val;
1067 setup_autopd_mode();
1068 pmu_commom_config();
1069 //calibrate_register_callback((void*)dcdc_core_ds_config);
1070 dcdc_core_ds_config(0x00000000);
1071 setup_ap_cp_sync_sleep_code(0x50001800);
1072 dcdc_optimize_config(0x00000000);
1073 /*open adi clock auto gate for power consume*/
1074 // reg_val = readl(ADI_GSSI_CTL0);
1075 // reg_val &= ~(0x1 << 30);
1076 // writel(reg_val,ADI_GSSI_CTL0);
1077 /*disable int ana dcd otp interrupt*/
1078 // ANA_REG_AND(REG_ANA_INTC_INT_EN,~BIT_DCDCOTP_INT_EN);
1080 /**---------------------------------------------------------------------------*
1082 **---------------------------------------------------------------------------*/