xref: /rk3399_rockchip-uboot/board/freescale/mpc8536ds/ddr.c (revision 5b8031ccb4ed6e84457d883198d77efc307085dc)
19490a7f1SKumar Gala /*
29490a7f1SKumar Gala  * Copyright 2008 Freescale Semiconductor, Inc.
39490a7f1SKumar Gala  *
4*5b8031ccSTom Rini  * SPDX-License-Identifier:	GPL-2.0
59490a7f1SKumar Gala  */
69490a7f1SKumar Gala 
79490a7f1SKumar Gala #include <common.h>
89490a7f1SKumar Gala 
95614e71bSYork Sun #include <fsl_ddr_sdram.h>
105614e71bSYork Sun #include <fsl_ddr_dimm_params.h>
119490a7f1SKumar 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)
159490a7f1SKumar Gala {
169490a7f1SKumar Gala 	/*
179490a7f1SKumar Gala 	 * Factors to consider for clock adjust:
189490a7f1SKumar Gala 	 *	- number of chips on bus
199490a7f1SKumar Gala 	 *	- position of slot
209490a7f1SKumar Gala 	 *	- DDR1 vs. DDR2?
219490a7f1SKumar Gala 	 *	- ???
229490a7f1SKumar Gala 	 *
239490a7f1SKumar Gala 	 * This needs to be determined on a board-by-board basis.
249490a7f1SKumar Gala 	 *	0110	3/4 cycle late
259490a7f1SKumar Gala 	 *	0111	7/8 cycle late
269490a7f1SKumar Gala 	 */
279490a7f1SKumar Gala 	popts->clk_adjust = 7;
289490a7f1SKumar Gala 
299490a7f1SKumar Gala 	/*
309490a7f1SKumar Gala 	 * Factors to consider for CPO:
319490a7f1SKumar Gala 	 *	- frequency
329490a7f1SKumar Gala 	 *	- ddr1 vs. ddr2
339490a7f1SKumar Gala 	 */
349490a7f1SKumar Gala 	popts->cpo_override = 10;
359490a7f1SKumar Gala 
369490a7f1SKumar Gala 	/*
379490a7f1SKumar Gala 	 * Factors to consider for write data delay:
389490a7f1SKumar Gala 	 *	- number of DIMMs
399490a7f1SKumar Gala 	 *
409490a7f1SKumar Gala 	 * 1 = 1/4 clock delay
419490a7f1SKumar Gala 	 * 2 = 1/2 clock delay
429490a7f1SKumar Gala 	 * 3 = 3/4 clock delay
439490a7f1SKumar Gala 	 * 4 = 1   clock delay
449490a7f1SKumar Gala 	 * 5 = 5/4 clock delay
459490a7f1SKumar Gala 	 * 6 = 3/2 clock delay
469490a7f1SKumar Gala 	 */
479490a7f1SKumar Gala 	popts->write_data_delay = 3;
489490a7f1SKumar Gala 
499490a7f1SKumar Gala 	/*
509490a7f1SKumar Gala 	 * Factors to consider for half-strength driver enable:
519490a7f1SKumar Gala 	 *	- number of DIMMs installed
529490a7f1SKumar Gala 	 */
539490a7f1SKumar Gala 	popts->half_strength_driver_enable = 0;
54bf5b1f0cSDave Liu 
55bf5b1f0cSDave Liu 	/*
56bf5b1f0cSDave Liu 	 * For wake up arp feature, we need enable auto self refresh
57bf5b1f0cSDave Liu 	 */
58bf5b1f0cSDave Liu 	popts->auto_self_refresh_en = 1;
59bf5b1f0cSDave Liu 	popts->sr_it = 0x6;
609490a7f1SKumar Gala }
61