xref: /rk3399_rockchip-uboot/board/sbc8641d/ddr.c (revision 5b8031ccb4ed6e84457d883198d77efc307085dc)
19bd4e591SKumar Gala /*
29bd4e591SKumar Gala  * Copyright 2008 Freescale Semiconductor, Inc.
39bd4e591SKumar Gala  *
4*5b8031ccSTom Rini  * SPDX-License-Identifier:	GPL-2.0
59bd4e591SKumar Gala  */
69bd4e591SKumar Gala 
79bd4e591SKumar Gala #include <common.h>
89bd4e591SKumar Gala 
95614e71bSYork Sun #include <fsl_ddr_sdram.h>
105614e71bSYork Sun #include <fsl_ddr_dimm_params.h>
119bd4e591SKumar 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)
159bd4e591SKumar Gala {
169bd4e591SKumar Gala 	/*
179bd4e591SKumar Gala 	 * Factors to consider for clock adjust:
189bd4e591SKumar Gala 	 *	- number of chips on bus
199bd4e591SKumar Gala 	 *	- position of slot
209bd4e591SKumar Gala 	 *	- DDR1 vs. DDR2?
219bd4e591SKumar Gala 	 *	- ???
229bd4e591SKumar Gala 	 *
239bd4e591SKumar Gala 	 * This needs to be determined on a board-by-board basis.
249bd4e591SKumar Gala 	 *	0110	3/4 cycle late
259bd4e591SKumar Gala 	 *	0111	7/8 cycle late
269bd4e591SKumar Gala 	 */
279bd4e591SKumar Gala 	popts->clk_adjust = 7;
289bd4e591SKumar Gala 
299bd4e591SKumar Gala 	/*
309bd4e591SKumar Gala 	 * Factors to consider for CPO:
319bd4e591SKumar Gala 	 *	- frequency
329bd4e591SKumar Gala 	 *	- ddr1 vs. ddr2
339bd4e591SKumar Gala 	 */
349bd4e591SKumar Gala 	popts->cpo_override = 10;
359bd4e591SKumar Gala 
369bd4e591SKumar Gala 	/*
379bd4e591SKumar Gala 	 * Factors to consider for write data delay:
389bd4e591SKumar Gala 	 *	- number of DIMMs
399bd4e591SKumar Gala 	 *
409bd4e591SKumar Gala 	 * 1 = 1/4 clock delay
419bd4e591SKumar Gala 	 * 2 = 1/2 clock delay
429bd4e591SKumar Gala 	 * 3 = 3/4 clock delay
439bd4e591SKumar Gala 	 * 4 = 1   clock delay
449bd4e591SKumar Gala 	 * 5 = 5/4 clock delay
459bd4e591SKumar Gala 	 * 6 = 3/2 clock delay
469bd4e591SKumar Gala 	 */
479bd4e591SKumar Gala 	popts->write_data_delay = 3;
489bd4e591SKumar Gala 
499bd4e591SKumar Gala 	/*
509bd4e591SKumar Gala 	 * Factors to consider for half-strength driver enable:
519bd4e591SKumar Gala 	 *	- number of DIMMs installed
529bd4e591SKumar Gala 	 */
539bd4e591SKumar Gala 	popts->half_strength_driver_enable = 0;
549bd4e591SKumar Gala }
55