Kumar Gala | 9490a7f | 2008-07-25 13:31:05 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Freescale Semiconductor, Inc. |
| 3 | * |
Tom Rini | 5b8031c | 2016-01-14 22:05:13 -0500 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0 |
Kumar Gala | 9490a7f | 2008-07-25 13:31:05 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Kumar Gala | 9490a7f | 2008-07-25 13:31:05 -0500 | [diff] [blame] | 8 | |
York Sun | 5614e71 | 2013-09-30 09:22:09 -0700 | [diff] [blame] | 9 | #include <fsl_ddr_sdram.h> |
| 10 | #include <fsl_ddr_dimm_params.h> |
Kumar Gala | 9490a7f | 2008-07-25 13:31:05 -0500 | [diff] [blame] | 11 | |
Haiying Wang | dfb4910 | 2008-10-03 12:36:55 -0400 | [diff] [blame] | 12 | void fsl_ddr_board_options(memctl_options_t *popts, |
| 13 | dimm_params_t *pdimm, |
| 14 | unsigned int ctrl_num) |
Kumar Gala | 9490a7f | 2008-07-25 13:31:05 -0500 | [diff] [blame] | 15 | { |
| 16 | /* |
| 17 | * Factors to consider for clock adjust: |
| 18 | * - number of chips on bus |
| 19 | * - position of slot |
| 20 | * - DDR1 vs. DDR2? |
| 21 | * - ??? |
| 22 | * |
| 23 | * This needs to be determined on a board-by-board basis. |
| 24 | * 0110 3/4 cycle late |
| 25 | * 0111 7/8 cycle late |
| 26 | */ |
| 27 | popts->clk_adjust = 7; |
| 28 | |
| 29 | /* |
| 30 | * Factors to consider for CPO: |
| 31 | * - frequency |
| 32 | * - ddr1 vs. ddr2 |
| 33 | */ |
| 34 | popts->cpo_override = 10; |
| 35 | |
| 36 | /* |
| 37 | * Factors to consider for write data delay: |
| 38 | * - number of DIMMs |
| 39 | * |
| 40 | * 1 = 1/4 clock delay |
| 41 | * 2 = 1/2 clock delay |
| 42 | * 3 = 3/4 clock delay |
| 43 | * 4 = 1 clock delay |
| 44 | * 5 = 5/4 clock delay |
| 45 | * 6 = 3/2 clock delay |
| 46 | */ |
| 47 | popts->write_data_delay = 3; |
| 48 | |
| 49 | /* |
| 50 | * Factors to consider for half-strength driver enable: |
| 51 | * - number of DIMMs installed |
| 52 | */ |
| 53 | popts->half_strength_driver_enable = 0; |
Dave Liu | bf5b1f0 | 2008-11-21 16:31:53 +0800 | [diff] [blame] | 54 | |
| 55 | /* |
| 56 | * For wake up arp feature, we need enable auto self refresh |
| 57 | */ |
| 58 | popts->auto_self_refresh_en = 1; |
| 59 | popts->sr_it = 0x6; |
Kumar Gala | 9490a7f | 2008-07-25 13:31:05 -0500 | [diff] [blame] | 60 | } |