The new DDR2 SPD spec is backwards-compatible with the old one, but
there are DIMMs which are being produced which have new SPD version
fields that fail to work with U-boot.

To make the code a bit more readable, we add some human-readable
SPD_DIMM_TYPE_* constants.

Signed-off-by: Kyle Moffett <kyle.d.moff...@boeing.com>
---
 common/ddr_spd.c                   |    4 ++--
 cpu/mpc8xxx/ddr/ddr2_dimm_params.c |   30 ++++++++++++++++++++++--------
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/common/ddr_spd.c b/common/ddr_spd.c
index c058e4f..f7a482e 100644
--- a/common/ddr_spd.c
+++ b/common/ddr_spd.c
@@ -18,9 +18,9 @@ spd_check(const u8 *buf, u8 spd_rev, u8 spd_cksum)
 
        /*
         * Check SPD revision supported
-        * Rev 1.2 or less supported by this code
+        * Rev 1.3 or less supported by this code
         */
-       if (spd_rev > 0x12) {
+       if (spd_rev > 0x13) {
                printf("SPD revision %02X not supported by this code\n",
                       spd_rev);
                return 1;
diff --git a/cpu/mpc8xxx/ddr/ddr2_dimm_params.c 
b/cpu/mpc8xxx/ddr/ddr2_dimm_params.c
index d9d0fa7..2d40a60 100644
--- a/cpu/mpc8xxx/ddr/ddr2_dimm_params.c
+++ b/cpu/mpc8xxx/ddr/ddr2_dimm_params.c
@@ -9,6 +9,17 @@
 #include <common.h>
 #include <asm/fsl_ddr_sdram.h>
 
+/* These are all the types defined by the JEDEC DDR2 SPD 1.3 spec */
+#define SPD_DIMM_TYPE_UNDEFINED                0x00
+#define SPD_DIMM_TYPE_RDIMM            0x01
+#define SPD_DIMM_TYPE_UDIMM            0x02
+#define SPD_DIMM_TYPE_SO_DIMM          0x04
+#define SPD_DIMM_TYPE_72B_SO_CDIMM     0x06
+#define SPD_DIMM_TYPE_72B_SO_RDIMM     0x07
+#define SPD_DIMM_TYPE_MICRO_DIMM       0x08
+#define SPD_DIMM_TYPE_MINI_RDIMM       0x10
+#define SPD_DIMM_TYPE_MINI_UDIMM       0x20
+
 #include "ddr.h"
 /*
  * Calculate the Density of each Physical Rank.
@@ -250,20 +261,23 @@ ddr_compute_dimm_parameters(const ddr2_spd_eeprom_t *spd,
        pdimm->primary_sdram_width = spd->primw;
        pdimm->ec_sdram_width = spd->ecw;
 
-       /* FIXME: what about registered SO-DIMM? */
+       /* These are all the types defined by the JEDEC DDR2 SPD 1.3 spec */
        switch (spd->dimm_type) {
-       case 0x01:      /* RDIMM */
-       case 0x10:      /* Mini-RDIMM */
-               pdimm->registered_dimm = 1; /* register buffered */
+       case SPD_DIMM_TYPE_RDIMM:
+       case SPD_DIMM_TYPE_72B_SO_RDIMM:
+       case SPD_DIMM_TYPE_MINI_RDIMM:
+               /* Registered/buffered DIMMs */
+               pdimm->registered_dimm = 1;
                break;
 
-       case 0x02:      /* UDIMM */
-       case 0x04:      /* SO-DIMM */
-       case 0x08:      /* Micro-DIMM */
-       case 0x20:      /* Mini-UDIMM */
+       case SPD_DIMM_TYPE_UDIMM:
+       case SPD_DIMM_TYPE_SO_DIMM:
+       case SPD_DIMM_TYPE_MICRO_DIMM:
+       case SPD_DIMM_TYPE_MINI_UDIMM:
                pdimm->registered_dimm = 0;     /* unbuffered */
                break;
 
+       case SPD_DIMM_TYPE_72B_SO_CDIMM:
        default:
                printf("unknown dimm_type 0x%02X\n", spd->dimm_type);
                return 1;
-- 
1.7.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to