]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
powerpc/mpc8xxx: Move DDR RCW overriding to common code
authorYork Sun <yorksun@freescale.com>
Wed, 24 Aug 2011 16:40:26 +0000 (09:40 -0700)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 30 Sep 2011 00:01:06 +0000 (19:01 -0500)
DDR RCW varies at different speeds. It is common for all platform. Move it
out from corenet_ds.

Signed-off-by: York Sun <yorksun@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/cpu/mpc8xxx/ddr/options.c
board/freescale/corenet_ds/ddr.c

index bd9c4663e794733222a6ea693f5f455d514ebb47..89dc479a391c2a157293b915275918cee85d3c82 100644 (file)
@@ -272,6 +272,7 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
        char buffer[HWCONFIG_BUFFER_SIZE];
        char *buf = NULL;
        const dynamic_odt_t *pdodt = odt_unknown;
+       ulong ddr_freq;
 
        /*
         * Extract hwconfig from environment since we have not properly setup
@@ -716,6 +717,20 @@ unsigned int populate_memctl_options(int all_DIMMs_registered,
        if (pdimm[0].n_ranks == 4)
                popts->quad_rank_present = 1;
 
+       ddr_freq = get_ddr_freq(0) / 1000000;
+       if (popts->registered_dimm_en) {
+               popts->rcw_override = 1;
+               popts->rcw_1 = 0x000a5a00;
+               if (ddr_freq <= 800)
+                       popts->rcw_2 = 0x00000000;
+               else if (ddr_freq <= 1066)
+                       popts->rcw_2 = 0x00100000;
+               else if (ddr_freq <= 1333)
+                       popts->rcw_2 = 0x00200000;
+               else
+                       popts->rcw_2 = 0x00300000;
+       }
+
        fsl_ddr_board_options(popts, pdimm, ctrl_num);
 
        return 0;
index b93701571b7fd19ac7c8fc46149d1e6f9559f07d..258ed1f1e79d230ae1d6dfc985721413ca9b63d3 100644 (file)
@@ -223,20 +223,6 @@ void fsl_ddr_board_options(memctl_options_t *popts,
 
        /* DHC_EN =1, ODT = 60 Ohm */
        popts->ddr_cdr1 = DDR_CDR1_DHC_EN;
-
-       /* override SPD values. rcw_2 should vary at differnt speed */
-       if (pdimm[0].registered_dimm == 1) {
-               popts->rcw_override = 1;
-               popts->rcw_1 = 0x000a5a00;
-               if (ddr_freq <= 800)
-                       popts->rcw_2 = 0x00000000;
-               else if (ddr_freq <= 1066)
-                       popts->rcw_2 = 0x00100000;
-               else if (ddr_freq <= 1333)
-                       popts->rcw_2 = 0x00200000;
-               else
-                       popts->rcw_2 = 0x00300000;
-       }
 }
 
 phys_size_t initdram(int board_type)