blob: 1a287a4ef6a390314b94f485e3b286e53145e6b5 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Chander Kashyap0e7ab682011-08-18 22:37:19 +00002/*
Rajeshwari Shindebed24422013-07-04 12:29:17 +05303 * Machine Specific Values for EXYNOS4012 based board
Chander Kashyap0e7ab682011-08-18 22:37:19 +00004 *
5 * Copyright (C) 2011 Samsung Electronics
Chander Kashyap0e7ab682011-08-18 22:37:19 +00006 */
7
8#ifndef _ORIGEN_SETUP_H
9#define _ORIGEN_SETUP_H
10
Chander Kashyap0e7ab682011-08-18 22:37:19 +000011#include <asm/arch/cpu.h>
12
Chander Kashyap0e7ab682011-08-18 22:37:19 +000013/* Bus Configuration Register Address */
14#define ASYNC_CONFIG 0x10010350
15
Chander Kashyap0e7ab682011-08-18 22:37:19 +000016/* CLK_SRC_CPU */
17#define MUX_HPM_SEL_MOUTAPLL 0x0
18#define MUX_HPM_SEL_SCLKMPLL 0x1
19#define MUX_CORE_SEL_MOUTAPLL 0x0
20#define MUX_CORE_SEL_SCLKMPLL 0x1
21#define MUX_MPLL_SEL_FILPLL 0x0
22#define MUX_MPLL_SEL_MOUTMPLLFOUT 0x1
23#define MUX_APLL_SEL_FILPLL 0x0
24#define MUX_APLL_SEL_MOUTMPLLFOUT 0x1
25#define CLK_SRC_CPU_VAL ((MUX_HPM_SEL_MOUTAPLL << 20) \
26 | (MUX_CORE_SEL_MOUTAPLL << 16) \
27 | (MUX_MPLL_SEL_MOUTMPLLFOUT << 8)\
28 | (MUX_APLL_SEL_MOUTMPLLFOUT << 0))
29
30/* CLK_DIV_CPU0 */
31#define APLL_RATIO 0x0
32#define PCLK_DBG_RATIO 0x1
33#define ATB_RATIO 0x3
34#define PERIPH_RATIO 0x3
35#define COREM1_RATIO 0x7
36#define COREM0_RATIO 0x3
37#define CORE_RATIO 0x0
38#define CLK_DIV_CPU0_VAL ((APLL_RATIO << 24) \
39 | (PCLK_DBG_RATIO << 20) \
40 | (ATB_RATIO << 16) \
41 | (PERIPH_RATIO << 12) \
42 | (COREM1_RATIO << 8) \
43 | (COREM0_RATIO << 4) \
44 | (CORE_RATIO << 0))
45
46/* CLK_DIV_CPU1 */
47#define HPM_RATIO 0x0
48#define COPY_RATIO 0x3
49#define CLK_DIV_CPU1_VAL ((HPM_RATIO << 4) | (COPY_RATIO))
50
51/* CLK_SRC_DMC */
52#define MUX_PWI_SEL_XXTI 0x0
53#define MUX_PWI_SEL_XUSBXTI 0x1
54#define MUX_PWI_SEL_SCLK_HDMI24M 0x2
55#define MUX_PWI_SEL_SCLK_USBPHY0 0x3
56#define MUX_PWI_SEL_SCLK_USBPHY1 0x4
57#define MUX_PWI_SEL_SCLK_HDMIPHY 0x5
58#define MUX_PWI_SEL_SCLKMPLL 0x6
59#define MUX_PWI_SEL_SCLKEPLL 0x7
60#define MUX_PWI_SEL_SCLKVPLL 0x8
61#define MUX_DPHY_SEL_SCLKMPLL 0x0
62#define MUX_DPHY_SEL_SCLKAPLL 0x1
63#define MUX_DMC_BUS_SEL_SCLKMPLL 0x0
64#define MUX_DMC_BUS_SEL_SCLKAPLL 0x1
65#define CLK_SRC_DMC_VAL ((MUX_PWI_SEL_XUSBXTI << 16) \
66 | (MUX_DPHY_SEL_SCLKMPLL << 8) \
67 | (MUX_DMC_BUS_SEL_SCLKMPLL << 4))
68
69/* CLK_DIV_DMC0 */
70#define CORE_TIMERS_RATIO 0x1
71#define COPY2_RATIO 0x3
72#define DMCP_RATIO 0x1
73#define DMCD_RATIO 0x1
74#define DMC_RATIO 0x1
75#define DPHY_RATIO 0x1
76#define ACP_PCLK_RATIO 0x1
77#define ACP_RATIO 0x3
78#define CLK_DIV_DMC0_VAL ((CORE_TIMERS_RATIO << 28) \
79 | (COPY2_RATIO << 24) \
80 | (DMCP_RATIO << 20) \
81 | (DMCD_RATIO << 16) \
82 | (DMC_RATIO << 12) \
83 | (DPHY_RATIO << 8) \
84 | (ACP_PCLK_RATIO << 4) \
85 | (ACP_RATIO << 0))
86
87/* CLK_DIV_DMC1 */
88#define DPM_RATIO 0x1
89#define DVSEM_RATIO 0x1
90#define PWI_RATIO 0x1
91#define CLK_DIV_DMC1_VAL ((DPM_RATIO << 24) \
92 | (DVSEM_RATIO << 16) \
93 | (PWI_RATIO << 8))
94
95/* CLK_SRC_TOP0 */
96#define MUX_ONENAND_SEL_ACLK_133 0x0
97#define MUX_ONENAND_SEL_ACLK_160 0x1
98#define MUX_ACLK_133_SEL_SCLKMPLL 0x0
99#define MUX_ACLK_133_SEL_SCLKAPLL 0x1
100#define MUX_ACLK_160_SEL_SCLKMPLL 0x0
101#define MUX_ACLK_160_SEL_SCLKAPLL 0x1
102#define MUX_ACLK_100_SEL_SCLKMPLL 0x0
103#define MUX_ACLK_100_SEL_SCLKAPLL 0x1
104#define MUX_ACLK_200_SEL_SCLKMPLL 0x0
105#define MUX_ACLK_200_SEL_SCLKAPLL 0x1
106#define MUX_VPLL_SEL_FINPLL 0x0
107#define MUX_VPLL_SEL_FOUTVPLL 0x1
108#define MUX_EPLL_SEL_FINPLL 0x0
109#define MUX_EPLL_SEL_FOUTEPLL 0x1
110#define MUX_ONENAND_1_SEL_MOUTONENAND 0x0
111#define MUX_ONENAND_1_SEL_SCLKVPLL 0x1
112#define CLK_SRC_TOP0_VAL ((MUX_ONENAND_SEL_ACLK_133 << 28) \
113 | (MUX_ACLK_133_SEL_SCLKMPLL << 24) \
114 | (MUX_ACLK_160_SEL_SCLKMPLL << 20) \
115 | (MUX_ACLK_100_SEL_SCLKMPLL << 16) \
116 | (MUX_ACLK_200_SEL_SCLKMPLL << 12) \
117 | (MUX_VPLL_SEL_FINPLL << 8) \
118 | (MUX_EPLL_SEL_FINPLL << 4)\
119 | (MUX_ONENAND_1_SEL_MOUTONENAND << 0))
120
121/* CLK_SRC_TOP1 */
122#define VPLLSRC_SEL_FINPLL 0x0
123#define VPLLSRC_SEL_SCLKHDMI24M 0x1
124#define CLK_SRC_TOP1_VAL (VPLLSRC_SEL_FINPLL)
125
126/* CLK_DIV_TOP */
127#define ONENAND_RATIO 0x0
128#define ACLK_133_RATIO 0x5
129#define ACLK_160_RATIO 0x4
130#define ACLK_100_RATIO 0x7
131#define ACLK_200_RATIO 0x3
132#define CLK_DIV_TOP_VAL ((ONENAND_RATIO << 16) \
133 | (ACLK_133_RATIO << 12)\
134 | (ACLK_160_RATIO << 8) \
135 | (ACLK_100_RATIO << 4) \
136 | (ACLK_200_RATIO << 0))
137
138/* CLK_SRC_LEFTBUS */
139#define MUX_GDL_SEL_SCLKMPLL 0x0
140#define MUX_GDL_SEL_SCLKAPLL 0x1
141#define CLK_SRC_LEFTBUS_VAL (MUX_GDL_SEL_SCLKMPLL)
142
143/* CLK_DIV_LEFTBUS */
144#define GPL_RATIO 0x1
145#define GDL_RATIO 0x3
146#define CLK_DIV_LEFTBUS_VAL ((GPL_RATIO << 4) | (GDL_RATIO))
147
148/* CLK_SRC_RIGHTBUS */
149#define MUX_GDR_SEL_SCLKMPLL 0x0
150#define MUX_GDR_SEL_SCLKAPLL 0x1
151#define CLK_SRC_RIGHTBUS_VAL (MUX_GDR_SEL_SCLKMPLL)
152
153/* CLK_DIV_RIGHTBUS */
154#define GPR_RATIO 0x1
155#define GDR_RATIO 0x3
156#define CLK_DIV_RIGHTBUS_VAL ((GPR_RATIO << 4) | (GDR_RATIO))
157
158/* CLK_SRS_FSYS: 6 = SCLKMPLL */
159#define SATA_SEL_SCLKMPLL 0
160#define SATA_SEL_SCLKAPLL 1
161
162#define MMC_SEL_XXTI 0
163#define MMC_SEL_XUSBXTI 1
164#define MMC_SEL_SCLK_HDMI24M 2
165#define MMC_SEL_SCLK_USBPHY0 3
166#define MMC_SEL_SCLK_USBPHY1 4
167#define MMC_SEL_SCLK_HDMIPHY 5
168#define MMC_SEL_SCLKMPLL 6
169#define MMC_SEL_SCLKEPLL 7
170#define MMC_SEL_SCLKVPLL 8
171
172#define MMCC0_SEL MMC_SEL_SCLKMPLL
173#define MMCC1_SEL MMC_SEL_SCLKMPLL
174#define MMCC2_SEL MMC_SEL_SCLKMPLL
175#define MMCC3_SEL MMC_SEL_SCLKMPLL
176#define MMCC4_SEL MMC_SEL_SCLKMPLL
177#define CLK_SRC_FSYS_VAL ((SATA_SEL_SCLKMPLL << 24) \
178 | (MMCC4_SEL << 16) \
179 | (MMCC3_SEL << 12) \
180 | (MMCC2_SEL << 8) \
181 | (MMCC1_SEL << 4) \
182 | (MMCC0_SEL << 0))
183
184/* SCLK_MMC[0-4] = MOUTMMC[0-4]/(MMC[0-4]_RATIO + 1)/(MMC[0-4]_PRE_RATIO +1) */
185/* CLK_DIV_FSYS1 */
186#define MMC0_RATIO 0xF
187#define MMC0_PRE_RATIO 0x0
188#define MMC1_RATIO 0xF
189#define MMC1_PRE_RATIO 0x0
190#define CLK_DIV_FSYS1_VAL ((MMC1_PRE_RATIO << 24) \
191 | (MMC1_RATIO << 16) \
192 | (MMC0_PRE_RATIO << 8) \
193 | (MMC0_RATIO << 0))
194
195/* CLK_DIV_FSYS2 */
196#define MMC2_RATIO 0xF
197#define MMC2_PRE_RATIO 0x0
198#define MMC3_RATIO 0xF
199#define MMC3_PRE_RATIO 0x0
200#define CLK_DIV_FSYS2_VAL ((MMC3_PRE_RATIO << 24) \
201 | (MMC3_RATIO << 16) \
202 | (MMC2_PRE_RATIO << 8) \
203 | (MMC2_RATIO << 0))
204
205/* CLK_DIV_FSYS3 */
206#define MMC4_RATIO 0xF
207#define MMC4_PRE_RATIO 0x0
208#define CLK_DIV_FSYS3_VAL ((MMC4_PRE_RATIO << 8) \
209 | (MMC4_RATIO << 0))
210
211/* CLK_SRC_PERIL0 */
212#define UART_SEL_XXTI 0
213#define UART_SEL_XUSBXTI 1
214#define UART_SEL_SCLK_HDMI24M 2
215#define UART_SEL_SCLK_USBPHY0 3
216#define UART_SEL_SCLK_USBPHY1 4
217#define UART_SEL_SCLK_HDMIPHY 5
218#define UART_SEL_SCLKMPLL 6
219#define UART_SEL_SCLKEPLL 7
220#define UART_SEL_SCLKVPLL 8
221
222#define UART0_SEL UART_SEL_SCLKMPLL
223#define UART1_SEL UART_SEL_SCLKMPLL
224#define UART2_SEL UART_SEL_SCLKMPLL
225#define UART3_SEL UART_SEL_SCLKMPLL
226#define UART4_SEL UART_SEL_SCLKMPLL
227#define CLK_SRC_PERIL0_VAL ((UART4_SEL << 16) \
228 | (UART3_SEL << 12) \
229 | (UART2_SEL << 8) \
230 | (UART1_SEL << 4) \
231 | (UART0_SEL << 0))
232
233/* SCLK_UART[0-4] = MOUTUART[0-4]/(UART[0-4]_RATIO + 1) */
234/* CLK_DIV_PERIL0 */
235#define UART0_RATIO 7
236#define UART1_RATIO 7
237#define UART2_RATIO 7
238#define UART3_RATIO 7
239#define UART4_RATIO 7
240#define CLK_DIV_PERIL0_VAL ((UART4_RATIO << 16) \
241 | (UART3_RATIO << 12) \
242 | (UART2_RATIO << 8) \
243 | (UART1_RATIO << 4) \
244 | (UART0_RATIO << 0))
245
Annamalai Lakshmanan59988c22012-08-30 20:33:58 +0000246/* Clock Source CAM/FIMC */
247/* CLK_SRC_CAM */
248#define CAM0_SEL_XUSBXTI 1
249#define CAM1_SEL_XUSBXTI 1
250#define CSIS0_SEL_XUSBXTI 1
251#define CSIS1_SEL_XUSBXTI 1
252
253#define FIMC_SEL_SCLKMPLL 6
254#define FIMC0_LCLK_SEL FIMC_SEL_SCLKMPLL
255#define FIMC1_LCLK_SEL FIMC_SEL_SCLKMPLL
256#define FIMC2_LCLK_SEL FIMC_SEL_SCLKMPLL
257#define FIMC3_LCLK_SEL FIMC_SEL_SCLKMPLL
258
259#define CLK_SRC_CAM_VAL ((CSIS1_SEL_XUSBXTI << 28) \
260 | (CSIS0_SEL_XUSBXTI << 24) \
261 | (CAM1_SEL_XUSBXTI << 20) \
262 | (CAM0_SEL_XUSBXTI << 16) \
263 | (FIMC3_LCLK_SEL << 12) \
264 | (FIMC2_LCLK_SEL << 8) \
265 | (FIMC1_LCLK_SEL << 4) \
266 | (FIMC0_LCLK_SEL << 0))
267
268/* SCLK CAM */
269/* CLK_DIV_CAM */
270#define FIMC0_LCLK_RATIO 4
271#define FIMC1_LCLK_RATIO 4
272#define FIMC2_LCLK_RATIO 4
273#define FIMC3_LCLK_RATIO 4
274#define CLK_DIV_CAM_VAL ((FIMC3_LCLK_RATIO << 12) \
275 | (FIMC2_LCLK_RATIO << 8) \
276 | (FIMC1_LCLK_RATIO << 4) \
277 | (FIMC0_LCLK_RATIO << 0))
278
279/* SCLK MFC */
280/* CLK_SRC_MFC */
281#define MFC_SEL_MPLL 0
282#define MOUTMFC_0 0
283#define MFC_SEL MOUTMFC_0
284#define MFC_0_SEL MFC_SEL_MPLL
285#define CLK_SRC_MFC_VAL ((MFC_SEL << 8) | (MFC_0_SEL))
286
Annamalai Lakshmanan59988c22012-08-30 20:33:58 +0000287/* CLK_DIV_MFC */
288#define MFC_RATIO 3
289#define CLK_DIV_MFC_VAL (MFC_RATIO)
290
291/* SCLK G3D */
292/* CLK_SRC_G3D */
293#define G3D_SEL_MPLL 0
294#define MOUTG3D_0 0
295#define G3D_SEL MOUTG3D_0
296#define G3D_0_SEL G3D_SEL_MPLL
297#define CLK_SRC_G3D_VAL ((G3D_SEL << 8) | (G3D_0_SEL))
298
299/* CLK_DIV_G3D */
300#define G3D_RATIO 1
301#define CLK_DIV_G3D_VAL (G3D_RATIO)
302
303/* SCLK LCD0 */
Chander Kashyap5fc569a2011-12-18 20:16:32 +0000304/* CLK_SRC_LCD0 */
305#define FIMD_SEL_SCLKMPLL 6
306#define MDNIE0_SEL_XUSBXTI 1
307#define MDNIE_PWM0_SEL_XUSBXTI 1
308#define MIPI0_SEL_XUSBXTI 1
309#define CLK_SRC_LCD0_VAL ((MIPI0_SEL_XUSBXTI << 12) \
310 | (MDNIE_PWM0_SEL_XUSBXTI << 8) \
311 | (MDNIE0_SEL_XUSBXTI << 4) \
312 | (FIMD_SEL_SCLKMPLL << 0))
313
Annamalai Lakshmanan59988c22012-08-30 20:33:58 +0000314/* CLK_DIV_LCD0 */
315#define FIMD0_RATIO 4
316#define CLK_DIV_LCD0_VAL (FIMD0_RATIO)
317
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000318/* Required period to generate a stable clock output */
319/* PLL_LOCK_TIME */
320#define PLL_LOCKTIME 0x1C20
321
322/* PLL Values */
323#define DISABLE 0
324#define ENABLE 1
325#define SET_PLL(mdiv, pdiv, sdiv) ((ENABLE << 31)\
326 | (mdiv << 16) \
327 | (pdiv << 8) \
328 | (sdiv << 0))
329
330/* APLL_CON0 */
331#define APLL_MDIV 0xFA
332#define APLL_PDIV 0x6
333#define APLL_SDIV 0x1
334#define APLL_CON0_VAL SET_PLL(APLL_MDIV, APLL_PDIV, APLL_SDIV)
335
336/* APLL_CON1 */
337#define APLL_AFC_ENB 0x1
338#define APLL_AFC 0xC
339#define APLL_CON1_VAL ((APLL_AFC_ENB << 31) | (APLL_AFC << 0))
340
341/* MPLL_CON0 */
342#define MPLL_MDIV 0xC8
343#define MPLL_PDIV 0x6
344#define MPLL_SDIV 0x1
345#define MPLL_CON0_VAL SET_PLL(MPLL_MDIV, MPLL_PDIV, MPLL_SDIV)
346
347/* MPLL_CON1 */
348#define MPLL_AFC_ENB 0x0
349#define MPLL_AFC 0x1C
350#define MPLL_CON1_VAL ((MPLL_AFC_ENB << 31) | (MPLL_AFC << 0))
351
352/* EPLL_CON0 */
353#define EPLL_MDIV 0x30
354#define EPLL_PDIV 0x3
355#define EPLL_SDIV 0x2
356#define EPLL_CON0_VAL SET_PLL(EPLL_MDIV, EPLL_PDIV, EPLL_SDIV)
357
358/* EPLL_CON1 */
359#define EPLL_K 0x0
360#define EPLL_CON1_VAL (EPLL_K >> 0)
361
362/* VPLL_CON0 */
363#define VPLL_MDIV 0x35
364#define VPLL_PDIV 0x3
365#define VPLL_SDIV 0x2
366#define VPLL_CON0_VAL SET_PLL(VPLL_MDIV, VPLL_PDIV, VPLL_SDIV)
367
368/* VPLL_CON1 */
369#define VPLL_SSCG_EN DISABLE
370#define VPLL_SEL_PF_DN_SPREAD 0x0
371#define VPLL_MRR 0x11
372#define VPLL_MFR 0x0
373#define VPLL_K 0x400
374#define VPLL_CON1_VAL ((VPLL_SSCG_EN << 31)\
375 | (VPLL_SEL_PF_DN_SPREAD << 29) \
376 | (VPLL_MRR << 24) \
377 | (VPLL_MFR << 16) \
378 | (VPLL_K << 0))
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000379
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530380/* DMC */
381#define DIRECT_CMD_NOP 0x07000000
382#define DIRECT_CMD_ZQ 0x0a000000
383#define DIRECT_CMD_CHIP1_SHIFT (1 << 20)
384#define MEM_TIMINGS_MSR_COUNT 4
385#define CTRL_START (1 << 0)
386#define CTRL_DLL_ON (1 << 1)
387#define AREF_EN (1 << 5)
388#define DRV_TYPE (1 << 6)
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000389
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530390struct mem_timings {
391 unsigned direct_cmd_msr[MEM_TIMINGS_MSR_COUNT];
392 unsigned timingref;
393 unsigned timingrow;
394 unsigned timingdata;
395 unsigned timingpower;
396 unsigned zqcontrol;
397 unsigned control0;
398 unsigned control1;
399 unsigned control2;
400 unsigned concontrol;
401 unsigned prechconfig;
402 unsigned memcontrol;
403 unsigned memconfig0;
404 unsigned memconfig1;
405 unsigned dll_resync;
406 unsigned dll_on;
407};
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000408
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530409/* MIU */
410/* MIU Config Register Offsets*/
411#define APB_SFR_INTERLEAVE_CONF_OFFSET 0x400
412#define APB_SFR_ARBRITATION_CONF_OFFSET 0xC00
413#define ABP_SFR_SLV_ADDRMAP_CONF_OFFSET 0x800
414#define ABP_SFR_INTERLEAVE_ADDRMAP_START_OFFSET 0x808
415#define ABP_SFR_INTERLEAVE_ADDRMAP_END_OFFSET 0x810
416#define ABP_SFR_SLV0_SINGLE_ADDRMAP_START_OFFSET 0x818
417#define ABP_SFR_SLV0_SINGLE_ADDRMAP_END_OFFSET 0x820
418#define ABP_SFR_SLV1_SINGLE_ADDRMAP_START_OFFSET 0x828
419#define ABP_SFR_SLV1_SINGLE_ADDRMAP_END_OFFSET 0x830
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000420
Tom Rini893cd412022-06-10 22:59:33 -0400421#ifdef CONFIG_TARGET_ORIGEN
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530422/* Interleave: 2Bit, Interleave_bit1: 0x15, Interleave_bit0: 0x7 */
423#define APB_SFR_INTERLEAVE_CONF_VAL 0x20001507
424#define APB_SFR_ARBRITATION_CONF_VAL 0x00000001
425#endif
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000426
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530427#define INTERLEAVE_ADDR_MAP_START_ADDR 0x40000000
428#define INTERLEAVE_ADDR_MAP_END_ADDR 0xbfffffff
429#define INTERLEAVE_ADDR_MAP_EN 0x00000001
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000430
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530431#ifdef CONFIG_MIU_1BIT_INTERLEAVED
432/* Interleave_bit0: 0xC*/
433#define APB_SFR_INTERLEAVE_CONF_VAL 0x0000000c
434#endif
435#ifdef CONFIG_MIU_2BIT_INTERLEAVED
436/* Interleave: 2Bit, Interleave_bit1: 0x15, Interleave_bit0: 0xc */
437#define APB_SFR_INTERLEAVE_CONF_VAL 0x2000150c
438#endif
439#define SLAVE0_SINGLE_ADDR_MAP_START_ADDR 0x40000000
440#define SLAVE0_SINGLE_ADDR_MAP_END_ADDR 0x7fffffff
441#define SLAVE1_SINGLE_ADDR_MAP_START_ADDR 0x80000000
442#define SLAVE1_SINGLE_ADDR_MAP_END_ADDR 0xbfffffff
443/* Enable SME0 and SME1*/
444#define APB_SFR_SLV_ADDR_MAP_CONF_VAL 0x00000006
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000445
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530446#define FORCE_DLL_RESYNC 3
447#define DLL_CONTROL_ON 1
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000448
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530449#define DIRECT_CMD1 0x00020000
450#define DIRECT_CMD2 0x00030000
451#define DIRECT_CMD3 0x00010002
452#define DIRECT_CMD4 0x00000328
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000453
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530454#define CTRL_ZQ_MODE_NOTERM (0x1 << 0)
455#define CTRL_ZQ_START (0x1 << 1)
456#define CTRL_ZQ_DIV (0 << 4)
457#define CTRL_ZQ_MODE_DDS (0x7 << 8)
458#define CTRL_ZQ_MODE_TERM (0x2 << 11)
459#define CTRL_ZQ_FORCE_IMPN (0x5 << 14)
460#define CTRL_ZQ_FORCE_IMPP (0x6 << 17)
461#define CTRL_DCC (0xE38 << 20)
462#define ZQ_CONTROL_VAL (CTRL_ZQ_MODE_NOTERM | CTRL_ZQ_START\
463 | CTRL_ZQ_DIV | CTRL_ZQ_MODE_DDS\
464 | CTRL_ZQ_MODE_TERM | CTRL_ZQ_FORCE_IMPN\
465 | CTRL_ZQ_FORCE_IMPP | CTRL_DCC)
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000466
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530467#define ASYNC (0 << 0)
468#define CLK_RATIO (1 << 1)
469#define DIV_PIPE (1 << 3)
470#define AWR_ON (1 << 4)
471#define AREF_DISABLE (0 << 5)
472#define DRV_TYPE_DISABLE (0 << 6)
473#define CHIP0_NOT_EMPTY (0 << 8)
474#define CHIP1_NOT_EMPTY (0 << 9)
475#define DQ_SWAP_DISABLE (0 << 10)
476#define QOS_FAST_DISABLE (0 << 11)
477#define RD_FETCH (0x3 << 12)
478#define TIMEOUT_LEVEL0 (0xFFF << 16)
479#define CONCONTROL_VAL (ASYNC | CLK_RATIO | DIV_PIPE | AWR_ON\
480 | AREF_DISABLE | DRV_TYPE_DISABLE\
481 | CHIP0_NOT_EMPTY | CHIP1_NOT_EMPTY\
482 | DQ_SWAP_DISABLE | QOS_FAST_DISABLE\
483 | RD_FETCH | TIMEOUT_LEVEL0)
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000484
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530485#define CLK_STOP_DISABLE (0 << 1)
486#define DPWRDN_DISABLE (0 << 2)
487#define DPWRDN_TYPE (0 << 3)
488#define TP_DISABLE (0 << 4)
489#define DSREF_DIABLE (0 << 5)
490#define ADD_LAT_PALL (1 << 6)
491#define MEM_TYPE_DDR3 (0x6 << 8)
492#define MEM_WIDTH_32 (0x2 << 12)
493#define NUM_CHIP_2 (1 << 16)
494#define BL_8 (0x3 << 20)
495#define MEMCONTROL_VAL (CLK_STOP_DISABLE | DPWRDN_DISABLE\
496 | DPWRDN_TYPE | TP_DISABLE | DSREF_DIABLE\
497 | ADD_LAT_PALL | MEM_TYPE_DDR3 | MEM_WIDTH_32\
498 | NUM_CHIP_2 | BL_8)
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000499
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530500#define CHIP_BANK_8 (0x3 << 0)
501#define CHIP_ROW_14 (0x2 << 4)
502#define CHIP_COL_10 (0x3 << 8)
503#define CHIP_MAP_INTERLEAVED (1 << 12)
504#define CHIP_MASK (0xe0 << 16)
505#ifdef CONFIG_MIU_LINEAR
506#define CHIP0_BASE (0x40 << 24)
507#define CHIP1_BASE (0x60 << 24)
508#else
509#define CHIP0_BASE (0x20 << 24)
510#define CHIP1_BASE (0x40 << 24)
511#endif
512#define MEMCONFIG0_VAL (CHIP_BANK_8 | CHIP_ROW_14 | CHIP_COL_10\
513 | CHIP_MAP_INTERLEAVED | CHIP_MASK | CHIP0_BASE)
514#define MEMCONFIG1_VAL (CHIP_BANK_8 | CHIP_ROW_14 | CHIP_COL_10\
515 | CHIP_MAP_INTERLEAVED | CHIP_MASK | CHIP1_BASE)
Chander Kashyap0e7ab682011-08-18 22:37:19 +0000516
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530517#define TP_CNT (0xff << 24)
518#define PRECHCONFIG TP_CNT
519
520#define CTRL_OFF (0 << 0)
521#define CTRL_DLL_OFF (0 << 1)
522#define CTRL_HALF (0 << 2)
523#define CTRL_DFDQS (1 << 3)
524#define DQS_DELAY (0 << 4)
525#define CTRL_START_POINT (0x10 << 8)
526#define CTRL_INC (0x10 << 16)
527#define CTRL_FORCE (0x71 << 24)
528#define CONTROL0_VAL (CTRL_OFF | CTRL_DLL_OFF | CTRL_HALF\
529 | CTRL_DFDQS | DQS_DELAY | CTRL_START_POINT\
530 | CTRL_INC | CTRL_FORCE)
531
532#define CTRL_SHIFTC (0x6 << 0)
533#define CTRL_REF (8 << 4)
534#define CTRL_SHGATE (1 << 29)
535#define TERM_READ_EN (1 << 30)
536#define TERM_WRITE_EN (1 << 31)
537#define CONTROL1_VAL (CTRL_SHIFTC | CTRL_REF | CTRL_SHGATE\
538 | TERM_READ_EN | TERM_WRITE_EN)
539
540#define CONTROL2_VAL 0x00000000
541
Tom Rini893cd412022-06-10 22:59:33 -0400542#ifdef CONFIG_TARGET_ORIGEN
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530543#define TIMINGREF_VAL 0x000000BB
544#define TIMINGROW_VAL 0x4046654f
545#define TIMINGDATA_VAL 0x46400506
546#define TIMINGPOWER_VAL 0x52000A3C
547#else
548#define TIMINGREF_VAL 0x000000BC
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530549#define TIMINGROW_VAL 0x45430506
550#define TIMINGDATA_VAL 0x56500506
551#define TIMINGPOWER_VAL 0x5444033d
552#endif
553#endif