1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * SPL data and initialization for CompuLab CL-SOM-AM57x board
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Author: Uri Mashiach <uri.mashiach@compulab.co.il>
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+
9*4882a593Smuzhiyun */
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun #include <asm/emif.h>
12*4882a593Smuzhiyun #include <asm/omap_common.h>
13*4882a593Smuzhiyun #include <asm/arch/sys_proto.h>
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun static const struct dmm_lisa_map_regs cl_som_am57x_lisa_regs = {
16*4882a593Smuzhiyun .dmm_lisa_map_3 = 0x80740300,
17*4882a593Smuzhiyun .is_ma_present = 0x1
18*4882a593Smuzhiyun };
19*4882a593Smuzhiyun
emif_get_dmm_regs(const struct dmm_lisa_map_regs ** dmm_lisa_regs)20*4882a593Smuzhiyun void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs)
21*4882a593Smuzhiyun {
22*4882a593Smuzhiyun /* Disable SDRAM controller EMIF2 for single core SOC */
23*4882a593Smuzhiyun *dmm_lisa_regs = &cl_som_am57x_lisa_regs;
24*4882a593Smuzhiyun if (omap_revision() == DRA722_ES1_0) {
25*4882a593Smuzhiyun ((struct dmm_lisa_map_regs *) *dmm_lisa_regs)->dmm_lisa_map_3 =
26*4882a593Smuzhiyun 0x80640100;
27*4882a593Smuzhiyun }
28*4882a593Smuzhiyun }
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun static const struct emif_regs cl_som_am57x_emif1_ddr3_532mhz_emif_regs = {
31*4882a593Smuzhiyun .sdram_config_init = 0x61852332,
32*4882a593Smuzhiyun .sdram_config = 0x61852332,
33*4882a593Smuzhiyun .sdram_config2 = 0x00000000,
34*4882a593Smuzhiyun .ref_ctrl = 0x000040f1,
35*4882a593Smuzhiyun .ref_ctrl_final = 0x00001040,
36*4882a593Smuzhiyun .sdram_tim1 = 0xeeef36f3,
37*4882a593Smuzhiyun .sdram_tim2 = 0x348f7fda,
38*4882a593Smuzhiyun .sdram_tim3 = 0x027f88a8,
39*4882a593Smuzhiyun .read_idle_ctrl = 0x00050000,
40*4882a593Smuzhiyun .zq_config = 0x1007190b,
41*4882a593Smuzhiyun .temp_alert_config = 0x00000000,
42*4882a593Smuzhiyun .emif_ddr_phy_ctlr_1_init = 0x0034400b,
43*4882a593Smuzhiyun .emif_ddr_phy_ctlr_1 = 0x0e34400b,
44*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
45*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_2 = 0x00740074,
46*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_3 = 0x00780078,
47*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_4 = 0x007c007c,
48*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_5 = 0x007b007b,
49*4882a593Smuzhiyun .emif_rd_wr_lvl_rmp_win = 0x00000000,
50*4882a593Smuzhiyun .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
51*4882a593Smuzhiyun .emif_rd_wr_lvl_ctl = 0x00000000,
52*4882a593Smuzhiyun .emif_rd_wr_exec_thresh = 0x00000305
53*4882a593Smuzhiyun };
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun /* Ext phy ctrl regs 1-35 */
56*4882a593Smuzhiyun static const u32 cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs[] = {
57*4882a593Smuzhiyun 0x10040100,
58*4882a593Smuzhiyun 0x00740074,
59*4882a593Smuzhiyun 0x00780078,
60*4882a593Smuzhiyun 0x007c007c,
61*4882a593Smuzhiyun 0x007b007b,
62*4882a593Smuzhiyun 0x00800080,
63*4882a593Smuzhiyun 0x00360036,
64*4882a593Smuzhiyun 0x00340034,
65*4882a593Smuzhiyun 0x00360036,
66*4882a593Smuzhiyun 0x00350035,
67*4882a593Smuzhiyun 0x00350035,
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun 0x01ff01ff,
70*4882a593Smuzhiyun 0x01ff01ff,
71*4882a593Smuzhiyun 0x01ff01ff,
72*4882a593Smuzhiyun 0x01ff01ff,
73*4882a593Smuzhiyun 0x01ff01ff,
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun 0x00430043,
76*4882a593Smuzhiyun 0x003e003e,
77*4882a593Smuzhiyun 0x004a004a,
78*4882a593Smuzhiyun 0x00470047,
79*4882a593Smuzhiyun 0x00400040,
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun 0x00000000,
82*4882a593Smuzhiyun 0x00600020,
83*4882a593Smuzhiyun 0x40011080,
84*4882a593Smuzhiyun 0x08102040,
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun 0x00400040,
87*4882a593Smuzhiyun 0x00400040,
88*4882a593Smuzhiyun 0x00400040,
89*4882a593Smuzhiyun 0x00400040,
90*4882a593Smuzhiyun 0x00400040,
91*4882a593Smuzhiyun 0x0,
92*4882a593Smuzhiyun 0x0,
93*4882a593Smuzhiyun 0x0,
94*4882a593Smuzhiyun 0x0,
95*4882a593Smuzhiyun 0x0
96*4882a593Smuzhiyun };
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun static const struct emif_regs cl_som_am57x_emif2_ddr3_532mhz_emif_regs = {
99*4882a593Smuzhiyun .sdram_config_init = 0x61852332,
100*4882a593Smuzhiyun .sdram_config = 0x61852332,
101*4882a593Smuzhiyun .sdram_config2 = 0x00000000,
102*4882a593Smuzhiyun .ref_ctrl = 0x000040f1,
103*4882a593Smuzhiyun .ref_ctrl_final = 0x00001040,
104*4882a593Smuzhiyun .sdram_tim1 = 0xeeef36f3,
105*4882a593Smuzhiyun .sdram_tim2 = 0x348f7fda,
106*4882a593Smuzhiyun .sdram_tim3 = 0x027f88a8,
107*4882a593Smuzhiyun .read_idle_ctrl = 0x00050000,
108*4882a593Smuzhiyun .zq_config = 0x1007190b,
109*4882a593Smuzhiyun .temp_alert_config = 0x00000000,
110*4882a593Smuzhiyun .emif_ddr_phy_ctlr_1_init = 0x0034400b,
111*4882a593Smuzhiyun .emif_ddr_phy_ctlr_1 = 0x0e34400b,
112*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_1 = 0x04040100,
113*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_2 = 0x00740074,
114*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_3 = 0x00780078,
115*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_4 = 0x007c007c,
116*4882a593Smuzhiyun .emif_ddr_ext_phy_ctrl_5 = 0x007b007b,
117*4882a593Smuzhiyun .emif_rd_wr_lvl_rmp_win = 0x00000000,
118*4882a593Smuzhiyun .emif_rd_wr_lvl_rmp_ctl = 0x80000000,
119*4882a593Smuzhiyun .emif_rd_wr_lvl_ctl = 0x00000000,
120*4882a593Smuzhiyun .emif_rd_wr_exec_thresh = 0x00000305
121*4882a593Smuzhiyun };
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun static const u32 cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs[] = {
124*4882a593Smuzhiyun 0x10040100,
125*4882a593Smuzhiyun 0x00820082,
126*4882a593Smuzhiyun 0x008b008b,
127*4882a593Smuzhiyun 0x00800080,
128*4882a593Smuzhiyun 0x007e007e,
129*4882a593Smuzhiyun 0x00800080,
130*4882a593Smuzhiyun 0x00370037,
131*4882a593Smuzhiyun 0x00390039,
132*4882a593Smuzhiyun 0x00360036,
133*4882a593Smuzhiyun 0x00370037,
134*4882a593Smuzhiyun 0x00350035,
135*4882a593Smuzhiyun 0x01ff01ff,
136*4882a593Smuzhiyun 0x01ff01ff,
137*4882a593Smuzhiyun 0x01ff01ff,
138*4882a593Smuzhiyun 0x01ff01ff,
139*4882a593Smuzhiyun 0x01ff01ff,
140*4882a593Smuzhiyun 0x00540054,
141*4882a593Smuzhiyun 0x00540054,
142*4882a593Smuzhiyun 0x004e004e,
143*4882a593Smuzhiyun 0x004c004c,
144*4882a593Smuzhiyun 0x00400040,
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun 0x00000000,
147*4882a593Smuzhiyun 0x00600020,
148*4882a593Smuzhiyun 0x40011080,
149*4882a593Smuzhiyun 0x08102040,
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun 0x00400040,
152*4882a593Smuzhiyun 0x00400040,
153*4882a593Smuzhiyun 0x00400040,
154*4882a593Smuzhiyun 0x00400040,
155*4882a593Smuzhiyun 0x00400040,
156*4882a593Smuzhiyun 0x0,
157*4882a593Smuzhiyun 0x0,
158*4882a593Smuzhiyun 0x0,
159*4882a593Smuzhiyun 0x0,
160*4882a593Smuzhiyun 0x0
161*4882a593Smuzhiyun };
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun static struct vcores_data cl_som_am57x_volts = {
164*4882a593Smuzhiyun .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM,
165*4882a593Smuzhiyun .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM,
166*4882a593Smuzhiyun .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
167*4882a593Smuzhiyun .mpu.addr = TPS659038_REG_ADDR_SMPS12,
168*4882a593Smuzhiyun .mpu.pmic = &tps659038,
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM,
171*4882a593Smuzhiyun .eve.value[OPP_OD] = VDD_EVE_DRA7_OD,
172*4882a593Smuzhiyun .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH,
173*4882a593Smuzhiyun .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM,
174*4882a593Smuzhiyun .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD,
175*4882a593Smuzhiyun .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH,
176*4882a593Smuzhiyun .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS,
177*4882a593Smuzhiyun .eve.addr = TPS659038_REG_ADDR_SMPS45,
178*4882a593Smuzhiyun .eve.pmic = &tps659038,
179*4882a593Smuzhiyun
180*4882a593Smuzhiyun .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM,
181*4882a593Smuzhiyun .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD,
182*4882a593Smuzhiyun .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH,
183*4882a593Smuzhiyun .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM,
184*4882a593Smuzhiyun .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD,
185*4882a593Smuzhiyun .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH,
186*4882a593Smuzhiyun .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS,
187*4882a593Smuzhiyun .gpu.addr = TPS659038_REG_ADDR_SMPS6,
188*4882a593Smuzhiyun .gpu.pmic = &tps659038,
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM,
191*4882a593Smuzhiyun .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM,
192*4882a593Smuzhiyun .core.efuse.reg_bits = DRA752_EFUSE_REGBITS,
193*4882a593Smuzhiyun .core.addr = TPS659038_REG_ADDR_SMPS7,
194*4882a593Smuzhiyun .core.pmic = &tps659038,
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM,
197*4882a593Smuzhiyun .iva.value[OPP_OD] = VDD_IVA_DRA7_OD,
198*4882a593Smuzhiyun .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH,
199*4882a593Smuzhiyun .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM,
200*4882a593Smuzhiyun .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD,
201*4882a593Smuzhiyun .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH,
202*4882a593Smuzhiyun .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS,
203*4882a593Smuzhiyun .iva.addr = TPS659038_REG_ADDR_SMPS8,
204*4882a593Smuzhiyun .iva.pmic = &tps659038,
205*4882a593Smuzhiyun };
206*4882a593Smuzhiyun
hw_data_init(void)207*4882a593Smuzhiyun void hw_data_init(void)
208*4882a593Smuzhiyun {
209*4882a593Smuzhiyun *prcm = &dra7xx_prcm;
210*4882a593Smuzhiyun *dplls_data = &dra7xx_dplls;
211*4882a593Smuzhiyun *omap_vcores = &cl_som_am57x_volts;
212*4882a593Smuzhiyun *ctrl = &dra7xx_ctrl;
213*4882a593Smuzhiyun }
214*4882a593Smuzhiyun
emif_get_reg_dump(u32 emif_nr,const struct emif_regs ** regs)215*4882a593Smuzhiyun void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs)
216*4882a593Smuzhiyun {
217*4882a593Smuzhiyun switch (emif_nr) {
218*4882a593Smuzhiyun case 1:
219*4882a593Smuzhiyun *regs = &cl_som_am57x_emif1_ddr3_532mhz_emif_regs;
220*4882a593Smuzhiyun break;
221*4882a593Smuzhiyun case 2:
222*4882a593Smuzhiyun *regs = &cl_som_am57x_emif2_ddr3_532mhz_emif_regs;
223*4882a593Smuzhiyun break;
224*4882a593Smuzhiyun }
225*4882a593Smuzhiyun }
226*4882a593Smuzhiyun
emif_get_ext_phy_ctrl_const_regs(u32 emif_nr,const u32 ** regs,u32 * size)227*4882a593Smuzhiyun void emif_get_ext_phy_ctrl_const_regs(u32 emif_nr, const u32 **regs, u32 *size)
228*4882a593Smuzhiyun {
229*4882a593Smuzhiyun switch (emif_nr) {
230*4882a593Smuzhiyun case 1:
231*4882a593Smuzhiyun *regs = cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs;
232*4882a593Smuzhiyun *size = ARRAY_SIZE(cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs);
233*4882a593Smuzhiyun break;
234*4882a593Smuzhiyun case 2:
235*4882a593Smuzhiyun *regs = cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs;
236*4882a593Smuzhiyun *size = ARRAY_SIZE(cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs);
237*4882a593Smuzhiyun break;
238*4882a593Smuzhiyun }
239*4882a593Smuzhiyun }
240