1 /******************************************************************************
2 ** File Name: sdram_prod.c *
5 ** Copyright: 2008 Spreadtrum, Incoporated. All Rights Reserved. *
6 ** Description: This file defines the product configurable parameters of *
9 ******************************************************************************
11 ******************************************************************************
13 ** ------------------------------------------------------------------------- *
14 ** DATE NAME DESCRIPTION *
15 ** 04/18/2008 Create. *
16 ******************************************************************************/
18 /**---------------------------------------------------------------------------*
20 **---------------------------------------------------------------------------*/
21 #include <asm/arch/sci_types.h>
22 #include <asm/arch/sdram_cfg.h>
24 /**---------------------------------------------------------------------------*
26 **---------------------------------------------------------------------------*/
30 /**---------------------------------------------------------------------------*
32 **---------------------------------------------------------------------------*/
38 /*********************************************************************************/
40 /*********************************************************************************/
42 #if defined (BB_DRAM_TYPE_32MB_16BIT)
43 #define SDRAM_ROW_MODE ROW_MODE_13
44 #define SDRAM_COL_MODE COL_MODE_9
45 #define SDRAM_DATA_WIDTH DATA_WIDTH_16
46 #define SDRAM_SIZE SDRAM_32M
48 #elif defined(BB_DRAM_TYPE_32MB_32BIT_13R)
49 #define SDRAM_ROW_MODE ROW_MODE_13
50 #define SDRAM_COL_MODE COL_MODE_8
51 #define SDRAM_DATA_WIDTH DATA_WIDTH_32
52 #define SDRAM_SIZE SDRAM_32M
54 #elif defined(BB_DRAM_TYPE_32MB_32BIT_12R)
55 #define SDRAM_ROW_MODE ROW_MODE_12
56 #define SDRAM_COL_MODE COL_MODE_9
57 #define SDRAM_DATA_WIDTH DATA_WIDTH_32
58 #define SDRAM_SIZE SDRAM_32M
60 #elif defined(BB_DRAM_TYPE_64MB_16BIT)
61 #define SDRAM_ROW_MODE ROW_MODE_13
62 #define SDRAM_COL_MODE COL_MODE_10
63 #define SDRAM_DATA_WIDTH DATA_WIDTH_16
64 #define SDRAM_SIZE SDRAM_64M
66 #elif defined(BB_DRAM_TYPE_64MB_32BIT)
67 #define SDRAM_ROW_MODE ROW_MODE_13
68 #define SDRAM_COL_MODE COL_MODE_9
69 #define SDRAM_DATA_WIDTH DATA_WIDTH_32
70 #define SDRAM_SIZE SDRAM_64M
72 #elif defined(BB_DRAM_TYPE_128MB_16BIT)
73 #define SDRAM_ROW_MODE ROW_MODE_14
74 #define SDRAM_COL_MODE COL_MODE_10
75 #define SDRAM_DATA_WIDTH DATA_WIDTH_16
76 #define SDRAM_SIZE SDRAM_128M
78 #elif defined(BB_DRAM_TYPE_128MB_32BIT)
79 #define SDRAM_ROW_MODE ROW_MODE_13
80 #define SDRAM_COL_MODE COL_MODE_10
81 #define SDRAM_DATA_WIDTH DATA_WIDTH_32
82 #define SDRAM_SIZE SDRAM_128M
84 #elif defined(BB_DRAM_TYPE_256MB_32BIT)
85 #define SDRAM_ROW_MODE ROW_MODE_14
86 #define SDRAM_COL_MODE COL_MODE_10
87 #define SDRAM_DATA_WIDTH DATA_WIDTH_32
88 #define SDRAM_SIZE SDRAM_256M
91 #error do not select size and bit width for SDRAM
94 #define BK_MODE BK_MODE_4
96 #if defined(PLATFORM_SC8800H)
97 #define BURST_LEN BURST_LEN_8
98 #elif defined(PLATFORM_SC6800H)
99 #define BURST_LEN BURST_LEN_2
100 #elif defined(PLATFORM_SC8800G)
101 #define BURST_LEN BURST_LEN_2
102 #elif defined(CONFIG_SC8810)
103 #define BURST_LEN BURST_LEN_2
104 #elif defined(CONFIG_TIGER)
105 #define BURST_LEN BURST_LEN_2
107 #error do not select burst len for SDRAM
110 #define CAS_LATENCY CAS_LATENCY_3
112 // Include Product config
113 #include "sdram_cfg.c"
115 /**---------------------------------------------------------------------------*
117 **---------------------------------------------------------------------------*/
118 /*******************************************************************************/
119 // sdram_parameters[] is used to config SDRAM controller according to variable
120 //sdram. The unit is ns. The end of array is marked with 0xffffffff at the last element.
121 /*******************************************************************************/
122 LOCAL CONST SDRAM_TIMING_PARA_T s_sdram_timing_param =
123 // ms ns ns ns ns ns ns ns clk clk
124 // tREF, tRP, tRCD, tWR/tRDL/tDPL,tRFC,tXSR, tRAS,tRRD,tMRD, tWTR(wtr is only for ddr)
125 {64, 30, 30, 20, 110, 150, 60, 20, 2, 2 };
127 /*******************************************************************************/
128 // sdram_cofig_info is used to config sdram controller when to init sdram
129 /*******************************************************************************/
130 LOCAL CONST SDRAM_CFG_INFO_T s_sdram_config_info =
138 SDRAM_EXT_MODE_VALUE,
142 /**---------------------------------------------------------------------------*
143 ** Public Function Prototypes *
144 **---------------------------------------------------------------------------*/
145 /*****************************************************************************/
146 // Description: This function get sdram config pointer
149 /*****************************************************************************/
150 PUBLIC SDRAM_CFG_INFO_T_PTR SDRAM_GetCfg(void)
152 return (SDRAM_CFG_INFO_T_PTR)&s_sdram_config_info;
155 /*****************************************************************************/
156 // Description: This function get sdram timing parameter pointer
157 // Author: Liangwen.Zhen
159 /*****************************************************************************/
160 PUBLIC SDRAM_TIMING_PARA_T_PTR SDRAM_GetTimingPara(void)
162 return (SDRAM_TIMING_PARA_T_PTR)&s_sdram_timing_param;
165 /*****************************************************************************/
166 // Description: This function can be defined by user if needed. It will be called
167 // before the SDRAM initialization.
170 /*****************************************************************************/
171 PUBLIC void Userdef_before_sdram_init(void)
175 /*****************************************************************************/
176 // Description: This function can be defined by user if needed. It will be called
177 // after the SDRAM initialization.
180 /*****************************************************************************/
181 PUBLIC void Userdef_after_sdram_init(void)
186 /**---------------------------------------------------------------------------*
188 **---------------------------------------------------------------------------*/