diff options
Diffstat (limited to 'arch/blackfin/mach-bf561/include/mach/mem_init.h')
-rw-r--r-- | arch/blackfin/mach-bf561/include/mach/mem_init.h | 295 |
1 files changed, 295 insertions, 0 deletions
diff --git a/arch/blackfin/mach-bf561/include/mach/mem_init.h b/arch/blackfin/mach-bf561/include/mach/mem_init.h new file mode 100644 index 000000000000..e163260bca18 --- /dev/null +++ b/arch/blackfin/mach-bf561/include/mach/mem_init.h | |||
@@ -0,0 +1,295 @@ | |||
1 | /* | ||
2 | * File: include/asm-blackfin/mach-bf561/mem_init.h | ||
3 | * Based on: | ||
4 | * Author: | ||
5 | * | ||
6 | * Created: | ||
7 | * Description: | ||
8 | * | ||
9 | * Rev: | ||
10 | * | ||
11 | * Modified: | ||
12 | * | ||
13 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2, or (at your option) | ||
18 | * any later version. | ||
19 | * | ||
20 | * This program is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | * GNU General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; see the file COPYING. | ||
27 | * If not, write to the Free Software Foundation, | ||
28 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
31 | #if (CONFIG_MEM_MT48LC16M16A2TG_75 || CONFIG_MEM_MT48LC64M4A2FB_7E || CONFIG_MEM_GENERIC_BOARD || CONFIG_MEM_MT48LC8M32B2B5_7) | ||
32 | #if (CONFIG_SCLK_HZ > 119402985) | ||
33 | #define SDRAM_tRP TRP_2 | ||
34 | #define SDRAM_tRP_num 2 | ||
35 | #define SDRAM_tRAS TRAS_7 | ||
36 | #define SDRAM_tRAS_num 7 | ||
37 | #define SDRAM_tRCD TRCD_2 | ||
38 | #define SDRAM_tWR TWR_2 | ||
39 | #endif | ||
40 | #if (CONFIG_SCLK_HZ > 104477612) && (CONFIG_SCLK_HZ <= 119402985) | ||
41 | #define SDRAM_tRP TRP_2 | ||
42 | #define SDRAM_tRP_num 2 | ||
43 | #define SDRAM_tRAS TRAS_6 | ||
44 | #define SDRAM_tRAS_num 6 | ||
45 | #define SDRAM_tRCD TRCD_2 | ||
46 | #define SDRAM_tWR TWR_2 | ||
47 | #endif | ||
48 | #if (CONFIG_SCLK_HZ > 89552239) && (CONFIG_SCLK_HZ <= 104477612) | ||
49 | #define SDRAM_tRP TRP_2 | ||
50 | #define SDRAM_tRP_num 2 | ||
51 | #define SDRAM_tRAS TRAS_5 | ||
52 | #define SDRAM_tRAS_num 5 | ||
53 | #define SDRAM_tRCD TRCD_2 | ||
54 | #define SDRAM_tWR TWR_2 | ||
55 | #endif | ||
56 | #if (CONFIG_SCLK_HZ > 74626866) && (CONFIG_SCLK_HZ <= 89552239) | ||
57 | #define SDRAM_tRP TRP_2 | ||
58 | #define SDRAM_tRP_num 2 | ||
59 | #define SDRAM_tRAS TRAS_4 | ||
60 | #define SDRAM_tRAS_num 4 | ||
61 | #define SDRAM_tRCD TRCD_2 | ||
62 | #define SDRAM_tWR TWR_2 | ||
63 | #endif | ||
64 | #if (CONFIG_SCLK_HZ > 66666667) && (CONFIG_SCLK_HZ <= 74626866) | ||
65 | #define SDRAM_tRP TRP_2 | ||
66 | #define SDRAM_tRP_num 2 | ||
67 | #define SDRAM_tRAS TRAS_3 | ||
68 | #define SDRAM_tRAS_num 3 | ||
69 | #define SDRAM_tRCD TRCD_2 | ||
70 | #define SDRAM_tWR TWR_2 | ||
71 | #endif | ||
72 | #if (CONFIG_SCLK_HZ > 59701493) && (CONFIG_SCLK_HZ <= 66666667) | ||
73 | #define SDRAM_tRP TRP_1 | ||
74 | #define SDRAM_tRP_num 1 | ||
75 | #define SDRAM_tRAS TRAS_4 | ||
76 | #define SDRAM_tRAS_num 3 | ||
77 | #define SDRAM_tRCD TRCD_1 | ||
78 | #define SDRAM_tWR TWR_2 | ||
79 | #endif | ||
80 | #if (CONFIG_SCLK_HZ > 44776119) && (CONFIG_SCLK_HZ <= 59701493) | ||
81 | #define SDRAM_tRP TRP_1 | ||
82 | #define SDRAM_tRP_num 1 | ||
83 | #define SDRAM_tRAS TRAS_3 | ||
84 | #define SDRAM_tRAS_num 3 | ||
85 | #define SDRAM_tRCD TRCD_1 | ||
86 | #define SDRAM_tWR TWR_2 | ||
87 | #endif | ||
88 | #if (CONFIG_SCLK_HZ > 29850746) && (CONFIG_SCLK_HZ <= 44776119) | ||
89 | #define SDRAM_tRP TRP_1 | ||
90 | #define SDRAM_tRP_num 1 | ||
91 | #define SDRAM_tRAS TRAS_2 | ||
92 | #define SDRAM_tRAS_num 2 | ||
93 | #define SDRAM_tRCD TRCD_1 | ||
94 | #define SDRAM_tWR TWR_2 | ||
95 | #endif | ||
96 | #if (CONFIG_SCLK_HZ <= 29850746) | ||
97 | #define SDRAM_tRP TRP_1 | ||
98 | #define SDRAM_tRP_num 1 | ||
99 | #define SDRAM_tRAS TRAS_1 | ||
100 | #define SDRAM_tRAS_num 1 | ||
101 | #define SDRAM_tRCD TRCD_1 | ||
102 | #define SDRAM_tWR TWR_2 | ||
103 | #endif | ||
104 | #endif | ||
105 | |||
106 | #if (CONFIG_MEM_MT48LC16M16A2TG_75) | ||
107 | /*SDRAM INFORMATION: */ | ||
108 | #define SDRAM_Tref 64 /* Refresh period in milliseconds */ | ||
109 | #define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ | ||
110 | #define SDRAM_CL CL_3 | ||
111 | #endif | ||
112 | |||
113 | #if (CONFIG_MEM_MT48LC64M4A2FB_7E) | ||
114 | /*SDRAM INFORMATION: */ | ||
115 | #define SDRAM_Tref 64 /* Refresh period in milliseconds */ | ||
116 | #define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ | ||
117 | #define SDRAM_CL CL_3 | ||
118 | #endif | ||
119 | |||
120 | #if (CONFIG_MEM_MT48LC8M32B2B5_7) | ||
121 | /*SDRAM INFORMATION: */ | ||
122 | #define SDRAM_Tref 64 /* Refresh period in milliseconds */ | ||
123 | #define SDRAM_NRA 4096 /* Number of row addresses in SDRAM */ | ||
124 | #define SDRAM_CL CL_3 | ||
125 | #endif | ||
126 | |||
127 | #if (CONFIG_MEM_GENERIC_BOARD) | ||
128 | /*SDRAM INFORMATION: Modify this for your board */ | ||
129 | #define SDRAM_Tref 64 /* Refresh period in milliseconds */ | ||
130 | #define SDRAM_NRA 8192 /* Number of row addresses in SDRAM */ | ||
131 | #define SDRAM_CL CL_3 | ||
132 | #endif | ||
133 | |||
134 | /* Equation from section 17 (p17-46) of BF533 HRM */ | ||
135 | #define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) | ||
136 | |||
137 | /* Enable SCLK Out */ | ||
138 | #define mem_SDGCTL (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS) | ||
139 | |||
140 | #if defined CONFIG_CLKIN_HALF | ||
141 | #define CLKIN_HALF 1 | ||
142 | #else | ||
143 | #define CLKIN_HALF 0 | ||
144 | #endif | ||
145 | |||
146 | #if defined CONFIG_PLL_BYPASS | ||
147 | #define PLL_BYPASS 1 | ||
148 | #else | ||
149 | #define PLL_BYPASS 0 | ||
150 | #endif | ||
151 | |||
152 | /***************************************Currently Not Being Used *********************************/ | ||
153 | #define flash_EBIU_AMBCTL_WAT ((CONFIG_FLASH_SPEED_BWAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1 | ||
154 | #define flash_EBIU_AMBCTL_RAT ((CONFIG_FLASH_SPEED_BRAT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1 | ||
155 | #define flash_EBIU_AMBCTL_HT ((CONFIG_FLASH_SPEED_BHT * 4) / (4000000000 / CONFIG_SCLK_HZ)) | ||
156 | #define flash_EBIU_AMBCTL_ST ((CONFIG_FLASH_SPEED_BST * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1 | ||
157 | #define flash_EBIU_AMBCTL_TT ((CONFIG_FLASH_SPEED_BTT * 4) / (4000000000 / CONFIG_SCLK_HZ)) + 1 | ||
158 | |||
159 | #if (flash_EBIU_AMBCTL_TT > 3) | ||
160 | #define flash_EBIU_AMBCTL0_TT B0TT_4 | ||
161 | #endif | ||
162 | #if (flash_EBIU_AMBCTL_TT == 3) | ||
163 | #define flash_EBIU_AMBCTL0_TT B0TT_3 | ||
164 | #endif | ||
165 | #if (flash_EBIU_AMBCTL_TT == 2) | ||
166 | #define flash_EBIU_AMBCTL0_TT B0TT_2 | ||
167 | #endif | ||
168 | #if (flash_EBIU_AMBCTL_TT < 2) | ||
169 | #define flash_EBIU_AMBCTL0_TT B0TT_1 | ||
170 | #endif | ||
171 | |||
172 | #if (flash_EBIU_AMBCTL_ST > 3) | ||
173 | #define flash_EBIU_AMBCTL0_ST B0ST_4 | ||
174 | #endif | ||
175 | #if (flash_EBIU_AMBCTL_ST == 3) | ||
176 | #define flash_EBIU_AMBCTL0_ST B0ST_3 | ||
177 | #endif | ||
178 | #if (flash_EBIU_AMBCTL_ST == 2) | ||
179 | #define flash_EBIU_AMBCTL0_ST B0ST_2 | ||
180 | #endif | ||
181 | #if (flash_EBIU_AMBCTL_ST < 2) | ||
182 | #define flash_EBIU_AMBCTL0_ST B0ST_1 | ||
183 | #endif | ||
184 | |||
185 | #if (flash_EBIU_AMBCTL_HT > 2) | ||
186 | #define flash_EBIU_AMBCTL0_HT B0HT_3 | ||
187 | #endif | ||
188 | #if (flash_EBIU_AMBCTL_HT == 2) | ||
189 | #define flash_EBIU_AMBCTL0_HT B0HT_2 | ||
190 | #endif | ||
191 | #if (flash_EBIU_AMBCTL_HT == 1) | ||
192 | #define flash_EBIU_AMBCTL0_HT B0HT_1 | ||
193 | #endif | ||
194 | #if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT == 0) | ||
195 | #define flash_EBIU_AMBCTL0_HT B0HT_0 | ||
196 | #endif | ||
197 | #if (flash_EBIU_AMBCTL_HT == 0 && CONFIG_FLASH_SPEED_BHT != 0) | ||
198 | #define flash_EBIU_AMBCTL0_HT B0HT_1 | ||
199 | #endif | ||
200 | |||
201 | #if (flash_EBIU_AMBCTL_WAT > 14) | ||
202 | #define flash_EBIU_AMBCTL0_WAT B0WAT_15 | ||
203 | #endif | ||
204 | #if (flash_EBIU_AMBCTL_WAT == 14) | ||
205 | #define flash_EBIU_AMBCTL0_WAT B0WAT_14 | ||
206 | #endif | ||
207 | #if (flash_EBIU_AMBCTL_WAT == 13) | ||
208 | #define flash_EBIU_AMBCTL0_WAT B0WAT_13 | ||
209 | #endif | ||
210 | #if (flash_EBIU_AMBCTL_WAT == 12) | ||
211 | #define flash_EBIU_AMBCTL0_WAT B0WAT_12 | ||
212 | #endif | ||
213 | #if (flash_EBIU_AMBCTL_WAT == 11) | ||
214 | #define flash_EBIU_AMBCTL0_WAT B0WAT_11 | ||
215 | #endif | ||
216 | #if (flash_EBIU_AMBCTL_WAT == 10) | ||
217 | #define flash_EBIU_AMBCTL0_WAT B0WAT_10 | ||
218 | #endif | ||
219 | #if (flash_EBIU_AMBCTL_WAT == 9) | ||
220 | #define flash_EBIU_AMBCTL0_WAT B0WAT_9 | ||
221 | #endif | ||
222 | #if (flash_EBIU_AMBCTL_WAT == 8) | ||
223 | #define flash_EBIU_AMBCTL0_WAT B0WAT_8 | ||
224 | #endif | ||
225 | #if (flash_EBIU_AMBCTL_WAT == 7) | ||
226 | #define flash_EBIU_AMBCTL0_WAT B0WAT_7 | ||
227 | #endif | ||
228 | #if (flash_EBIU_AMBCTL_WAT == 6) | ||
229 | #define flash_EBIU_AMBCTL0_WAT B0WAT_6 | ||
230 | #endif | ||
231 | #if (flash_EBIU_AMBCTL_WAT == 5) | ||
232 | #define flash_EBIU_AMBCTL0_WAT B0WAT_5 | ||
233 | #endif | ||
234 | #if (flash_EBIU_AMBCTL_WAT == 4) | ||
235 | #define flash_EBIU_AMBCTL0_WAT B0WAT_4 | ||
236 | #endif | ||
237 | #if (flash_EBIU_AMBCTL_WAT == 3) | ||
238 | #define flash_EBIU_AMBCTL0_WAT B0WAT_3 | ||
239 | #endif | ||
240 | #if (flash_EBIU_AMBCTL_WAT == 2) | ||
241 | #define flash_EBIU_AMBCTL0_WAT B0WAT_2 | ||
242 | #endif | ||
243 | #if (flash_EBIU_AMBCTL_WAT == 1) | ||
244 | #define flash_EBIU_AMBCTL0_WAT B0WAT_1 | ||
245 | #endif | ||
246 | |||
247 | #if (flash_EBIU_AMBCTL_RAT > 14) | ||
248 | #define flash_EBIU_AMBCTL0_RAT B0RAT_15 | ||
249 | #endif | ||
250 | #if (flash_EBIU_AMBCTL_RAT == 14) | ||
251 | #define flash_EBIU_AMBCTL0_RAT B0RAT_14 | ||
252 | #endif | ||
253 | #if (flash_EBIU_AMBCTL_RAT == 13) | ||
254 | #define flash_EBIU_AMBCTL0_RAT B0RAT_13 | ||
255 | #endif | ||
256 | #if (flash_EBIU_AMBCTL_RAT == 12) | ||
257 | #define flash_EBIU_AMBCTL0_RAT B0RAT_12 | ||
258 | #endif | ||
259 | #if (flash_EBIU_AMBCTL_RAT == 11) | ||
260 | #define flash_EBIU_AMBCTL0_RAT B0RAT_11 | ||
261 | #endif | ||
262 | #if (flash_EBIU_AMBCTL_RAT == 10) | ||
263 | #define flash_EBIU_AMBCTL0_RAT B0RAT_10 | ||
264 | #endif | ||
265 | #if (flash_EBIU_AMBCTL_RAT == 9) | ||
266 | #define flash_EBIU_AMBCTL0_RAT B0RAT_9 | ||
267 | #endif | ||
268 | #if (flash_EBIU_AMBCTL_RAT == 8) | ||
269 | #define flash_EBIU_AMBCTL0_RAT B0RAT_8 | ||
270 | #endif | ||
271 | #if (flash_EBIU_AMBCTL_RAT == 7) | ||
272 | #define flash_EBIU_AMBCTL0_RAT B0RAT_7 | ||
273 | #endif | ||
274 | #if (flash_EBIU_AMBCTL_RAT == 6) | ||
275 | #define flash_EBIU_AMBCTL0_RAT B0RAT_6 | ||
276 | #endif | ||
277 | #if (flash_EBIU_AMBCTL_RAT == 5) | ||
278 | #define flash_EBIU_AMBCTL0_RAT B0RAT_5 | ||
279 | #endif | ||
280 | #if (flash_EBIU_AMBCTL_RAT == 4) | ||
281 | #define flash_EBIU_AMBCTL0_RAT B0RAT_4 | ||
282 | #endif | ||
283 | #if (flash_EBIU_AMBCTL_RAT == 3) | ||
284 | #define flash_EBIU_AMBCTL0_RAT B0RAT_3 | ||
285 | #endif | ||
286 | #if (flash_EBIU_AMBCTL_RAT == 2) | ||
287 | #define flash_EBIU_AMBCTL0_RAT B0RAT_2 | ||
288 | #endif | ||
289 | #if (flash_EBIU_AMBCTL_RAT == 1) | ||
290 | #define flash_EBIU_AMBCTL0_RAT B0RAT_1 | ||
291 | #endif | ||
292 | |||
293 | #define flash_EBIU_AMBCTL0 \ | ||
294 | (flash_EBIU_AMBCTL0_WAT | flash_EBIU_AMBCTL0_RAT | flash_EBIU_AMBCTL0_HT | \ | ||
295 | flash_EBIU_AMBCTL0_ST | flash_EBIU_AMBCTL0_TT | CONFIG_FLASH_SPEED_RDYEN) | ||