Commit 6b1e1254f326940e5b65c7029f71b964bdf28fd4

Authored by York Sun
Committed by Tom Rini
1 parent 6b9e309a8a

driver/ddr: Add 256 byte interleaving support

Freescale LayerScape SoCs support controller interleaving on 256 byte size.
This interleaving is mandoratory.

Signed-off-by: York Sun <yorksun@freescale.com>

Showing 6 changed files with 26 additions and 2 deletions Side-by-side Diff

... ... @@ -497,6 +497,11 @@
497 497 same as CONFIG_SYS_DDR_SDRAM_BASE for all Power SoCs. But
498 498 it could be different for ARM SoCs.
499 499  
  500 + CONFIG_SYS_FSL_DDR_INTLV_256B
  501 + DDR controller interleaving on 256-byte. This is a special
  502 + interleaving mode, handled by Dickens for Freescale layerscape
  503 + SoCs with ARM core.
  504 +
500 505 - Intel Monahans options:
501 506 CONFIG_SYS_MONAHANS_RUN_MODE_OSC_RATIO
502 507  
drivers/ddr/fsl/ctrl_regs.c
... ... @@ -145,6 +145,7 @@
145 145 if (!popts->memctl_interleaving)
146 146 break;
147 147 switch (popts->memctl_interleaving_mode) {
  148 + case FSL_DDR_256B_INTERLEAVING:
148 149 case FSL_DDR_CACHE_LINE_INTERLEAVING:
149 150 case FSL_DDR_PAGE_INTERLEAVING:
150 151 case FSL_DDR_BANK_INTERLEAVING:
drivers/ddr/fsl/main.c
... ... @@ -291,6 +291,7 @@
291 291 for (i = 0; i < CONFIG_NUM_DDR_CONTROLLERS; i++) {
292 292 if (pinfo->memctl_opts[i].memctl_interleaving) {
293 293 switch (pinfo->memctl_opts[i].memctl_interleaving_mode) {
  294 + case FSL_DDR_256B_INTERLEAVING:
294 295 case FSL_DDR_CACHE_LINE_INTERLEAVING:
295 296 case FSL_DDR_PAGE_INTERLEAVING:
296 297 case FSL_DDR_BANK_INTERLEAVING:
drivers/ddr/fsl/options.c
... ... @@ -818,21 +818,33 @@
818 818 * If memory controller interleaving is enabled, then the data
819 819 * bus widths must be programmed identically for all memory controllers.
820 820 *
821   - * XXX: Attempt to set all controllers to the same chip select
  821 + * Attempt to set all controllers to the same chip select
822 822 * interleaving mode. It will do a best effort to get the
823 823 * requested ranks interleaved together such that the result
824 824 * should be a subset of the requested configuration.
  825 + *
  826 + * if CONFIG_SYS_FSL_DDR_INTLV_256B is defined, mandatory interleaving
  827 + * with 256 Byte is enabled.
825 828 */
826 829 #if (CONFIG_NUM_DDR_CONTROLLERS > 1)
827 830 if (!hwconfig_sub_f("fsl_ddr", "ctlr_intlv", buf))
  831 +#ifdef CONFIG_SYS_FSL_DDR_INTLV_256B
  832 + ;
  833 +#else
828 834 goto done;
829   -
  835 +#endif
830 836 if (pdimm[0].n_ranks == 0) {
831 837 printf("There is no rank on CS0 for controller %d.\n", ctrl_num);
832 838 popts->memctl_interleaving = 0;
833 839 goto done;
834 840 }
835 841 popts->memctl_interleaving = 1;
  842 +#ifdef CONFIG_SYS_FSL_DDR_INTLV_256B
  843 + popts->memctl_interleaving_mode = FSL_DDR_256B_INTERLEAVING;
  844 + popts->memctl_interleaving = 1;
  845 + debug("256 Byte interleaving\n");
  846 + goto done;
  847 +#endif
836 848 /*
837 849 * test null first. if CONFIG_HWCONFIG is not defined
838 850 * hwconfig_arg_cmp returns non-zero
... ... @@ -1085,6 +1097,7 @@
1085 1097 "Memory controller interleaving disabled.\n");
1086 1098 } else {
1087 1099 switch (check_intlv) {
  1100 + case FSL_DDR_256B_INTERLEAVING:
1088 1101 case FSL_DDR_CACHE_LINE_INTERLEAVING:
1089 1102 case FSL_DDR_PAGE_INTERLEAVING:
1090 1103 case FSL_DDR_BANK_INTERLEAVING:
drivers/ddr/fsl/util.c
... ... @@ -228,6 +228,9 @@
228 228 puts(" DDR Controller Interleaving Mode: ");
229 229  
230 230 switch ((cs0_config >> 24) & 0xf) {
  231 + case FSL_DDR_256B_INTERLEAVING:
  232 + puts("256B");
  233 + break;
231 234 case FSL_DDR_CACHE_LINE_INTERLEAVING:
232 235 puts("cache line");
233 236 break;
include/fsl_ddr_sdram.h
... ... @@ -76,6 +76,7 @@
76 76 #define FSL_DDR_PAGE_INTERLEAVING 0x1
77 77 #define FSL_DDR_BANK_INTERLEAVING 0x2
78 78 #define FSL_DDR_SUPERBANK_INTERLEAVING 0x3
  79 +#define FSL_DDR_256B_INTERLEAVING 0x8
79 80 #define FSL_DDR_3WAY_1KB_INTERLEAVING 0xA
80 81 #define FSL_DDR_3WAY_4KB_INTERLEAVING 0xC
81 82 #define FSL_DDR_3WAY_8KB_INTERLEAVING 0xD