tizen 2.4 release
[kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8800x / sdram_cfg.h
1 #ifndef _SDRAM_CFG_H_
2 #define _SDRAM_CFG_H_
3
4 /* The SDRAM size parameters supports */
5 #define     SDRAM_8M       0
6 #define     SDRAM_16M      1
7 #define     SDRAM_32M      2
8 #define     SDRAM_64M      3
9
10 #define     BK_MODE_1               0           //1 bank sdram
11 #define     BK_MODE_2               1           //2 bank sdram          
12 #define     BK_MODE_4               2           //4 bank sdram
13 #define     BK_MODE_8               3           //8 bank sdram
14
15 #define     ROW_MODE_11             0           // 11 row sdram
16 #define     ROW_MODE_12             1           // 12 row sdram
17 #define     ROW_MODE_13             2           // 13 row sdram
18
19 #define     COL_MODE_8              0           //8 column sdram
20 #define     COL_MODE_9              1           //9 column sdram
21 #define     COL_MODE_10             2           //10 column sdram
22 #define     COL_MODE_11             3           //11 column sdram
23 #define     COL_MODE_12             4           //12 column sdram
24
25 #define     DATA_WIDTH_16          16           //16 bit sdram
26 #define     DATA_WIDTH_32          32           //32 bit sdram
27
28 #define     BURST_LEN_2             1           // 2 words burst
29 #define     BURST_LEN_4             2           // 4 words burst
30 #define     BURST_LEN_8             3           // 8 words burst
31 #define     BURST_LEN_16            4           // 16 words burst
32 #define     BURST_LEN_FULLPAGE      7           // full page burst
33
34 #define     CAS_LATENCY_1           1           // 1 cycle cas latency
35 #define     CAS_LATENCY_2           2           // 2 cycle cas latency
36 #define     CAS_LATENCY_3           3           // 3 cycle cas latency
37
38 /* Extend mode register value supports*/
39 #define     SDRAM_EXT_MODE_INVALID     0xffffffff
40
41 #define     SDRAM_TIMING_PARA_NUM       10
42
43 /* Clock delay value SC6600I supports */
44 #define     SC6600I_SDRAM_CLK_DLY_VAL1    0x1110
45 #define     SC6600I_SDRAM_CLK_DLY_VAL2    0x1210
46 #define     SC6600I_SDRAM_CLK_DLY_VAL3    0x1310
47 #define     SC6600I_SDRAM_CLK_DLY_VAL4    0x1410//6600I dvb can use this value run @96MHZ
48
49 /* Clock delay value SC6600R supports */
50 #define     SC6600R_SDRAM_CLK_DLY_VAL1    0x2120
51 #define     SC6600R_SDRAM_CLK_DLY_VAL2    0x2220
52 #define     SC6600R_SDRAM_CLK_DLY_VAL3    0x2320
53 #define     SC6600R_SDRAM_CLK_DLY_VAL4    0x2320
54
55 /* Clock delay value supports for 6800*/
56 #define     DCLK_OUT_DLY_0X04           0x4
57 #define     DCLK_OUT_DLY_0X1D           0x1D
58 #define     DCLK_OUT_DLY_0X1E           0x1E
59
60 #define     DCLK_IN_DLY_0X09            0x9
61 #define     DCLK_IN_DLY_0X13            0x13
62 #define     DCLK_IN_DLY_0X14            0x14
63
64 //for 6800 DVB platform, config goes like this:
65 #define     DVB_DCLK_OUT_DLY_0X05       0x5
66 #define     DVB_DCLK_OUT_DLY_0X06       0x6
67
68 #define     DVB_DCLK_IN_DLY_0X0A        0xa
69 #define     DVB_DCLK_IN_DLY_0X0B        0xb
70     
71
72 /* The sdram configuration struct */
73 typedef struct {
74         uint32_t  bank_mode;    //Can only be set as BK_MODE_1,BK_MODE_2,BK_MODE_4,BK_MODE_8
75         uint32_t  row_mode;     //Can only be set as ROW_MODE_11,ROW_MODE_12,ROW_MODE_13
76         uint32_t  col_mode;     //Can only be set as COL_MODE_8,COL_MODE_9,COL_MODE_10,COL_MODE_11,COL_MODE_12
77         uint32_t  data_width;   //Can only be set as DATA_WIDTH_16,DATA_WIDTH_32
78         uint32_t  burst_length; //Can only be set as BURST_LEN_2,BURST_LEN_4,BURST_LEN_8,BURST_LEN_16,BURST_LEN_FULLPAGE
79         uint32_t  cas_latency;  //Can only be set as CAS_LATENCY_1,CAS_LATENCY_2,CAS_LATENCY_3
80         uint32_t  ext_mode_val; /* User can config extend mode register in SDRAM. If it is not used, SDRAM_EXT_INVALID
81                                           is adopted. */
82         uint32_t        sdram_size;            /* Can only be set as SDRAM_8M, SDRAM_16M, SDRAM_32M or SDRAM_64M */
83         uint32_t  clk_dly;             /* The clk_dly register's value. The most likely value is 0x1011, 0x1012, 0x1013 */      
84 } sdram_cfg_t;
85
86 typedef struct
87 {
88         uint32_t row_ref_max;           //ROW_REFRESH_TIME,Refresh interval time , ns, tREF-max = 7800 ns
89         uint32_t row_pre_min;           //ROW_PRECHARGE_TIME , ns, tRP-min = 27 ns.                      
90         uint32_t row_cyc_min;           //ROW_CYCLE_TIME
91         uint32_t rcd_min;       // T_RCD,ACTIVE to READ or WRITE delay  , ns, tRCD-min = 27 ns  
92         uint32_t wr_min;        // T_WR  ,WRITE recovery time  , ns, tWR-min = 15 ns.            
93         uint32_t mrd_min;       //T_MRD , 2 cycles, tMRD-min = 2 cycles.                        
94         uint32_t rfc_min;       //T_RFC, AUTO REFRESH command period , ns, tRFC-min = 80 ns.    
95         uint32_t xsr_min;       //T_XSR  , ns, tXSR-min = 120 ns.                               
96         uint32_t ras_min;       //T_RAS_MIN , row active time, ns, tRAS-min = 50ns              
97 }sdram_timing_t;
98 extern void sdram_init(uint32_t ahb_clk);
99 #endif /* SDRAM_CFG_H */