xref: /rk3399_rockchip-uboot/board/socrates/ddr.c (revision 5b8031ccb4ed6e84457d883198d77efc307085dc)
1be0bd823SKumar Gala /*
2be0bd823SKumar Gala  * Copyright 2008 Freescale Semiconductor, Inc.
3be0bd823SKumar Gala  *
4*5b8031ccSTom Rini  * SPDX-License-Identifier:	GPL-2.0
5be0bd823SKumar Gala  */
6be0bd823SKumar Gala 
7be0bd823SKumar Gala #include <common.h>
8be0bd823SKumar Gala 
95614e71bSYork Sun #include <fsl_ddr_sdram.h>
105614e71bSYork Sun #include <fsl_ddr_dimm_params.h>
11be0bd823SKumar Gala 
fsl_ddr_board_options(memctl_options_t * popts,dimm_params_t * pdimm,unsigned int ctrl_num)12dfb49108SHaiying Wang void fsl_ddr_board_options(memctl_options_t *popts,
13dfb49108SHaiying Wang 				dimm_params_t *pdimm,
14dfb49108SHaiying Wang 				unsigned int ctrl_num)
15be0bd823SKumar Gala {
16be0bd823SKumar Gala 	/*
17be0bd823SKumar Gala 	 * Factors to consider for clock adjust:
18be0bd823SKumar Gala 	 *	- number of chips on bus
19be0bd823SKumar Gala 	 *	- position of slot
20be0bd823SKumar Gala 	 *	- DDR1 vs. DDR2?
21be0bd823SKumar Gala 	 *	- ???
22be0bd823SKumar Gala 	 *
23be0bd823SKumar Gala 	 * This needs to be determined on a board-by-board basis.
24be0bd823SKumar Gala 	 *	0110	3/4 cycle late
25be0bd823SKumar Gala 	 *	0111	7/8 cycle late
26be0bd823SKumar Gala 	 */
27be0bd823SKumar Gala 	popts->clk_adjust = 7;
28be0bd823SKumar Gala 
29be0bd823SKumar Gala 	/*
30be0bd823SKumar Gala 	 * Factors to consider for CPO:
31be0bd823SKumar Gala 	 *	- frequency
32be0bd823SKumar Gala 	 *	- ddr1 vs. ddr2
33be0bd823SKumar Gala 	 */
34d666b2d5SAnatolij Gustschin 	popts->cpo_override = 0;
35be0bd823SKumar Gala 
36be0bd823SKumar Gala 	/*
37be0bd823SKumar Gala 	 * Factors to consider for write data delay:
38be0bd823SKumar Gala 	 *	- number of DIMMs
39be0bd823SKumar Gala 	 *
40be0bd823SKumar Gala 	 * 1 = 1/4 clock delay
41be0bd823SKumar Gala 	 * 2 = 1/2 clock delay
42be0bd823SKumar Gala 	 * 3 = 3/4 clock delay
43be0bd823SKumar Gala 	 * 4 = 1   clock delay
44be0bd823SKumar Gala 	 * 5 = 5/4 clock delay
45be0bd823SKumar Gala 	 * 6 = 3/2 clock delay
46be0bd823SKumar Gala 	 */
47be0bd823SKumar Gala 	popts->write_data_delay = 3;
48be0bd823SKumar Gala 
49be0bd823SKumar Gala 	/*
50be0bd823SKumar Gala 	 * Factors to consider for half-strength driver enable:
51be0bd823SKumar Gala 	 *	- number of DIMMs installed
52be0bd823SKumar Gala 	 */
53be0bd823SKumar Gala 	popts->half_strength_driver_enable = 0;
54be0bd823SKumar Gala }
55