armv8/ls2080ardb: Update DDR settings for four chip-select case
authorYork Sun <yorksun@freescale.com>
Wed, 4 Nov 2015 18:03:23 +0000 (10:03 -0800)
committerYork Sun <yorksun@freescale.com>
Mon, 14 Dec 2015 02:27:28 +0000 (18:27 -0800)
When 4 chip-selects are used, vref should use range 1 and CDT uses 80 ohm,
and 2T timing is enabled.

Signed-off-by: York Sun <yorksun@freescale.com>
board/freescale/ls2080ardb/ddr.c

index ae681de35eb785ee4f6b352112dab9703bf47467..76f3b59e4e9d04fb7154af25872cf19b7dbfb7ec 100644 (file)
@@ -134,10 +134,18 @@ found:
        popts->zq_en = 1;
 
        if (ddr_freq < 2350) {
-               popts->ddr_cdr1 = DDR_CDR1_DHC_EN |
-                                 DDR_CDR1_ODT(DDR_CDR_ODT_60ohm);
-               popts->ddr_cdr2 = DDR_CDR2_ODT(DDR_CDR_ODT_60ohm) |
-                                 DDR_CDR2_VREF_RANGE_2;
+               if (pdimm[0].n_ranks == 2 && pdimm[1].n_ranks == 2) {
+                       /* four chip-selects */
+                       popts->ddr_cdr1 = DDR_CDR1_DHC_EN |
+                                         DDR_CDR1_ODT(DDR_CDR_ODT_80ohm);
+                       popts->ddr_cdr2 = DDR_CDR2_ODT(DDR_CDR_ODT_80ohm);
+                       popts->twot_en = 1;     /* enable 2T timing */
+               } else {
+                       popts->ddr_cdr1 = DDR_CDR1_DHC_EN |
+                                         DDR_CDR1_ODT(DDR_CDR_ODT_60ohm);
+                       popts->ddr_cdr2 = DDR_CDR2_ODT(DDR_CDR_ODT_60ohm) |
+                                         DDR_CDR2_VREF_RANGE_2;
+               }
        } else {
                popts->ddr_cdr1 = DDR_CDR1_DHC_EN |
                                  DDR_CDR1_ODT(DDR_CDR_ODT_100ohm);