Skip to content

Commit 2c95211

Browse files
fcoopertitrini
authored andcommitted
am43xx: Update EMIF DDR3 Configuration for AM43x GP
* Boot failures have been discovered due to a combination of routing issues and non optimal ddr3 timings in the EMIF * Since ddr3 timings are different after significant board layout changes different timings are required for alpha, beta and production boards. Signed-off-by: Franklin S. Cooper Jr <[email protected]>
1 parent cfd6de9 commit 2c95211

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

arch/arm/include/asm/arch-am33xx/omap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#define SRAM_SCRATCH_SPACE_ADDR 0x40337C00
3030
#define AM4372_BOARD_NAME_START SRAM_SCRATCH_SPACE_ADDR
3131
#define AM4372_BOARD_NAME_END SRAM_SCRATCH_SPACE_ADDR + 0xC
32+
#define AM4372_BOARD_VERSION_START SRAM_SCRATCH_SPACE_ADDR + 0xD
33+
#define AM4372_BOARD_VERSION_END SRAM_SCRATCH_SPACE_ADDR + 0x14
3234
#define QSPI_BASE 0x47900000
3335
#endif
3436
#endif

board/ti/am43xx/board.c

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ static int read_eeprom(struct am43xx_board_id *header)
6868
strncpy(am43xx_board_name, (char *)header->name, sizeof(header->name));
6969
am43xx_board_name[sizeof(header->name)] = 0;
7070

71+
strncpy(am43xx_board_rev, (char *)header->version, sizeof(header->version));
72+
am43xx_board_rev[sizeof(header->version)] = 0;
73+
7174
return 0;
7275
}
7376

@@ -217,6 +220,44 @@ const struct emif_regs ddr3_emif_regs_400Mhz = {
217220
.emif_rd_wr_exec_thresh = 0x00000405
218221
};
219222

