blob: d049611e64268494d76f402140ec52bb1675d269 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0
Haiying Wang765547d2009-03-27 17:02:45 -04002/*
3 * Copyright 2009 Freescale Semiconductor, Inc.
Haiying Wang765547d2009-03-27 17:02:45 -04004 */
5
6#include <common.h>
Haiying Wang765547d2009-03-27 17:02:45 -04007
York Sun5614e712013-09-30 09:22:09 -07008#include <fsl_ddr_sdram.h>
9#include <fsl_ddr_dimm_params.h>
Haiying Wang765547d2009-03-27 17:02:45 -040010
Haiying Wang765547d2009-03-27 17:02:45 -040011void fsl_ddr_board_options(memctl_options_t *popts,
12 dimm_params_t *pdimm,
13 unsigned int ctrl_num)
14{
15 /*
16 * Factors to consider for clock adjust:
17 * - number of chips on bus
18 * - position of slot
19 * - DDR1 vs. DDR2?
20 * - ???
21 *
22 * This needs to be determined on a board-by-board basis.
23 * 0110 3/4 cycle late
24 * 0111 7/8 cycle late
25 */
Dave Liu1b5291d2009-03-27 14:32:43 +080026 popts->clk_adjust = 4;
Haiying Wang765547d2009-03-27 17:02:45 -040027
28 /*
29 * Factors to consider for CPO:
30 * - frequency
31 * - ddr1 vs. ddr2
32 */
33 popts->cpo_override = 0xff;
34
35 /*
36 * Factors to consider for write data delay:
37 * - number of DIMMs
38 *
39 * 1 = 1/4 clock delay
40 * 2 = 1/2 clock delay
41 * 3 = 3/4 clock delay
42 * 4 = 1 clock delay
43 * 5 = 5/4 clock delay
44 * 6 = 3/2 clock delay
45 */
46 popts->write_data_delay = 2;
47
48 /*
Haiying Wangb6bde932010-09-29 13:31:36 -040049 * Enable half drive strength
Haiying Wang765547d2009-03-27 17:02:45 -040050 */
Haiying Wangb6bde932010-09-29 13:31:36 -040051 popts->half_strength_driver_enable = 1;
52
53 /* Write leveling override */
54 popts->wrlvl_en = 1;
55 popts->wrlvl_override = 1;
56 popts->wrlvl_sample = 0xa;
57 popts->wrlvl_start = 0x4;
58
59 /* Rtt and Rtt_W override */
60 popts->rtt_override = 1;
61 popts->rtt_override_value = DDR3_RTT_60_OHM;
62 popts->rtt_wr_override_value = 0; /* Rtt_WR= dynamic ODT off */
Haiying Wang765547d2009-03-27 17:02:45 -040063}