2 * Copyright 2008, 2010-2012 Freescale Semiconductor, Inc.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
12 #include <asm/fsl_ddr_sdram.h>
17 * Use our own stack based buffer before relocation to allow accessing longer
18 * hwconfig strings that might be in the environment before we've relocated.
19 * This is pretty fragile on both the use of stack and if the buffer is big
20 * enough. However we will get a warning from getenv_f for the later.
23 /* Board-specific functions defined in each board's ddr.c */
24 extern void fsl_ddr_board_options(memctl_options_t *popts,
26 unsigned int ctrl_num);
29 unsigned int odt_rd_cfg;
30 unsigned int odt_wr_cfg;
31 unsigned int odt_rtt_norm;
32 unsigned int odt_rtt_wr;
35 #ifdef CONFIG_FSL_DDR3
36 static const struct dynamic_odt single_Q[4] = {
39 FSL_DDR_ODT_CS_AND_OTHER_DIMM,
45 FSL_DDR_ODT_NEVER, /* tied high */
51 FSL_DDR_ODT_CS_AND_OTHER_DIMM,
57 FSL_DDR_ODT_NEVER, /* tied high */
63 static const struct dynamic_odt single_D[4] = {
80 static const struct dynamic_odt single_S[4] = {
92 static const struct dynamic_odt dual_DD[4] = {
95 FSL_DDR_ODT_SAME_DIMM,
100 FSL_DDR_ODT_OTHER_DIMM,
101 FSL_DDR_ODT_OTHER_DIMM,
107 FSL_DDR_ODT_SAME_DIMM,
112 FSL_DDR_ODT_OTHER_DIMM,
113 FSL_DDR_ODT_OTHER_DIMM,
119 static const struct dynamic_odt dual_DS[4] = {
122 FSL_DDR_ODT_SAME_DIMM,
127 FSL_DDR_ODT_OTHER_DIMM,
128 FSL_DDR_ODT_OTHER_DIMM,
133 FSL_DDR_ODT_OTHER_DIMM,
140 static const struct dynamic_odt dual_SD[4] = {
142 FSL_DDR_ODT_OTHER_DIMM,
150 FSL_DDR_ODT_SAME_DIMM,
155 FSL_DDR_ODT_OTHER_DIMM,
156 FSL_DDR_ODT_OTHER_DIMM,
162 static const struct dynamic_odt dual_SS[4] = {
164 FSL_DDR_ODT_OTHER_DIMM,
171 FSL_DDR_ODT_OTHER_DIMM,
179 static const struct dynamic_odt dual_D0[4] = {
182 FSL_DDR_ODT_SAME_DIMM,
196 static const struct dynamic_odt dual_0D[4] = {
201 FSL_DDR_ODT_SAME_DIMM,
213 static const struct dynamic_odt dual_S0[4] = {
226 static const struct dynamic_odt dual_0S[4] = {
239 static const struct dynamic_odt odt_unknown[4] = {
265 #else /* CONFIG_FSL_DDR3 */
266 static const struct dynamic_odt single_Q[4] = {
273 static const struct dynamic_odt single_D[4] = {
290 static const struct dynamic_odt single_S[4] = {
302 static const struct dynamic_odt dual_DD[4] = {
304 FSL_DDR_ODT_OTHER_DIMM,
305 FSL_DDR_ODT_OTHER_DIMM,
316 FSL_DDR_ODT_OTHER_DIMM,
317 FSL_DDR_ODT_OTHER_DIMM,
329 static const struct dynamic_odt dual_DS[4] = {
331 FSL_DDR_ODT_OTHER_DIMM,
332 FSL_DDR_ODT_OTHER_DIMM,
343 FSL_DDR_ODT_OTHER_DIMM,
344 FSL_DDR_ODT_OTHER_DIMM,
351 static const struct dynamic_odt dual_SD[4] = {
353 FSL_DDR_ODT_OTHER_DIMM,
354 FSL_DDR_ODT_OTHER_DIMM,
360 FSL_DDR_ODT_OTHER_DIMM,
361 FSL_DDR_ODT_OTHER_DIMM,
373 static const struct dynamic_odt dual_SS[4] = {
375 FSL_DDR_ODT_OTHER_DIMM,
376 FSL_DDR_ODT_OTHER_DIMM,
382 FSL_DDR_ODT_OTHER_DIMM,
383 FSL_DDR_ODT_OTHER_DIMM,
390 static const struct dynamic_odt dual_D0[4] = {
407 static const struct dynamic_odt dual_0D[4] = {
424 static const struct dynamic_odt dual_S0[4] = {
437 static const struct dynamic_odt dual_0S[4] = {
450 static const struct dynamic_odt odt_unknown[4] = {
477 unsigned int populate_memctl_options(int all_DIMMs_registered,
478 memctl_options_t *popts,
479 dimm_params_t *pdimm,
480 unsigned int ctrl_num)
483 char buffer[HWCONFIG_BUFFER_SIZE];
485 #if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
486 const struct dynamic_odt *pdodt = odt_unknown;
491 * Extract hwconfig from environment since we have not properly setup
492 * the environment but need it for ddr config params
494 if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
497 #if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
498 /* Chip select options. */
499 if (CONFIG_DIMM_SLOTS_PER_CTLR == 1) {
500 switch (pdimm[0].n_ranks) {
511 } else if (CONFIG_DIMM_SLOTS_PER_CTLR == 2) {
512 switch (pdimm[0].n_ranks) {
513 #ifdef CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
516 if (pdimm[1].n_ranks)
517 printf("Error: Quad- and Dual-rank DIMMs "
518 "cannot be used together\n");
522 switch (pdimm[1].n_ranks) {
535 switch (pdimm[1].n_ranks) {
548 switch (pdimm[1].n_ranks) {
561 /* Pick chip-select local options. */
562 for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
563 #if defined(CONFIG_FSL_DDR3) || defined(CONFIG_FSL_DDR2)
564 popts->cs_local_opts[i].odt_rd_cfg = pdodt[i].odt_rd_cfg;
565 popts->cs_local_opts[i].odt_wr_cfg = pdodt[i].odt_wr_cfg;
566 popts->cs_local_opts[i].odt_rtt_norm = pdodt[i].odt_rtt_norm;
567 popts->cs_local_opts[i].odt_rtt_wr = pdodt[i].odt_rtt_wr;
569 popts->cs_local_opts[i].odt_rd_cfg = FSL_DDR_ODT_NEVER;
570 popts->cs_local_opts[i].odt_wr_cfg = FSL_DDR_ODT_CS;
572 popts->cs_local_opts[i].auto_precharge = 0;
575 /* Pick interleaving mode. */
578 * 0 = no interleaving
579 * 1 = interleaving between 2 controllers
581 popts->memctl_interleaving = 0;
587 * 3 = superbank (only if CS interleaving is enabled)
589 popts->memctl_interleaving_mode = 0;
592 * 0: cacheline: bit 30 of the 36-bit physical addr selects the memctl
593 * 1: page: bit to the left of the column bits selects the memctl
594 * 2: bank: bit to the left of the bank bits selects the memctl
595 * 3: superbank: bit to the left of the chip select selects the memctl
597 * NOTE: ba_intlv (rank interleaving) is independent of memory
598 * controller interleaving; it is only within a memory controller.
599 * Must use superbank interleaving if rank interleaving is used and
600 * memory controller interleaving is enabled.
607 * 0x60 = CS0,CS1 + CS2,CS3
608 * 0x04 = CS0,CS1,CS2,CS3
610 popts->ba_intlv_ctl = 0;
612 /* Memory Organization Parameters */
613 popts->registered_dimm_en = all_DIMMs_registered;
615 /* Operational Mode Paramters */
618 popts->ECC_mode = 0; /* 0 = disabled, 1 = enabled */
619 #ifdef CONFIG_DDR_ECC
620 if (hwconfig_sub_f("fsl_ddr", "ecc", buf)) {
621 if (hwconfig_subarg_cmp_f("fsl_ddr", "ecc", "on", buf))
626 popts->ECC_init_using_memctl = 1; /* 0 = use DMA, 1 = use memctl */
633 #if defined(CONFIG_FSL_DDR1)
634 popts->DQS_config = 0;
635 #elif defined(CONFIG_FSL_DDR2) || defined(CONFIG_FSL_DDR3)
636 popts->DQS_config = 1;
639 /* Choose self-refresh during sleep. */
640 popts->self_refresh_in_sleep = 1;
642 /* Choose dynamic power management mode. */
643 popts->dynamic_power = 0;
646 * check first dimm for primary sdram width
647 * presuming all dimms are similar
648 * 0 = 64-bit, 1 = 32-bit, 2 = 16-bit
650 #if defined(CONFIG_FSL_DDR1) || defined(CONFIG_FSL_DDR2)
651 if (pdimm[0].n_ranks != 0) {
652 if ((pdimm[0].data_width >= 64) && \
653 (pdimm[0].data_width <= 72))
654 popts->data_bus_width = 0;
655 else if ((pdimm[0].data_width >= 32) || \
656 (pdimm[0].data_width <= 40))
657 popts->data_bus_width = 1;
659 panic("Error: data width %u is invalid!\n",
660 pdimm[0].data_width);
664 if (pdimm[0].n_ranks != 0) {
665 if (pdimm[0].primary_sdram_width == 64)
666 popts->data_bus_width = 0;
667 else if (pdimm[0].primary_sdram_width == 32)
668 popts->data_bus_width = 1;
669 else if (pdimm[0].primary_sdram_width == 16)
670 popts->data_bus_width = 2;
672 panic("Error: primary sdram width %u is invalid!\n",
673 pdimm[0].primary_sdram_width);
678 /* Choose burst length. */
679 #if defined(CONFIG_FSL_DDR3)
680 #if defined(CONFIG_E500MC)
681 popts->OTF_burst_chop_en = 0; /* on-the-fly burst chop disable */
682 popts->burst_length = DDR_BL8; /* Fixed 8-beat burst len */
684 if ((popts->data_bus_width == 1) || (popts->data_bus_width == 2)) {
685 /* 32-bit or 16-bit bus */
686 popts->OTF_burst_chop_en = 0;
687 popts->burst_length = DDR_BL8;
689 popts->OTF_burst_chop_en = 1; /* on-the-fly burst chop */
690 popts->burst_length = DDR_OTF; /* on-the-fly BC4 and BL8 */
694 popts->burst_length = DDR_BL4; /* has to be 4 for DDR2 */
697 /* Choose ddr controller address mirror mode */
698 #if defined(CONFIG_FSL_DDR3)
699 popts->mirrored_dimm = pdimm[0].mirrored_dimm;
702 /* Global Timing Parameters. */
703 debug("mclk_ps = %u ps\n", get_memory_clk_period_ps());
705 /* Pick a caslat override. */
706 popts->cas_latency_override = 0;
707 popts->cas_latency_override_value = 3;
708 if (popts->cas_latency_override) {
709 debug("using caslat override value = %u\n",
710 popts->cas_latency_override_value);
713 /* Decide whether to use the computed derated latency */
714 popts->use_derated_caslat = 0;
716 /* Choose an additive latency. */
717 popts->additive_latency_override = 0;
718 popts->additive_latency_override_value = 3;
719 if (popts->additive_latency_override) {
720 debug("using additive latency override value = %u\n",
721 popts->additive_latency_override_value);
727 * Factors to consider for 2T_EN:
728 * - number of DIMMs installed
729 * - number of components, number of active ranks
730 * - how much time you want to spend playing around
733 popts->threeT_en = 0;
735 /* for RDIMM, address parity enable */
739 * BSTTOPRE precharge interval
741 * Set this to 0 for global auto precharge
743 * FIXME: Should this be configured in picoseconds?
744 * Why it should be in ps: better understanding of this
745 * relative to actual DRAM timing parameters such as tRAS.
746 * e.g. tRAS(min) = 40 ns
748 popts->bstopre = 0x100;
750 /* Minimum CKE pulse width -- tCKE(MIN) */
751 popts->tCKE_clock_pulse_width_ps
752 = mclk_to_picos(FSL_DDR_MIN_TCKE_PULSE_WIDTH_DDR);
755 * Window for four activates -- tFAW
757 * FIXME: UM: applies only to DDR2/DDR3 with eight logical banks only
758 * FIXME: varies depending upon number of column addresses or data
759 * FIXME: width, was considering looking at pdimm->primary_sdram_width
761 #if defined(CONFIG_FSL_DDR1)
762 popts->tFAW_window_four_activates_ps = mclk_to_picos(1);
764 #elif defined(CONFIG_FSL_DDR2)
766 * x4/x8; some datasheets have 35000
767 * x16 wide columns only? Use 50000?
769 popts->tFAW_window_four_activates_ps = 37500;
771 #elif defined(CONFIG_FSL_DDR3)
772 popts->tFAW_window_four_activates_ps = pdimm[0].tFAW_ps;
776 #if defined(CONFIG_FSL_DDR3)
778 * due to ddr3 dimm is fly-by topology
779 * we suggest to enable write leveling to
780 * meet the tQDSS under different loading.
784 popts->wrlvl_override = 0;
788 * Check interleaving configuration from environment.
789 * Please refer to doc/README.fsl-ddr for the detail.
791 * If memory controller interleaving is enabled, then the data
792 * bus widths must be programmed identically for all memory controllers.
794 * XXX: Attempt to set all controllers to the same chip select
795 * interleaving mode. It will do a best effort to get the
796 * requested ranks interleaved together such that the result
797 * should be a subset of the requested configuration.
799 #if (CONFIG_NUM_DDR_CONTROLLERS > 1)
800 if (!hwconfig_sub_f("fsl_ddr", "ctlr_intlv", buf))
803 if (pdimm[0].n_ranks == 0) {
804 printf("There is no rank on CS0 for controller %d.\n", ctrl_num);
805 popts->memctl_interleaving = 0;
808 popts->memctl_interleaving = 1;
810 * test null first. if CONFIG_HWCONFIG is not defined
811 * hwconfig_arg_cmp returns non-zero
813 if (hwconfig_subarg_cmp_f("fsl_ddr", "ctlr_intlv",
815 popts->memctl_interleaving = 0;
816 debug("memory controller interleaving disabled.\n");
817 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
820 popts->memctl_interleaving_mode =
821 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
822 0 : FSL_DDR_CACHE_LINE_INTERLEAVING;
823 popts->memctl_interleaving =
824 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
826 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
829 popts->memctl_interleaving_mode =
830 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
831 0 : FSL_DDR_PAGE_INTERLEAVING;
832 popts->memctl_interleaving =
833 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
835 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
838 popts->memctl_interleaving_mode =
839 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
840 0 : FSL_DDR_BANK_INTERLEAVING;
841 popts->memctl_interleaving =
842 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
844 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
847 popts->memctl_interleaving_mode =
848 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
849 0 : FSL_DDR_SUPERBANK_INTERLEAVING;
850 popts->memctl_interleaving =
851 ((CONFIG_NUM_DDR_CONTROLLERS == 3) && ctrl_num == 2) ?
853 #if (CONFIG_NUM_DDR_CONTROLLERS == 3)
854 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
857 popts->memctl_interleaving_mode =
858 FSL_DDR_3WAY_1KB_INTERLEAVING;
859 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
862 popts->memctl_interleaving_mode =
863 FSL_DDR_3WAY_4KB_INTERLEAVING;
864 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
867 popts->memctl_interleaving_mode =
868 FSL_DDR_3WAY_8KB_INTERLEAVING;
869 #elif (CONFIG_NUM_DDR_CONTROLLERS == 4)
870 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
873 popts->memctl_interleaving_mode =
874 FSL_DDR_4WAY_1KB_INTERLEAVING;
875 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
878 popts->memctl_interleaving_mode =
879 FSL_DDR_4WAY_4KB_INTERLEAVING;
880 } else if (hwconfig_subarg_cmp_f("fsl_ddr",
883 popts->memctl_interleaving_mode =
884 FSL_DDR_4WAY_8KB_INTERLEAVING;
887 popts->memctl_interleaving = 0;
888 printf("hwconfig has unrecognized parameter for ctlr_intlv.\n");
892 if ((hwconfig_sub_f("fsl_ddr", "bank_intlv", buf)) &&
893 (CONFIG_CHIP_SELECTS_PER_CTRL > 1)) {
894 /* test null first. if CONFIG_HWCONFIG is not defined,
895 * hwconfig_subarg_cmp_f returns non-zero */
896 if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
898 debug("bank interleaving disabled.\n");
899 else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
901 popts->ba_intlv_ctl = FSL_DDR_CS0_CS1;
902 else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
904 popts->ba_intlv_ctl = FSL_DDR_CS2_CS3;
905 else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
906 "cs0_cs1_and_cs2_cs3", buf))
907 popts->ba_intlv_ctl = FSL_DDR_CS0_CS1_AND_CS2_CS3;
908 else if (hwconfig_subarg_cmp_f("fsl_ddr", "bank_intlv",
909 "cs0_cs1_cs2_cs3", buf))
910 popts->ba_intlv_ctl = FSL_DDR_CS0_CS1_CS2_CS3;
912 printf("hwconfig has unrecognized parameter for bank_intlv.\n");
913 switch (popts->ba_intlv_ctl & FSL_DDR_CS0_CS1_CS2_CS3) {
914 case FSL_DDR_CS0_CS1_CS2_CS3:
915 #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
916 if (pdimm[0].n_ranks < 4) {
917 popts->ba_intlv_ctl = 0;
918 printf("Not enough bank(chip-select) for "
919 "CS0+CS1+CS2+CS3 on controller %d, "
920 "interleaving disabled!\n", ctrl_num);
922 #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
923 #ifdef CONFIG_FSL_DDR_FIRST_SLOT_QUAD_CAPABLE
924 if (pdimm[0].n_ranks == 4)
927 if ((pdimm[0].n_ranks < 2) && (pdimm[1].n_ranks < 2)) {
928 popts->ba_intlv_ctl = 0;
929 printf("Not enough bank(chip-select) for "
930 "CS0+CS1+CS2+CS3 on controller %d, "
931 "interleaving disabled!\n", ctrl_num);
933 if (pdimm[0].capacity != pdimm[1].capacity) {
934 popts->ba_intlv_ctl = 0;
935 printf("Not identical DIMM size for "
936 "CS0+CS1+CS2+CS3 on controller %d, "
937 "interleaving disabled!\n", ctrl_num);
941 case FSL_DDR_CS0_CS1:
942 if (pdimm[0].n_ranks < 2) {
943 popts->ba_intlv_ctl = 0;
944 printf("Not enough bank(chip-select) for "
945 "CS0+CS1 on controller %d, "
946 "interleaving disabled!\n", ctrl_num);
949 case FSL_DDR_CS2_CS3:
950 #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
951 if (pdimm[0].n_ranks < 4) {
952 popts->ba_intlv_ctl = 0;
953 printf("Not enough bank(chip-select) for CS2+CS3 "
954 "on controller %d, interleaving disabled!\n", ctrl_num);
956 #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
957 if (pdimm[1].n_ranks < 2) {
958 popts->ba_intlv_ctl = 0;
959 printf("Not enough bank(chip-select) for CS2+CS3 "
960 "on controller %d, interleaving disabled!\n", ctrl_num);
964 case FSL_DDR_CS0_CS1_AND_CS2_CS3:
965 #if (CONFIG_DIMM_SLOTS_PER_CTLR == 1)
966 if (pdimm[0].n_ranks < 4) {
967 popts->ba_intlv_ctl = 0;
968 printf("Not enough bank(CS) for CS0+CS1 and "
969 "CS2+CS3 on controller %d, "
970 "interleaving disabled!\n", ctrl_num);
972 #elif (CONFIG_DIMM_SLOTS_PER_CTLR == 2)
973 if ((pdimm[0].n_ranks < 2) || (pdimm[1].n_ranks < 2)) {
974 popts->ba_intlv_ctl = 0;
975 printf("Not enough bank(CS) for CS0+CS1 and "
976 "CS2+CS3 on controller %d, "
977 "interleaving disabled!\n", ctrl_num);
982 popts->ba_intlv_ctl = 0;
987 if (hwconfig_sub_f("fsl_ddr", "addr_hash", buf)) {
988 if (hwconfig_subarg_cmp_f("fsl_ddr", "addr_hash", "null", buf))
989 popts->addr_hash = 0;
990 else if (hwconfig_subarg_cmp_f("fsl_ddr", "addr_hash",
992 popts->addr_hash = 1;
995 if (pdimm[0].n_ranks == 4)
996 popts->quad_rank_present = 1;
998 ddr_freq = get_ddr_freq(0) / 1000000;
999 if (popts->registered_dimm_en) {
1000 popts->rcw_override = 1;
1001 popts->rcw_1 = 0x000a5a00;
1002 if (ddr_freq <= 800)
1003 popts->rcw_2 = 0x00000000;
1004 else if (ddr_freq <= 1066)
1005 popts->rcw_2 = 0x00100000;
1006 else if (ddr_freq <= 1333)
1007 popts->rcw_2 = 0x00200000;
1009 popts->rcw_2 = 0x00300000;
1012 fsl_ddr_board_options(popts, pdimm, ctrl_num);
1017 void check_interleaving_options(fsl_ddr_info_t *pinfo)
1019 int i, j, k, check_n_ranks, intlv_invalid = 0;
1020 unsigned int check_intlv, check_n_row_addr, check_n_col_addr;
1021 unsigned long long check_rank_density;
1022 struct dimm_params_s *dimm;
1024 * Check if all controllers are configured for memory
1025 * controller interleaving. Identical dimms are recommended. At least
1026 * the size, row and col address should be checked.
1029 check_n_ranks = pinfo->dimm_params[0][0].n_ranks;
1030 check_rank_density = pinfo->dimm_params[0][0].rank_density;
1031 check_n_row_addr = pinfo->dimm_params[0][0].n_row_addr;
1032 check_n_col_addr = pinfo->dimm_params[0][0].n_col_addr;
1033 check_intlv = pinfo->memctl_opts[0].memctl_interleaving_mode;
1034 for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
1035 dimm = &pinfo->dimm_params[i][0];
1036 if (!pinfo->memctl_opts[i].memctl_interleaving) {
1038 } else if (((check_rank_density != dimm->rank_density) ||
1039 (check_n_ranks != dimm->n_ranks) ||
1040 (check_n_row_addr != dimm->n_row_addr) ||
1041 (check_n_col_addr != dimm->n_col_addr) ||
1043 pinfo->memctl_opts[i].memctl_interleaving_mode))){
1051 if (intlv_invalid) {
1052 for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
1053 pinfo->memctl_opts[i].memctl_interleaving = 0;
1054 printf("Not all DIMMs are identical. "
1055 "Memory controller interleaving disabled.\n");
1057 switch (check_intlv) {
1058 case FSL_DDR_CACHE_LINE_INTERLEAVING:
1059 case FSL_DDR_PAGE_INTERLEAVING:
1060 case FSL_DDR_BANK_INTERLEAVING:
1061 case FSL_DDR_SUPERBANK_INTERLEAVING:
1062 if (3 == CONFIG_NUM_DDR_CONTROLLERS)
1065 k = CONFIG_NUM_DDR_CONTROLLERS;
1067 case FSL_DDR_3WAY_1KB_INTERLEAVING:
1068 case FSL_DDR_3WAY_4KB_INTERLEAVING:
1069 case FSL_DDR_3WAY_8KB_INTERLEAVING:
1070 case FSL_DDR_4WAY_1KB_INTERLEAVING:
1071 case FSL_DDR_4WAY_4KB_INTERLEAVING:
1072 case FSL_DDR_4WAY_8KB_INTERLEAVING:
1074 k = CONFIG_NUM_DDR_CONTROLLERS;
1077 debug("%d of %d controllers are interleaving.\n", j, k);
1079 for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++)
1080 pinfo->memctl_opts[i].memctl_interleaving = 0;
1081 printf("Not all controllers have compatible "
1082 "interleaving mode. All disabled.\n");
1085 debug("Checking interleaving options completed\n");
1088 int fsl_use_spd(void)
1092 #ifdef CONFIG_DDR_SPD
1093 char buffer[HWCONFIG_BUFFER_SIZE];
1097 * Extract hwconfig from environment since we have not properly setup
1098 * the environment but need it for ddr config params
1100 if (getenv_f("hwconfig", buffer, sizeof(buffer)) > 0)
1103 /* if hwconfig is not enabled, or "sdram" is not defined, use spd */
1104 if (hwconfig_sub_f("fsl_ddr", "sdram", buf)) {
1105 if (hwconfig_subarg_cmp_f("fsl_ddr", "sdram", "spd", buf))
1107 else if (hwconfig_subarg_cmp_f("fsl_ddr", "sdram",