223+
/* EMIF DDR3 Configurations are different for beta AM43X GP EVMs */
224+
const struct emif_regs ddr3_emif_regs_400Mhz_beta = {
225+
.sdram_config = 0x638413B2,
226+
.ref_ctrl = 0x00000C30,
227+
.sdram_tim1 = 0xEAAAD4DB,
228+
.sdram_tim2 = 0x266B7FDA,
229+
.sdram_tim3 = 0x107F8678,
230+
.read_idle_ctrl = 0x00050000,
231+
.zq_config = 0x50074BE4,
232+
.temp_alert_config = 0x0,
233+
.emif_ddr_phy_ctlr_1 = 0x0E004008,
234+
.emif_ddr_ext_phy_ctrl_1 = 0x08020080,
235+
.emif_ddr_ext_phy_ctrl_2 = 0x00000065,
236+
.emif_ddr_ext_phy_ctrl_3 = 0x00000091,
237+
.emif_ddr_ext_phy_ctrl_4 = 0x000000B5,
238+
.emif_ddr_ext_phy_ctrl_5 = 0x000000E5,
239+
.emif_rd_wr_exec_thresh = 0x00000405
240+
};
241+
242+
/* EMIF DDR3 Configurations are different for production AM43X GP EVMs */
243+
const struct emif_regs ddr3_emif_regs_400Mhz_production = {
244+
.sdram_config = 0x638413B2,
245+
.ref_ctrl = 0x00000C30,
246+
.sdram_tim1 = 0xEAAAD4DB,
247+
.sdram_tim2 = 0x266B7FDA,
248+
.sdram_tim3 = 0x107F8678,
249+
.read_idle_ctrl = 0x00050000,
250+
.zq_config = 0x50074BE4,
251+
.temp_alert_config = 0x0,
252+
.emif_ddr_phy_ctlr_1 = 0x0E004008,
253+
.emif_ddr_ext_phy_ctrl_1 = 0x08020080,
254+
.emif_ddr_ext_phy_ctrl_2 = 0x00000066,
255+
.emif_ddr_ext_phy_ctrl_3 = 0x00000091,
256+
.emif_ddr_ext_phy_ctrl_4 = 0x000000B9,
257+
.emif_ddr_ext_phy_ctrl_5 = 0x000000E6,
258+
.emif_rd_wr_exec_thresh = 0x00000405
259+
};
260+
220261
static const struct emif_regs ddr3_sk_emif_regs_400Mhz = {
221262
.sdram_config = 0x638413b2,
222263
.sdram_config2 = 0x00000000,
@@ -262,6 +303,52 @@ const u32 ext_phy_ctrl_const_base_ddr3[] = {
262303
0x08102040
263304
};
264305

306+
const u32 ext_phy_ctrl_const_base_ddr3_beta[] = {
307+
0x00000000,
308+
0x00000045,
309+
0x00000046,
310+
0x00000048,
311+
0x00000047,
312+
0x00000000,
313+
0x0000004C,
314+
0x00000070,
315+
0x00000085,
316+
0x000000A3,
317+
0x00000000,
318+
0x0000000C,
319+
0x00000030,
320+
0x00000045,
321+
0x00000063,
322+
0x00000000,
323+
0x0,
324+
0x0,
325+
0x40000000,
326+
0x08102040
327+
};
328+
329+
const u32 ext_phy_ctrl_const_base_ddr3_production[] = {
330+
0x00000000,
331+
0x00000044,
332+
0x00000044,
333+
0x00000046,
334+
0x00000046,
335+
0x00000000,
336+
0x00000059,
337+
0x00000077,
338+
0x00000093,
339+
0x000000A8,
340+
0x00000000,
341+
0x00000019,
342+
0x00000037,
343+
0x00000053,
344+
0x00000068,
345+
0x00000000,
346+
0x0,
347+
0x0,
348+
0x40000000,
349+
0x08102040
350+
};
351+
265352
static const u32 ext_phy_ctrl_const_base_ddr3_sk[] = {
266353
/* first 5 are taken care by emif_regs */
267354
0x00700070,
@@ -309,6 +396,12 @@ void emif_get_ext_phy_ctrl_const_regs(const u32 **regs, u32 *size)
309396
if (board_is_eposevm()) {
310397
*regs = ext_phy_ctrl_const_base_lpddr2;
311398
*size = ARRAY_SIZE(ext_phy_ctrl_const_base_lpddr2);
399+
} else if (board_is_evm_14_or_later()) {
400+
*regs = ext_phy_ctrl_const_base_ddr3_production;
401+
*size = ARRAY_SIZE(ext_phy_ctrl_const_base_ddr3_production);
402+
} else if (board_is_evm_12_or_later()) {
403+
*regs = ext_phy_ctrl_const_base_ddr3_beta;
404+
*size = ARRAY_SIZE(ext_phy_ctrl_const_base_ddr3_beta);
312405
} else if (board_is_gpevm()) {
313406
*regs = ext_phy_ctrl_const_base_ddr3;
314407
*size = ARRAY_SIZE(ext_phy_ctrl_const_base_ddr3);
@@ -473,6 +566,14 @@ void sdram_init(void)
473566
*/
474567
if (board_is_eposevm()) {
475568
config_ddr(0, &ioregs_lpddr2, NULL, NULL, &emif_regs_lpddr2, 0);
569+
} else if (board_is_evm_14_or_later()) {
570+
enable_vtt_regulator();
571+
config_ddr(0, &ioregs_ddr3, NULL, NULL,
572+
&ddr3_emif_regs_400Mhz_production, 0);
573+
} else if (board_is_evm_12_or_later()) {
574+
enable_vtt_regulator();
575+
config_ddr(0, &ioregs_ddr3, NULL, NULL,
576+
&ddr3_emif_regs_400Mhz_beta, 0);
476577
} else if (board_is_gpevm()) {
477578
enable_vtt_regulator();
478579
config_ddr(0, &ioregs_ddr3, NULL, NULL,

board/ti/am43xx/board.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <asm/arch/omap.h>
1616

1717
static char *const am43xx_board_name = (char *)AM4372_BOARD_NAME_START;
18+
static char *const am43xx_board_rev = (char *)AM4372_BOARD_VERSION_START;
1819

1920
/*
2021
* TI AM437x EVMs define a system EEPROM that defines certain sub-fields.
@@ -52,6 +53,16 @@ static inline int board_is_sk(void)
5253
return !strncmp(am43xx_board_name, "AM43__SK", HDR_NAME_LEN);
5354
}
5455

56+
static inline int board_is_evm_14_or_later(void)
57+
{
58+
return (board_is_gpevm() && strncmp("1.4", am43xx_board_rev, 3) <= 0);
59+
}
60+
61+
static inline int board_is_evm_12_or_later(void)
62+
{
63+
return (board_is_gpevm() && strncmp("1.2", am43xx_board_rev, 3) <= 0);
64+
}
65+
5566
void enable_uart0_pin_mux(void);
5667
void enable_board_pin_mux(void);
5768
void enable_i2c0_pin_mux(void);

0 commit comments

Comments
 (0)