blob: d415c91f3a3cd8fb89fadb2569ae686ce0ed8e66 [file] [log] [blame]
Chander Kashyaped2e25a2012-02-05 23:01:47 +00001/*
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +00002 * Machine Specific Values for SMDK5250 board based on EXYNOS5
Chander Kashyaped2e25a2012-02-05 23:01:47 +00003 *
4 * Copyright (C) 2012 Samsung Electronics
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Chander Kashyaped2e25a2012-02-05 23:01:47 +00007 */
8
9#ifndef _SMDK5250_SETUP_H
10#define _SMDK5250_SETUP_H
11
12#include <config.h>
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +000013#include <asm/arch/dmc.h>
Chander Kashyaped2e25a2012-02-05 23:01:47 +000014
Rajeshwari Birjeac892d02013-12-26 09:44:21 +053015#define NOT_AVAILABLE 0
16#define DATA_MASK 0xFFFFF
Chander Kashyaped2e25a2012-02-05 23:01:47 +000017
Rajeshwari Birjeac892d02013-12-26 09:44:21 +053018#define ENABLE_BIT 0x1
19#define DISABLE_BIT 0x0
20#define CA_SWAP_EN (1 << 0)
Chander Kashyaped2e25a2012-02-05 23:01:47 +000021
22/* Set PLL */
23#define set_pll(mdiv, pdiv, sdiv) (1<<31 | mdiv<<16 | pdiv<<8 | sdiv)
24
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +000025/* MEMCONTROL register bit fields */
26#define DMC_MEMCONTROL_CLK_STOP_DISABLE (0 << 0)
27#define DMC_MEMCONTROL_DPWRDN_DISABLE (0 << 1)
28#define DMC_MEMCONTROL_DPWRDN_ACTIVE_PRECHARGE (0 << 2)
29#define DMC_MEMCONTROL_TP_DISABLE (0 << 4)
30#define DMC_MEMCONTROL_DSREF_DISABLE (0 << 5)
31#define DMC_MEMCONTROL_DSREF_ENABLE (1 << 5)
32#define DMC_MEMCONTROL_ADD_LAT_PALL_CYCLE(x) (x << 6)
33
34#define DMC_MEMCONTROL_MEM_TYPE_LPDDR3 (7 << 8)
35#define DMC_MEMCONTROL_MEM_TYPE_DDR3 (6 << 8)
36#define DMC_MEMCONTROL_MEM_TYPE_LPDDR2 (5 << 8)
37
38#define DMC_MEMCONTROL_MEM_WIDTH_32BIT (2 << 12)
39
40#define DMC_MEMCONTROL_NUM_CHIP_1 (0 << 16)
41#define DMC_MEMCONTROL_NUM_CHIP_2 (1 << 16)
42
43#define DMC_MEMCONTROL_BL_8 (3 << 20)
44#define DMC_MEMCONTROL_BL_4 (2 << 20)
45
46#define DMC_MEMCONTROL_PZQ_DISABLE (0 << 24)
47
48#define DMC_MEMCONTROL_MRR_BYTE_7_0 (0 << 25)
49#define DMC_MEMCONTROL_MRR_BYTE_15_8 (1 << 25)
50#define DMC_MEMCONTROL_MRR_BYTE_23_16 (2 << 25)
51#define DMC_MEMCONTROL_MRR_BYTE_31_24 (3 << 25)
52
53/* MEMCONFIG0 register bit fields */
Rajeshwari Shindebed24422013-07-04 12:29:17 +053054#define DMC_MEMCONFIGX_CHIP_MAP_INTERLEAVED (1 << 12)
Rajeshwari Birjeac892d02013-12-26 09:44:21 +053055#define DMC_MEMCONFIG_CHIP_MAP_SPLIT (2 << 12)
Rajeshwari Shindebed24422013-07-04 12:29:17 +053056#define DMC_MEMCONFIGX_CHIP_COL_10 (3 << 8)
57#define DMC_MEMCONFIGX_CHIP_ROW_14 (2 << 4)
58#define DMC_MEMCONFIGX_CHIP_ROW_15 (3 << 4)
59#define DMC_MEMCONFIGX_CHIP_BANK_8 (3 << 0)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +000060
Rajeshwari Shindebed24422013-07-04 12:29:17 +053061#define DMC_MEMBASECONFIGX_CHIP_BASE(x) (x << 16)
62#define DMC_MEMBASECONFIGX_CHIP_MASK(x) (x << 0)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +000063#define DMC_MEMBASECONFIG_VAL(x) ( \
Rajeshwari Shindebed24422013-07-04 12:29:17 +053064 DMC_MEMBASECONFIGX_CHIP_BASE(x) | \
65 DMC_MEMBASECONFIGX_CHIP_MASK(0x780) \
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +000066)
67
Rajeshwari Birjeac892d02013-12-26 09:44:21 +053068/*
69 * As we use channel interleaving, therefore value of the base address
70 * register must be set as half of the bus base address
71 * RAM start addess is 0x2000_0000 which means chip_base is 0x20, so
72 * we need to set half 0x10 to the membaseconfigx registers
73 * see exynos5420 UM section 17.17.3.21 for more.
74 */
75#define DMC_CHIP_BASE_0 0x10
76#define DMC_CHIP_BASE_1 0x50
77#define DMC_CHIP_MASK 0x7C0
78
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +000079#define DMC_MEMBASECONFIG0_VAL DMC_MEMBASECONFIG_VAL(0x40)
80#define DMC_MEMBASECONFIG1_VAL DMC_MEMBASECONFIG_VAL(0x80)
81
82#define DMC_PRECHCONFIG_VAL 0xFF000000
83#define DMC_PWRDNCONFIG_VAL 0xFFFF00FF
84
85#define DMC_CONCONTROL_RESET_VAL 0x0FFF0000
86#define DFI_INIT_START (1 << 28)
87#define EMPTY (1 << 8)
88#define AREF_EN (1 << 5)
89
90#define DFI_INIT_COMPLETE_CHO (1 << 2)
91#define DFI_INIT_COMPLETE_CH1 (1 << 3)
92
93#define RDLVL_COMPLETE_CHO (1 << 14)
94#define RDLVL_COMPLETE_CH1 (1 << 15)
95
96#define CLK_STOP_EN (1 << 0)
97#define DPWRDN_EN (1 << 1)
98#define DSREF_EN (1 << 5)
99
100/* COJCONTROL register bit fields */
101#define DMC_CONCONTROL_IO_PD_CON_DISABLE (0 << 3)
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530102#define DMC_CONCONTROL_IO_PD_CON_ENABLE (1 << 3)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000103#define DMC_CONCONTROL_AREF_EN_DISABLE (0 << 5)
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530104#define DMC_CONCONTROL_AREF_EN_ENABLE (1 << 5)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000105#define DMC_CONCONTROL_EMPTY_DISABLE (0 << 8)
106#define DMC_CONCONTROL_EMPTY_ENABLE (1 << 8)
107#define DMC_CONCONTROL_RD_FETCH_DISABLE (0x0 << 12)
108#define DMC_CONCONTROL_TIMEOUT_LEVEL0 (0xFFF << 16)
109#define DMC_CONCONTROL_DFI_INIT_START_DISABLE (0 << 28)
110
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530111#define DMC_CONCONTROL_VAL 0x1FFF2101
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000112
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530113#define DREX_CONCONTROL_VAL DMC_CONCONTROL_VAL \
114 | DMC_CONCONTROL_AREF_EN_ENABLE \
115 | DMC_CONCONTROL_IO_PD_CON_ENABLE
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000116
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530117#define DMC_CONCONTROL_IO_PD_CON(x) (x << 6)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000118
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530119/* CLK_DIV_CPU1 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000120#define HPM_RATIO 0x2
121#define COPY_RATIO 0x0
122
123/* CLK_DIV_CPU1 = 0x00000003 */
124#define CLK_DIV_CPU1_VAL ((HPM_RATIO << 4) \
125 | (COPY_RATIO))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000126
127/* CLK_SRC_CORE0 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000128#define CLK_SRC_CORE0_VAL 0x00000000
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000129
130/* CLK_SRC_CORE1 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000131#define CLK_SRC_CORE1_VAL 0x100
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000132
133/* CLK_DIV_CORE0 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000134#define CLK_DIV_CORE0_VAL 0x00120000
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000135
136/* CLK_DIV_CORE1 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000137#define CLK_DIV_CORE1_VAL 0x07070700
138
139/* CLK_DIV_SYSRGT */
140#define CLK_DIV_SYSRGT_VAL 0x00000111
141
142/* CLK_DIV_ACP */
143#define CLK_DIV_ACP_VAL 0x12
144
145/* CLK_DIV_SYSLFT */
146#define CLK_DIV_SYSLFT_VAL 0x00000311
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000147
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530148#define MUX_APLL_SEL_MASK (1 << 0)
149#define MUX_MPLL_SEL_MASK (1 << 8)
150#define MPLL_SEL_MOUT_MPLLFOUT (2 << 8)
151#define MUX_CPLL_SEL_MASK (1 << 8)
152#define MUX_EPLL_SEL_MASK (1 << 12)
153#define MUX_VPLL_SEL_MASK (1 << 16)
154#define MUX_GPLL_SEL_MASK (1 << 28)
155#define MUX_BPLL_SEL_MASK (1 << 0)
156#define MUX_HPM_SEL_MASK (1 << 20)
157#define HPM_SEL_SCLK_MPLL (1 << 21)
158#define PLL_LOCKED (1 << 29)
159#define APLL_CON0_LOCKED (1 << 29)
160#define MPLL_CON0_LOCKED (1 << 29)
161#define BPLL_CON0_LOCKED (1 << 29)
162#define CPLL_CON0_LOCKED (1 << 29)
163#define EPLL_CON0_LOCKED (1 << 29)
164#define GPLL_CON0_LOCKED (1 << 29)
165#define VPLL_CON0_LOCKED (1 << 29)
166#define CLK_REG_DISABLE 0x0
167#define TOP2_VAL 0x0110000
168
169/* SCLK_SRC_ISP - set SPI0/1 to 6 = SCLK_MPLL_USER */
170#define SPI0_ISP_SEL 6
171#define SPI1_ISP_SEL 6
172#define SCLK_SRC_ISP_VAL (SPI1_ISP_SEL << 4) \
173 | (SPI0_ISP_SEL << 0)
174
175/* SCLK_DIV_ISP - set SPI0/1 to 0xf = divide by 16 */
176#define SPI0_ISP_RATIO 0xf
177#define SPI1_ISP_RATIO 0xf
178#define SCLK_DIV_ISP_VAL (SPI1_ISP_RATIO << 12) \
179 | (SPI0_ISP_RATIO << 0)
180
181/* CLK_DIV_FSYS2 */
182#define MMC2_RATIO_MASK 0xf
183#define MMC2_RATIO_VAL 0x3
184#define MMC2_RATIO_OFFSET 0
185
186#define MMC2_PRE_RATIO_MASK 0xff
187#define MMC2_PRE_RATIO_VAL 0x9
188#define MMC2_PRE_RATIO_OFFSET 8
189
190#define MMC3_RATIO_MASK 0xf
191#define MMC3_RATIO_VAL 0x1
192#define MMC3_RATIO_OFFSET 16
193
194#define MMC3_PRE_RATIO_MASK 0xff
195#define MMC3_PRE_RATIO_VAL 0x0
196#define MMC3_PRE_RATIO_OFFSET 24
197
198/* CLK_SRC_LEX */
199#define CLK_SRC_LEX_VAL 0x0
200
201/* CLK_DIV_LEX */
202#define CLK_DIV_LEX_VAL 0x10
203
204/* CLK_DIV_R0X */
205#define CLK_DIV_R0X_VAL 0x10
206
207/* CLK_DIV_L0X */
208#define CLK_DIV_R1X_VAL 0x10
209
210/* CLK_DIV_ISP2 */
211#define CLK_DIV_ISP2_VAL 0x1
212
213/* CLK_SRC_KFC */
214#define SRC_KFC_HPM_SEL (1 << 15)
215
216/* CLK_SRC_KFC */
217#define CLK_SRC_KFC_VAL 0x00008001
218
219/* CLK_DIV_KFC */
220#define CLK_DIV_KFC_VAL 0x03300110
221
222/* CLK_DIV2_RATIO */
223#define CLK_DIV2_RATIO 0x10111150
224
225/* CLK_DIV4_RATIO */
226#define CLK_DIV4_RATIO 0x00000003
227
228/* CLK_DIV_G2D */
229#define CLK_DIV_G2D 0x00000010
230
231/*
232 * DIV_DISP1_0
233 * For DP, divisor should be 2
234 */
235#define CLK_DIV_DISP1_0_FIMD1 (2 << 0)
236
237/* CLK_GATE_IP_DISP1 */
238#define CLK_GATE_DP1_ALLOW (1 << 4)
239
240/* AUDIO CLK SEL */
241#define AUDIO0_SEL_EPLL (0x6 << 28)
242#define AUDIO0_RATIO 0x5
243#define PCM0_RATIO 0x3
244#define DIV_MAU_VAL (PCM0_RATIO << 24 | AUDIO0_RATIO << 20)
245
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000246/* CLK_SRC_CDREX */
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530247#define MUX_MCLK_CDR_MSPLL (1 << 4)
248#define MUX_BPLL_SEL_FOUTBPLL (1 << 0)
249#define BPLL_SEL_MASK 0x7
250#define FOUTBPLL 2
251
252#define DDR3PHY_CTRL_PHY_RESET (1 << 0)
253#define DDR3PHY_CTRL_PHY_RESET_OFF (0 << 0)
254
255#define PHY_CON0_RESET_VAL 0x17020a40
256#define P0_CMD_EN (1 << 14)
257#define BYTE_RDLVL_EN (1 << 13)
258#define CTRL_SHGATE (1 << 8)
259
260#define PHY_CON1_RESET_VAL 0x09210100
261#define RDLVL_PASS_ADJ_VAL 0x6
262#define RDLVL_PASS_ADJ_OFFSET 16
263#define CTRL_GATEDURADJ_MASK (0xf << 20)
264#define READ_LEVELLING_DDR3 0x0100
265
266#define PHY_CON2_RESET_VAL 0x00010004
267#define INIT_DESKEW_EN (1 << 6)
268#define DLL_DESKEW_EN (1 << 12)
269#define RDLVL_GATE_EN (1 << 24)
270#define RDLVL_EN (1 << 25)
271#define RDLVL_INCR_ADJ (0x1 << 16)
272
273/* DREX_PAUSE */
274#define DREX_PAUSE_EN (1 << 0)
275
276#define BYPASS_EN (1 << 22)
277
278/* MEMMORY VAL */
279#define PHY_CON0_VAL 0x17021A00
280
281#define PHY_CON12_RESET_VAL 0x10100070
282#define PHY_CON12_VAL 0x10107F50
283#define CTRL_START (1 << 6)
284#define CTRL_DLL_ON (1 << 5)
285#define CTRL_FORCE_MASK (0x7F << 8)
286#define CTRL_LOCK_COARSE_MASK (0x7F << 10)
Doug Anderson70fa8042014-05-26 19:19:05 +0530287#define CTRL_FINE_LOCKED 0x7
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530288
289#define CTRL_OFFSETD_RESET_VAL 0x8
290#define CTRL_OFFSETD_VAL 0x7F
291
292#define CTRL_OFFSETR0 0x7F
293#define CTRL_OFFSETR1 0x7F
294#define CTRL_OFFSETR2 0x7F
295#define CTRL_OFFSETR3 0x7F
296#define PHY_CON4_VAL (CTRL_OFFSETR0 << 0 | \
297 CTRL_OFFSETR1 << 8 | \
298 CTRL_OFFSETR2 << 16 | \
299 CTRL_OFFSETR3 << 24)
300#define PHY_CON4_RESET_VAL 0x08080808
301
302#define CTRL_OFFSETW0 0x7F
303#define CTRL_OFFSETW1 0x7F
304#define CTRL_OFFSETW2 0x7F
305#define CTRL_OFFSETW3 0x7F
306#define PHY_CON6_VAL (CTRL_OFFSETW0 << 0 | \
307 CTRL_OFFSETW1 << 8 | \
308 CTRL_OFFSETW2 << 16 | \
309 CTRL_OFFSETW3 << 24)
310#define PHY_CON6_RESET_VAL 0x08080808
311
312#define PHY_CON14_RESET_VAL 0x001F0000
313#define CTRL_PULLD_DQS 0xF
314#define CTRL_PULLD_DQS_OFFSET 0
315
316/* ZQ Configurations */
317#define PHY_CON16_RESET_VAL 0x08000304
318
319#define ZQ_CLK_EN (1 << 27)
320#define ZQ_CLK_DIV_EN (1 << 18)
321#define ZQ_MANUAL_STR (1 << 1)
322#define ZQ_DONE (1 << 0)
323#define ZQ_MODE_DDS_OFFSET 24
324
325#define CTRL_RDLVL_GATE_ENABLE 1
326#define CTRL_RDLVL_GATE_DISABLE 0
327#define CTRL_RDLVL_DATA_ENABLE 2
328
329/* Direct Command */
330#define DIRECT_CMD_NOP 0x07000000
331#define DIRECT_CMD_PALL 0x01000000
332#define DIRECT_CMD_ZQINIT 0x0a000000
333#define DIRECT_CMD_CHANNEL_SHIFT 28
334#define DIRECT_CMD_CHIP_SHIFT 20
335#define DIRECT_CMD_BANK_SHIFT 16
336#define DIRECT_CMD_REFA (5 << 24)
337#define DIRECT_CMD_MRS1 0x71C00
338#define DIRECT_CMD_MRS2 0x10BFC
339#define DIRECT_CMD_MRS3 0x0050C
340#define DIRECT_CMD_MRS4 0x00868
341#define DIRECT_CMD_MRS5 0x00C04
342
343/* Drive Strength */
344#define IMPEDANCE_48_OHM 4
345#define IMPEDANCE_40_OHM 5
346#define IMPEDANCE_34_OHM 6
347#define IMPEDANCE_30_OHM 7
348#define PHY_CON39_VAL_48_OHM 0x09240924
349#define PHY_CON39_VAL_40_OHM 0x0B6D0B6D
350#define PHY_CON39_VAL_34_OHM 0x0DB60DB6
351#define PHY_CON39_VAL_30_OHM 0x0FFF0FFF
352
353#define CTRL_BSTLEN_OFFSET 8
354#define CTRL_RDLAT_OFFSET 0
355
356#define CMD_DEFAULT_LPDDR3 0xF
357#define CMD_DEFUALT_OFFSET 0
358#define T_WRDATA_EN 0x7
359#define T_WRDATA_EN_DDR3 0x8
360#define T_WRDATA_EN_OFFSET 16
361#define T_WRDATA_EN_MASK 0x1f
362
363#define PHY_CON31_VAL 0x0C183060
364#define PHY_CON32_VAL 0x60C18306
365#define PHY_CON33_VAL 0x00000030
366
367#define PHY_CON31_RESET_VAL 0x0
368#define PHY_CON32_RESET_VAL 0x0
369#define PHY_CON33_RESET_VAL 0x0
370
371#define SL_DLL_DYN_CON_EN (1 << 1)
372#define FP_RESYNC (1 << 3)
373#define CTRL_START (1 << 6)
374
375#define DMC_AREF_EN (1 << 5)
376#define DMC_CONCONTROL_EMPTY (1 << 8)
377#define DFI_INIT_START (1 << 28)
378
379#define DMC_MEMCONTROL_VAL 0x00312700
380#define CLK_STOP_EN (1 << 0)
381#define DPWRDN_EN (1 << 1)
382#define DSREF_EN (1 << 5)
383
384#define MEMBASECONFIG_CHIP_MASK_VAL 0x7E0
385#define MEMBASECONFIG_CHIP_MASK_OFFSET 0
386#define MEMBASECONFIG0_CHIP_BASE_VAL 0x20
387#define MEMBASECONFIG1_CHIP_BASE_VAL 0x40
388#define CHIP_BASE_OFFSET 16
389
390#define MEMCONFIG_VAL 0x1323
391#define PRECHCONFIG_DEFAULT_VAL 0xFF000000
392#define PWRDNCONFIG_DEFAULT_VAL 0xFFFF00FF
393
394#define TIMINGAREF_VAL 0x5d
395#define TIMINGROW_VAL 0x345A8692
396#define TIMINGDATA_VAL 0x3630065C
397#define TIMINGPOWER_VAL 0x50380336
398#define DFI_INIT_COMPLETE (1 << 3)
399
400#define BRBRSVCONTROL_VAL 0x00000033
401#define BRBRSVCONFIG_VAL 0x88778877
402
403/* Clock Gating Control (CGCONTROL) register */
404#define MEMIF_CG_EN (1 << 3) /* Memory interface clock gating */
405#define SCG_CG_EN (1 << 2) /* Scheduler clock gating */
406#define BUSIF_WR_CG_EN (1 << 1) /* Bus interface write channel clock gating */
407#define BUSIF_RD_CG_EN (1 << 0) /* Bus interface read channel clock gating */
408#define DMC_INTERNAL_CG (MEMIF_CG_EN | SCG_CG_EN | \
409 BUSIF_WR_CG_EN | BUSIF_RD_CG_EN)
410
411/* DMC PHY Control0 register */
412#define PHY_CONTROL0_RESET_VAL 0x0
413#define MEM_TERM_EN (1 << 31) /* Termination enable for memory */
414#define PHY_TERM_EN (1 << 30) /* Termination enable for PHY */
415#define DMC_CTRL_SHGATE (1 << 29) /* Duration of DQS gating signal */
416#define FP_RSYNC (1 << 3) /* Force DLL resyncronization */
417
418/* Driver strength for CK, CKE, CS & CA */
419#define IMP_OUTPUT_DRV_40_OHM 0x5
420#define IMP_OUTPUT_DRV_30_OHM 0x7
421#define DA_3_DS_OFFSET 25
422#define DA_2_DS_OFFSET 22
423#define DA_1_DS_OFFSET 19
424#define DA_0_DS_OFFSET 16
425#define CA_CK_DRVR_DS_OFFSET 9
426#define CA_CKE_DRVR_DS_OFFSET 6
427#define CA_CS_DRVR_DS_OFFSET 3
428#define CA_ADR_DRVR_DS_OFFSET 0
429
430#define PHY_CON42_CTRL_BSTLEN_SHIFT 8
431#define PHY_CON42_CTRL_RDLAT_SHIFT 0
432
433/*
434 * Definitions that differ with SoC's.
435 * Below is the part defining macros for smdk5250.
436 * Else part introduces macros for smdk5420.
437 */
438#ifndef CONFIG_SMDK5420
439
440/* APLL_CON1 */
441#define APLL_CON1_VAL (0x00203800)
442
443/* MPLL_CON1 */
444#define MPLL_CON1_VAL (0x00203800)
445
446/* CPLL_CON1 */
447#define CPLL_CON1_VAL (0x00203800)
448
449/* DPLL_CON1 */
450#define DPLL_CON1_VAL (NOT_AVAILABLE)
451
452/* GPLL_CON1 */
453#define GPLL_CON1_VAL (0x00203800)
454
455/* EPLL_CON1, CON2 */
456#define EPLL_CON1_VAL 0x00000000
457#define EPLL_CON2_VAL 0x00000080
458
459/* VPLL_CON1, CON2 */
460#define VPLL_CON1_VAL 0x00000000
461#define VPLL_CON2_VAL 0x00000080
462
463/* RPLL_CON1, CON2 */
464#define RPLL_CON1_VAL NOT_AVAILABLE
465#define RPLL_CON2_VAL NOT_AVAILABLE
466
467/* BPLL_CON1 */
468#define BPLL_CON1_VAL 0x00203800
469
470/* SPLL_CON1 */
471#define SPLL_CON1_VAL NOT_AVAILABLE
472
473/* IPLL_CON1 */
474#define IPLL_CON1_VAL NOT_AVAILABLE
475
476/* KPLL_CON1 */
477#define KPLL_CON1_VAL NOT_AVAILABLE
478
479/* CLK_SRC_ISP */
480#define CLK_SRC_ISP_VAL NOT_AVAILABLE
481#define CLK_DIV_ISP0_VAL 0x31
482#define CLK_DIV_ISP1_VAL 0x0
483
484/* CLK_FSYS */
485#define CLK_SRC_FSYS0_VAL 0x66666
486#define CLK_DIV_FSYS0_VAL 0x0BB00000
487#define CLK_DIV_FSYS1_VAL NOT_AVAILABLE
488#define CLK_DIV_FSYS2_VAL NOT_AVAILABLE
489
490/* CLK_SRC_CPU */
491/* 0 = MOUTAPLL, 1 = SCLKMPLL */
492#define MUX_HPM_SEL 0
493#define MUX_CPU_SEL 0
494#define MUX_APLL_SEL 1
495
496#define CLK_SRC_CPU_VAL ((MUX_HPM_SEL << 20) \
497 | (MUX_CPU_SEL << 16) \
498 | (MUX_APLL_SEL))
499
500/* CLK_SRC_CDREX */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000501#define CLK_SRC_CDREX_VAL 0x1
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000502
503/* CLK_DIV_CDREX */
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530504#define CLK_DIV_CDREX0_VAL NOT_AVAILABLE
505#define CLK_DIV_CDREX1_VAL NOT_AVAILABLE
506
507/* CLK_DIV_CPU0_VAL */
508#define CLK_DIV_CPU0_VAL NOT_AVAILABLE
509
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000510#define MCLK_CDREX2_RATIO 0x0
511#define ACLK_EFCON_RATIO 0x1
512#define MCLK_DPHY_RATIO 0x1
513#define MCLK_CDREX_RATIO 0x1
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000514#define ACLK_C2C_200_RATIO 0x1
515#define C2C_CLK_400_RATIO 0x1
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000516#define PCLK_CDREX_RATIO 0x1
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000517#define ACLK_CDREX_RATIO 0x1
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000518
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000519#define CLK_DIV_CDREX_VAL ((MCLK_DPHY_RATIO << 24) \
520 | (C2C_CLK_400_RATIO << 6) \
521 | (PCLK_CDREX_RATIO << 4) \
522 | (ACLK_CDREX_RATIO))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000523
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000524/* CLK_SRC_TOP0 */
525#define MUX_ACLK_300_GSCL_SEL 0x0
526#define MUX_ACLK_300_GSCL_MID_SEL 0x0
527#define MUX_ACLK_400_G3D_MID_SEL 0x0
528#define MUX_ACLK_333_SEL 0x0
529#define MUX_ACLK_300_DISP1_SEL 0x0
530#define MUX_ACLK_300_DISP1_MID_SEL 0x0
531#define MUX_ACLK_200_SEL 0x0
532#define MUX_ACLK_166_SEL 0x0
533#define CLK_SRC_TOP0_VAL ((MUX_ACLK_300_GSCL_SEL << 25) \
534 | (MUX_ACLK_300_GSCL_MID_SEL << 24) \
535 | (MUX_ACLK_400_G3D_MID_SEL << 20) \
536 | (MUX_ACLK_333_SEL << 16) \
537 | (MUX_ACLK_300_DISP1_SEL << 15) \
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000538 | (MUX_ACLK_300_DISP1_MID_SEL << 14) \
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000539 | (MUX_ACLK_200_SEL << 12) \
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000540 | (MUX_ACLK_166_SEL << 8))
541
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000542/* CLK_SRC_TOP1 */
543#define MUX_ACLK_400_G3D_SEL 0x1
544#define MUX_ACLK_400_ISP_SEL 0x0
545#define MUX_ACLK_400_IOP_SEL 0x0
546#define MUX_ACLK_MIPI_HSI_TXBASE_SEL 0x0
547#define MUX_ACLK_300_GSCL_MID1_SEL 0x0
548#define MUX_ACLK_300_DISP1_MID1_SEL 0x0
549#define CLK_SRC_TOP1_VAL ((MUX_ACLK_400_G3D_SEL << 28) \
550 |(MUX_ACLK_400_ISP_SEL << 24) \
551 |(MUX_ACLK_400_IOP_SEL << 20) \
552 |(MUX_ACLK_MIPI_HSI_TXBASE_SEL << 16) \
553 |(MUX_ACLK_300_GSCL_MID1_SEL << 12) \
554 |(MUX_ACLK_300_DISP1_MID1_SEL << 8))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000555
556/* CLK_SRC_TOP2 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000557#define MUX_GPLL_SEL 0x1
558#define MUX_BPLL_USER_SEL 0x0
559#define MUX_MPLL_USER_SEL 0x0
560#define MUX_VPLL_SEL 0x1
561#define MUX_EPLL_SEL 0x1
562#define MUX_CPLL_SEL 0x1
563#define VPLLSRC_SEL 0x0
564#define CLK_SRC_TOP2_VAL ((MUX_GPLL_SEL << 28) \
565 | (MUX_BPLL_USER_SEL << 24) \
566 | (MUX_MPLL_USER_SEL << 20) \
567 | (MUX_VPLL_SEL << 16) \
568 | (MUX_EPLL_SEL << 12) \
569 | (MUX_CPLL_SEL << 8) \
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000570 | (VPLLSRC_SEL))
571/* CLK_SRC_TOP3 */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000572#define MUX_ACLK_333_SUB_SEL 0x1
573#define MUX_ACLK_400_SUB_SEL 0x1
574#define MUX_ACLK_266_ISP_SUB_SEL 0x1
575#define MUX_ACLK_266_GPS_SUB_SEL 0x0
576#define MUX_ACLK_300_GSCL_SUB_SEL 0x1
577#define MUX_ACLK_266_GSCL_SUB_SEL 0x1
578#define MUX_ACLK_300_DISP1_SUB_SEL 0x1
579#define MUX_ACLK_200_DISP1_SUB_SEL 0x1
580#define CLK_SRC_TOP3_VAL ((MUX_ACLK_333_SUB_SEL << 24) \
581 | (MUX_ACLK_400_SUB_SEL << 20) \
582 | (MUX_ACLK_266_ISP_SUB_SEL << 16) \
583 | (MUX_ACLK_266_GPS_SUB_SEL << 12) \
584 | (MUX_ACLK_300_GSCL_SUB_SEL << 10) \
585 | (MUX_ACLK_266_GSCL_SUB_SEL << 8) \
586 | (MUX_ACLK_300_DISP1_SUB_SEL << 6) \
587 | (MUX_ACLK_200_DISP1_SUB_SEL << 4))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000588
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530589#define CLK_SRC_TOP4_VAL NOT_AVAILABLE
590#define CLK_SRC_TOP5_VAL NOT_AVAILABLE
591#define CLK_SRC_TOP6_VAL NOT_AVAILABLE
592#define CLK_SRC_TOP7_VAL NOT_AVAILABLE
593
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000594/* CLK_DIV_TOP0 */
595#define ACLK_300_DISP1_RATIO 0x2
596#define ACLK_400_G3D_RATIO 0x0
597#define ACLK_333_RATIO 0x0
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000598#define ACLK_266_RATIO 0x2
599#define ACLK_200_RATIO 0x3
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000600#define ACLK_166_RATIO 0x1
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000601#define ACLK_133_RATIO 0x1
602#define ACLK_66_RATIO 0x5
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000603
604#define CLK_DIV_TOP0_VAL ((ACLK_300_DISP1_RATIO << 28) \
605 | (ACLK_400_G3D_RATIO << 24) \
606 | (ACLK_333_RATIO << 20) \
607 | (ACLK_266_RATIO << 16) \
608 | (ACLK_200_RATIO << 12) \
609 | (ACLK_166_RATIO << 8) \
610 | (ACLK_133_RATIO << 4) \
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000611 | (ACLK_66_RATIO))
612
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000613/* CLK_DIV_TOP1 */
614#define ACLK_MIPI_HSI_TX_BASE_RATIO 0x3
615#define ACLK_66_PRE_RATIO 0x1
616#define ACLK_400_ISP_RATIO 0x1
617#define ACLK_400_IOP_RATIO 0x1
618#define ACLK_300_GSCL_RATIO 0x2
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000619
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000620#define CLK_DIV_TOP1_VAL ((ACLK_MIPI_HSI_TX_BASE_RATIO << 28) \
621 | (ACLK_66_PRE_RATIO << 24) \
622 | (ACLK_400_ISP_RATIO << 20) \
623 | (ACLK_400_IOP_RATIO << 16) \
624 | (ACLK_300_GSCL_RATIO << 12))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000625
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530626#define CLK_DIV_TOP2_VAL NOT_AVAILABLE
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000627
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530628/* PLL Lock Value Factor */
629#define PLL_LOCK_FACTOR 250
630#define PLL_X_LOCK_FACTOR 3000
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000631
632/* CLK_SRC_PERIC0 */
Padmavathi Venna6fe023b2013-03-28 04:32:22 +0000633#define PWM_SEL 6
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000634#define UART3_SEL 6
635#define UART2_SEL 6
636#define UART1_SEL 6
637#define UART0_SEL 6
638/* SRC_CLOCK = SCLK_MPLL */
639#define CLK_SRC_PERIC0_VAL ((PWM_SEL << 24) \
640 | (UART3_SEL << 12) \
641 | (UART2_SEL << 8) \
642 | (UART1_SEL << 4) \
643 | (UART0_SEL))
644
645/* CLK_SRC_PERIC1 */
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000646/* SRC_CLOCK = SCLK_MPLL */
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000647#define SPI0_SEL 6
648#define SPI1_SEL 6
649#define SPI2_SEL 6
650#define CLK_SRC_PERIC1_VAL ((SPI2_SEL << 24) \
651 | (SPI1_SEL << 20) \
652 | (SPI0_SEL << 16))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000653
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000654/* CLK_DIV_PERIL0 */
655#define UART5_RATIO 7
656#define UART4_RATIO 7
657#define UART3_RATIO 7
658#define UART2_RATIO 7
659#define UART1_RATIO 7
660#define UART0_RATIO 7
661
662#define CLK_DIV_PERIC0_VAL ((UART3_RATIO << 12) \
663 | (UART2_RATIO << 8) \
664 | (UART1_RATIO << 4) \
665 | (UART0_RATIO))
666/* CLK_DIV_PERIC1 */
667#define SPI1_RATIO 0x7
668#define SPI0_RATIO 0xf
669#define SPI1_SUB_RATIO 0x0
670#define SPI0_SUB_RATIO 0x0
671#define CLK_DIV_PERIC1_VAL ((SPI1_SUB_RATIO << 24) \
672 | ((SPI1_RATIO << 16) \
673 | (SPI0_SUB_RATIO << 8) \
674 | (SPI0_RATIO << 0)))
675
676/* CLK_DIV_PERIC2 */
677#define SPI2_RATIO 0xf
678#define SPI2_SUB_RATIO 0x0
679#define CLK_DIV_PERIC2_VAL ((SPI2_SUB_RATIO << 8) \
680 | (SPI2_RATIO << 0))
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000681
682/* CLK_DIV_PERIC3 */
683#define PWM_RATIO 8
684#define CLK_DIV_PERIC3_VAL (PWM_RATIO << 0)
685
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000686
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530687/* CLK_DIV_PERIC4 */
688#define CLK_DIV_PERIC4_VAL NOT_AVAILABLE
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000689
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530690/* CLK_SRC_DISP1_0 */
691#define CLK_SRC_DISP1_0_VAL 0x6
692#define CLK_DIV_DISP1_0_VAL NOT_AVAILABLE
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000693
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530694#define APLL_FOUT (1 << 0)
695#define KPLL_FOUT NOT_AVAILABLE
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000696
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530697#define CLK_DIV_CPERI1_VAL NOT_AVAILABLE
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000698
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530699#else
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530700#define PAD_RETENTION_DRAM_COREBLK_VAL 0x10000000
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000701
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530702/* APLL_CON1 */
703#define APLL_CON1_VAL (0x0020F300)
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000704
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530705/* MPLL_CON1 */
706#define MPLL_CON1_VAL (0x0020F300)
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000707
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000708
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530709/* CPLL_CON1 */
710#define CPLL_CON1_VAL 0x0020f300
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000711
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530712/* DPLL_CON1 */
713#define DPLL_CON1_VAL (0x0020F300)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000714
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530715/* GPLL_CON1 */
716#define GPLL_CON1_VAL (NOT_AVAILABLE)
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000717
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000718
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530719/* EPLL_CON1, CON2 */
720#define EPLL_CON1_VAL 0x00000000
721#define EPLL_CON2_VAL 0x00000080
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000722
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530723/* VPLL_CON1, CON2 */
724#define VPLL_CON1_VAL 0x0020f300
725#define VPLL_CON2_VAL NOT_AVAILABLE
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000726
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530727/* RPLL_CON1, CON2 */
728#define RPLL_CON1_VAL 0x00000000
729#define RPLL_CON2_VAL 0x00000080
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000730
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530731/* BPLL_CON1 */
732#define BPLL_CON1_VAL 0x0020f300
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000733
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530734/* SPLL_CON1 */
735#define SPLL_CON1_VAL 0x0020f300
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000736
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530737/* IPLL_CON1 */
738#define IPLL_CON1_VAL 0x00000080
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000739
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530740/* KPLL_CON1 */
741#define KPLL_CON1_VAL 0x200000
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000742
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530743/* CLK_SRC_ISP */
744#define CLK_SRC_ISP_VAL 0x33366000
745#define CLK_DIV_ISP0_VAL 0x13131300
746#define CLK_DIV_ISP1_VAL 0xbb110202
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000747
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000748
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530749/* CLK_FSYS */
750#define CLK_SRC_FSYS0_VAL 0x33033300
751#define CLK_DIV_FSYS0_VAL 0x0
752#define CLK_DIV_FSYS1_VAL 0x04f13c4f
753#define CLK_DIV_FSYS2_VAL 0x041d0000
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000754
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530755/* CLK_SRC_CPU */
756/* 0 = MOUTAPLL, 1 = SCLKMPLL */
757#define MUX_HPM_SEL 1
758#define MUX_CPU_SEL 0
759#define MUX_APLL_SEL 1
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000760
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530761#define CLK_SRC_CPU_VAL ((MUX_HPM_SEL << 20) \
762 | (MUX_CPU_SEL << 16) \
763 | (MUX_APLL_SEL))
764
765/* CLK_SRC_CDREX */
766#define CLK_SRC_CDREX_VAL 0x00000011
767
768/* CLK_DIV_CDREX */
769#define CLK_DIV_CDREX0_VAL 0x30010100
770#define CLK_DIV_CDREX1_VAL 0x300
771
772#define CLK_DIV_CDREX_VAL 0x17010100
773
774/* CLK_DIV_CPU0_VAL */
775#define CLK_DIV_CPU0_VAL 0x01440020
776
777/* CLK_SRC_TOP */
778#define CLK_SRC_TOP0_VAL 0x12221222
779#define CLK_SRC_TOP1_VAL 0x00100200
780#define CLK_SRC_TOP2_VAL 0x11101000
781#define CLK_SRC_TOP3_VAL 0x11111111
782#define CLK_SRC_TOP4_VAL 0x11110111
783#define CLK_SRC_TOP5_VAL 0x11111100
784#define CLK_SRC_TOP6_VAL 0x11110111
785#define CLK_SRC_TOP7_VAL 0x00022200
786
787/* CLK_DIV_TOP */
788#define CLK_DIV_TOP0_VAL 0x23712311
789#define CLK_DIV_TOP1_VAL 0x13100B00
790#define CLK_DIV_TOP2_VAL 0x11101100
791
792/* PLL Lock Value Factor */
793#define PLL_LOCK_FACTOR 200
794#define PLL_X_LOCK_FACTOR 3000
795
796/* CLK_SRC_PERIC0 */
797#define SPDIF_SEL 1
798#define PWM_SEL 3
799#define UART4_SEL 3
800#define UART3_SEL 3
801#define UART2_SEL 3
802#define UART1_SEL 3
803#define UART0_SEL 3
804/* SRC_CLOCK = SCLK_RPLL */
805#define CLK_SRC_PERIC0_VAL ((SPDIF_SEL << 28) \
806 | (PWM_SEL << 24) \
807 | (UART4_SEL << 20) \
808 | (UART3_SEL << 16) \
809 | (UART2_SEL << 12) \
810 | (UART1_SEL << 8) \
811 | (UART0_SEL << 4))
812
813/* CLK_SRC_PERIC1 */
814/* SRC_CLOCK = SCLK_EPLL */
815#define SPI0_SEL 6
816#define SPI1_SEL 6
817#define SPI2_SEL 6
818#define AUDIO0_SEL 6
819#define AUDIO1_SEL 6
820#define AUDIO2_SEL 6
821#define CLK_SRC_PERIC1_VAL ((SPI2_SEL << 28) \
822 | (SPI1_SEL << 24) \
823 | (SPI0_SEL << 20) \
824 | (AUDIO2_SEL << 16) \
825 | (AUDIO2_SEL << 12) \
826 | (AUDIO2_SEL << 8))
827
828/* CLK_DIV_PERIC0 */
829#define PWM_RATIO 8
830#define UART4_RATIO 9
831#define UART3_RATIO 9
832#define UART2_RATIO 9
833#define UART1_RATIO 9
834#define UART0_RATIO 9
835
836#define CLK_DIV_PERIC0_VAL ((PWM_RATIO << 28) \
837 | (UART4_RATIO << 24) \
838 | (UART3_RATIO << 20) \
839 | (UART2_RATIO << 16) \
840 | (UART1_RATIO << 12) \
841 | (UART0_RATIO << 8))
842/* CLK_DIV_PERIC1 */
843#define SPI2_RATIO 0x1
844#define SPI1_RATIO 0x1
845#define SPI0_RATIO 0x1
846#define CLK_DIV_PERIC1_VAL ((SPI2_RATIO << 28) \
847 | (SPI1_RATIO << 24) \
848 | (SPI0_RATIO << 20))
849
850/* CLK_DIV_PERIC2 */
851#define PCM2_RATIO 0x3
852#define PCM1_RATIO 0x3
853#define CLK_DIV_PERIC2_VAL ((PCM2_RATIO << 24) \
854 | (PCM1_RATIO << 16))
855
856/* CLK_DIV_PERIC3 */
857#define AUDIO2_RATIO 0x5
858#define AUDIO1_RATIO 0x5
859#define AUDIO0_RATIO 0x5
860#define CLK_DIV_PERIC3_VAL ((AUDIO2_RATIO << 28) \
861 | (AUDIO1_RATIO << 24) \
862 | (AUDIO0_RATIO << 20))
863
864/* CLK_DIV_PERIC4 */
865#define SPI2_PRE_RATIO 0x2
866#define SPI1_PRE_RATIO 0x2
867#define SPI0_PRE_RATIO 0x2
868#define CLK_DIV_PERIC4_VAL ((SPI2_PRE_RATIO << 24) \
869 | (SPI1_PRE_RATIO << 16) \
870 | (SPI0_PRE_RATIO << 8))
871
872/* CLK_SRC_DISP1_0 */
873#define CLK_SRC_DISP1_0_VAL 0x10666600
874#define CLK_DIV_DISP1_0_VAL 0x01050211
875
876#define APLL_FOUT (1 << 0)
877#define KPLL_FOUT (1 << 0)
878
879#define CLK_DIV_CPERI1_VAL 0x3f3f0000
880#endif
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000881
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000882struct mem_timings;
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000883
Rajeshwari Shinde5f90a4c2012-07-03 20:02:55 +0000884/* Errors that we can encourter in low-level setup */
885enum {
886 SETUP_ERR_OK,
887 SETUP_ERR_RDLV_COMPLETE_TIMEOUT = -1,
888 SETUP_ERR_ZQ_CALIBRATION_FAILURE = -2,
889};
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000890
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000891/*
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530892 * Memory variant specific initialization code for DDR3
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000893 *
Akshay Saraswat24c3e952014-05-26 19:17:03 +0530894 * @param mem Memory timings for this memory type.
Rajeshwari Shindebed24422013-07-04 12:29:17 +0530895 * @param reset Reset DDR PHY during initialization.
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000896 * @return 0 if ok, SETUP_ERR_... if there is a problem
897 */
Akshay Saraswat24c3e952014-05-26 19:17:03 +0530898int ddr3_mem_ctrl_init(struct mem_timings *mem, int reset);
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000899
Rajeshwari Birjeac892d02013-12-26 09:44:21 +0530900/* Memory variant specific initialization code for LPDDR3 */
901void lpddr3_mem_ctrl_init(void);
902
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000903/*
904 * Configure ZQ I/O interface
905 *
906 * @param mem Memory timings for this memory type.
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530907 * @param phy0_con16 Register address for dmc_phy0->phy_con16
908 * @param phy1_con16 Register address for dmc_phy1->phy_con16
909 * @param phy0_con17 Register address for dmc_phy0->phy_con17
910 * @param phy1_con17 Register address for dmc_phy1->phy_con17
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000911 * @return 0 if ok, -1 on error
912 */
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530913int dmc_config_zq(struct mem_timings *mem, uint32_t *phy0_con16,
914 uint32_t *phy1_con16, uint32_t *phy0_con17,
915 uint32_t *phy1_con17);
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000916/*
917 * Send NOP and MRS/EMRS Direct commands
918 *
919 * @param mem Memory timings for this memory type.
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530920 * @param directcmd Register address for dmc_phy->directcmd
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000921 */
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530922void dmc_config_mrs(struct mem_timings *mem, uint32_t *directcmd);
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000923
924/*
925 * Send PALL Direct commands
926 *
927 * @param mem Memory timings for this memory type.
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530928 * @param directcmd Register address for dmc_phy->directcmd
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000929 */
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530930void dmc_config_prech(struct mem_timings *mem, uint32_t *directcmd);
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000931
932/*
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000933 * Reset the DLL. This function is common between DDR3 and LPDDR2.
934 * However, the reset value is different. So we are passing a flag
935 * ddr_mode to distinguish between LPDDR2 and DDR3.
936 *
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530937 * @param phycontrol0 Register address for dmc_phy->phycontrol0
Rajeshwari Shinde6558d272012-07-03 20:02:56 +0000938 * @param ddr_mode Type of DDR memory
939 */
Rajeshwari Birje2d7f08c2013-12-26 09:44:22 +0530940void update_reset_dll(uint32_t *phycontrol0, enum ddr_mode);
Chander Kashyaped2e25a2012-02-05 23:01:47 +0000941#endif