xref: /rk3399_rockchip-uboot/board/freescale/mpc8544ds/ddr.c (revision 5b8031ccb4ed6e84457d883198d77efc307085dc)
11167a2fdSKumar Gala /*
21167a2fdSKumar Gala  * Copyright 2008 Freescale Semiconductor, Inc.
31167a2fdSKumar Gala  *
4*5b8031ccSTom Rini  * SPDX-License-Identifier:	GPL-2.0
51167a2fdSKumar Gala  */
61167a2fdSKumar Gala 
71167a2fdSKumar Gala #include <common.h>
81167a2fdSKumar Gala 
95614e71bSYork Sun #include <fsl_ddr_sdram.h>
105614e71bSYork Sun #include <fsl_ddr_dimm_params.h>
111167a2fdSKumar 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)
151167a2fdSKumar Gala {
161167a2fdSKumar Gala 	/*
171167a2fdSKumar Gala 	 * Factors to consider for clock adjust:
181167a2fdSKumar Gala 	 *	- number of chips on bus
191167a2fdSKumar Gala 	 *	- position of slot
201167a2fdSKumar Gala 	 *	- DDR1 vs. DDR2?
211167a2fdSKumar Gala 	 *	- ???
221167a2fdSKumar Gala 	 *
231167a2fdSKumar Gala 	 * This needs to be determined on a board-by-board basis.
241167a2fdSKumar Gala 	 *	0110	3/4 cycle late
251167a2fdSKumar Gala 	 *	0111	7/8 cycle late
261167a2fdSKumar Gala 	 */
271167a2fdSKumar Gala 	popts->clk_adjust = 7;
281167a2fdSKumar Gala 
291167a2fdSKumar Gala 	/*
301167a2fdSKumar Gala 	 * Factors to consider for CPO:
311167a2fdSKumar Gala 	 *	- frequency
321167a2fdSKumar Gala 	 *	- ddr1 vs. ddr2
331167a2fdSKumar Gala 	 */
341167a2fdSKumar Gala 	popts->cpo_override = 10;
351167a2fdSKumar Gala 
361167a2fdSKumar Gala 	/*
371167a2fdSKumar Gala 	 * Factors to consider for write data delay:
381167a2fdSKumar Gala 	 *	- number of DIMMs
391167a2fdSKumar Gala 	 *
401167a2fdSKumar Gala 	 * 1 = 1/4 clock delay
411167a2fdSKumar Gala 	 * 2 = 1/2 clock delay
421167a2fdSKumar Gala 	 * 3 = 3/4 clock delay
431167a2fdSKumar Gala 	 * 4 = 1   clock delay
441167a2fdSKumar Gala 	 * 5 = 5/4 clock delay
451167a2fdSKumar Gala 	 * 6 = 3/2 clock delay
461167a2fdSKumar Gala 	 */
471167a2fdSKumar Gala 	popts->write_data_delay = 3;
481167a2fdSKumar Gala 
49b4983e16SDave Liu 	/* 2T timing enable */
500dd38a35SPriyanka Jain 	popts->twot_en = 1;
51b4983e16SDave Liu 
521167a2fdSKumar Gala 	/*
531167a2fdSKumar Gala 	 * Factors to consider for half-strength driver enable:
541167a2fdSKumar Gala 	 *	- number of DIMMs installed
551167a2fdSKumar Gala 	 */
561167a2fdSKumar Gala 	popts->half_strength_driver_enable = 0;
571167a2fdSKumar Gala }
58