-
-
-
-
-
-
-
-
- #include
- #include
- #include
-
- #include "soc_cfg.h"
- #include "S5PC100_dramcon.h"
- #include "S5PC100_base_regs.h"
- #include "S5PC100_Syscon.h"
- #include "S5PC100_regs_for_BL.h"
-
- #ifdef SMDKC100_POP_NONE
- #define SMDKC100_POP POP_NONE
- #elif defined(SMDKC100_POP_A)
- #define SMDKC100_POP POP_A
- #elif defined(SMDKC100_POP_D)
- #define SMDKC100_POP POP_D
- #else
- #define SMDKC100_POP POP_NONE // Invalid POP type, set with POP_NONE.
- #endif
-
- #define LPCON_MAXPOWER 0
- #define LPCON_MAXPERFORMANCE 1
- #define LPCON_BALANCE 2
-
-
-
-
-
-
-
-
- #define LPCON_LEVEL LPCON_MAXPERFORMANCE // We only use max performance
-
- void InitClockCONforBL(void);
- void InitClockCONforOS(void);
- void InitLPCON(void);
-
- void InitClockCONforBL(void)
- {
- unsigned int ReadVal;
-
-
-
- SetReg32(rCLK_DIV1, ((HCLK12PCLK1_RATIO-1)<
- ((MPLL2HCLK1_RATIO-1)<
- (0<
- (0<
- (0<
-
-
-
-
-
- SetReg32(rCLK_DIV2, ((HCLK12PCLK1_RATIO-1)<<0));
-
-
- SetReg32(rCLK_DIV0, (1<<16)|((HCLK02PCLK0_RATIO_BL-1)<<12)|((ARM2HCLK0_RATIO_BL-1)<<8)|(0<<4)|((APLL2ARM_RATIO-1)<<0));
-
-
-
-
-
-
-
-
-
- SetReg32(rAPLL_LOCK, 0x00000e10);
-
- SetReg32(rAPLL_CON, (1u<<31)|(APLL_MDIV_BL<<16)|(APLL_PDIV_BL<<8)|(APLL_SDIV_BL<<0));
-
- SetReg32(rMPLL_LOCK, 0x00000e10);
-
- SetReg32(rMPLL_CON, (1u<<31)|(MPLL_MDIV<<16)|(MPLL_PDIV<<8)|(MPLL_SDIV<<0));
-
- SetReg32(rEPLL_LOCK, 0x00000e10);
- SetReg32(rEPLL_CON, (1u<<31)|(EPLL_MDIV<<16)|(EPLL_PDIV<<8)|(EPLL_SDIV<<0));
-
- GetReg32(rCLK_SRC0, ReadVal);
-
- SetReg32(rCLK_SRC0, (ReadVal&~(1<<20))|(0<<20));
-
- SetReg32(rHPLL_LOCK, 0x00000e10);
- SetReg32(rHPLL_CON, (1u<<31)|(HPLL_MDIV<<16)|(HPLL_PDIV<<8)|(HPLL_SDIV<<0));
-
-
- GetReg32(rCLK_SRC0, ReadVal);
- SetReg32(rCLK_SRC0, (ReadVal&~(0x11111))|(0<<16)|(1<<12)|(1<<8)|(1<<4)|(1<<0));
-
-
-
-
-
- SetReg32(rCLK_SRC1, (1<<24)|(1<<0));
-
-
-
-
-
-
- SetReg32(rCLK_OUT, (0<<20)|(6<<12));
-
-
-
- }
-
- void InitClockCONforOS(void)
- {
- unsigned int ReadVal;
-
-
- SetReg32(rCLK_DIV1, ((HCLK12PCLK1_RATIO-1)<
- ((MPLL2HCLK1_RATIO-1)<
- (0<
- (0<
- (0<
-
-
-
-
- SetReg32(rCLK_DIV2, ((HCLK12PCLK1_RATIO-1)<<0));
-
-
-
- SetReg32(rAPLL_LOCK, 0x00000e10);
- SetReg32(rAPLL_CON, (1u<<31)|(APLL_MDIV<<16)|(APLL_PDIV<<8)|(APLL_SDIV<<0));
-
- SetReg32(rCLK_DIV0, (1<<16)|((HCLK02PCLK0_RATIO-1)<<12)|((ARM2HCLK0_RATIO-1)<<8)|(0<<4)|((APLL2ARM_RATIO-1)<<0));
-
-
-
-
-
-
-
-
- SetReg32(rMPLL_LOCK, 0x00000e10);
- SetReg32(rMPLL_CON, (1u<<31)|(MPLL_MDIV<<16)|(MPLL_PDIV<<8)|(MPLL_SDIV<<0));
-
- SetReg32(rEPLL_LOCK, 0x00000e10);
- SetReg32(rEPLL_CON, (1u<<31)|(EPLL_MDIV<<16)|(EPLL_PDIV<<8)|(EPLL_SDIV<<0));
-
- GetReg32(rCLK_SRC0, ReadVal);
- SetReg32(rCLK_SRC0, (ReadVal&~(1<<20))|(0<<20));
- SetReg32(rHPLL_LOCK, 0x00000e10);
- SetReg32(rHPLL_CON, (1u<<31)|(HPLL_MDIV<<16)|(HPLL_PDIV<<8)|(HPLL_SDIV<<0));
-
-
- GetReg32(rCLK_SRC0, ReadVal);
- SetReg32(rCLK_SRC0, (ReadVal&~(0x11111))|(0<<16)|(1<<12)|(1<<8)|(1<<4)|(1<<0));
-
-
-
-
-
- SetReg32(rCLK_SRC1, (1<<24)|(1<<0));
-
-
-
-
-
-
- SetReg32(rCLK_OUT, (0<<20)|(9<<12));
-
-
-
- }
-
-
-
- void InitLPCON()
- {
- UINT32 ReadVal;
- UINT32 ReadValStat;
- #if INIT_QoS
- volatile unsigned int *rTMP;
- #endif
-
-
-
-
-
- #if ENABLE_PHY_DLL // Now, we use ENABLE_PHY_DLL
- SetReg32(rLPCON_PHY_CONTROL0, 0x50101008);
-
-
-
-
-
-
-
-
-
-
- SetReg32(rLPCON_PHY_CONTROL1, 0xf6<<0);
-
- SetReg32(rLPCON_PHY_CONTROL2, 0<<24|0<<16|0<<8|0<<0);
-
- GetReg32(rLPCON_PHY_CONTROL0, ReadVal);
- SetReg32(rLPCON_PHY_CONTROL0, ReadVal|=(1<<1));
- SetReg32(rLPCON_PHY_CONTROL0, ReadVal|=(1<<0));
-
- do
- {
- GetReg32(rLPCON_PHY_STATUS0, ReadVal);
- } while ((ReadVal&0x4) != 0x4);
-
- GetReg32(rLPCON_PHY_STATUS0, ReadValStat);
- ReadValStat = (ReadValStat>>6)&0xff;
-
- GetReg32(rLPCON_PHY_CONTROL0, ReadVal);
- ReadVal &= ~(0xff<<24);
- SetReg32(rLPCON_PHY_CONTROL0, ReadVal|=(ReadValStat<<24));
- SetReg32(rLPCON_PHY_CONTROL0, ReadVal&=~(1<<1));
- #endif
-
-
-
-
-
- SetReg32(rLPCON_CON_CONTROL, 0xFF001010);
-
-
-
-
-
-
-
-
-
-
-
-
-
- SetReg32(rLPCON_MEM_CONTROL, 0x00212400);
-
-
-
-
-
-
-
-
-
-
-
- #if (SMDKC100_POP == POP_A)
- SetReg32(rLPCON_MEM_CONFIG0, 0x28<<24|0xf8<<16|0<<12|2<<8|2<<4|2<<0);
- SetReg32(rLPCON_MEM_CONFIG1, 0x20<<24|0xf8<<16|1<<12|2<<8|2<<4|2<<0);
- #elif (SMDKC100_POP == POP_D)
- SetReg32(rLPCON_MEM_CONFIG0, 0x30<<24|0xf0<<16|1<<12|3<<8|1<<4|2<<0);
- SetReg32(rLPCON_MEM_CONFIG1, 0x20<<24|0xf0<<16|1<<12|3<<8|2<<4|2<<0);
- #elif (SMDKC100_POP == POP_NONE)
- SetReg32(rLPCON_MEM_CONFIG0, 0x20F00313);
-
- SetReg32(rLPCON_MEM_CONFIG1, 0x40F00313);
-
- #else
- #error // Invalid POP type
- #endif
-
-
-
-
-
-
- SetReg32(rLPCON_PRECH_CONFIG, 0x20<<24|0<<8|0<<0);
-
-
-
-
-
-
-
-
-
-
- SetReg32(rLPCON_TIMING_AREF, 0x50e);
-
-
-
- SetReg32(rLPCON_TIMING_ROW, 0x16233288);
-
-
-
-
-
-
-
- SetReg32(rLPCON_TIMING_DATA, 0x23260304);
-
-
-
-
-
-
-
- SetReg32(rLPCON_TIMING_POWER, 0x09C80232);
-
-
-
-
-
-
-
- #if INIT_QoS
-
-
-
- rTMP = rLPCON_QOS_CONTROL0;
- for (ReadVal=0; ReadVal<8; rTMP++)
- SetReg32(rTMP, 0x00ff0000);
- rTMP = rLPCON_QOS_CONFIG0;
- for (ReadVal=0; ReadVal<8; rTMP++)
- SetReg32(rTMP, 0x00000000);
- #endif
-
-
-
-
-
-
-
-
-
- SetReg32(rLPCON_DIRECT_CMD, 7<<24);
- SetReg32(rLPCON_DIRECT_CMD, 1<<24);
- SetReg32(rLPCON_DIRECT_CMD, 0x02<<16);
- SetReg32(rLPCON_DIRECT_CMD, 0x03<<16);
- SetReg32(rLPCON_DIRECT_CMD, 1<<16 | 4<<8);
- SetReg32(rLPCON_DIRECT_CMD, 0x762<<0);
- SetReg32(rLPCON_DIRECT_CMD, 1<<24);
- SetReg32(rLPCON_DIRECT_CMD, 5<<24);
- SetReg32(rLPCON_DIRECT_CMD, 5<<24);
- SetReg32(rLPCON_DIRECT_CMD, 0x662<<0);
- SetReg32(rLPCON_DIRECT_CMD, 0x10780<<0);
- SetReg32(rLPCON_DIRECT_CMD, 0x01<<16 | 4<<8);
-
-
-
- SetReg32(rLPCON_DIRECT_CMD, 7<<24 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 1<<24 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x02<<16 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x03<<16 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x104<<8 | 4<<8 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x762<<0 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 1<<24 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x51<<20 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x51<<20 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x662<<20 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x117080<<0 | 1<<20);
- SetReg32(rLPCON_DIRECT_CMD, 0x110400<<0 | 1<<20);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SetReg32(rLPCON_CON_CONTROL, 0x0FF01030);
-
-
- SetReg32(rLPCON_PWRDN_CONFIG, 0x10<<16|4);
-
-
-
-
- SetReg32(rLPCON_MEM_CONTROL, 0x00212400);
-
- }
阅读(2695) | 评论(0) | 转发(0) |