mpc83xx: Add bank configuration to FSL spd_sdram.c
authorJerry Van Baren <gvb.uboot@gmail.com>
Fri, 13 Mar 2009 15:40:10 +0000 (11:40 -0400)
committerKim Phillips <kim.phillips@freescale.com>
Sat, 14 Mar 2009 22:44:07 +0000 (17:44 -0500)
The routine assumed 4 bank SDRAMs, enhance to configure for 4 or 8
bank SDRAMs.

Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
Acked-by: Dave Liu <daveliu@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
cpu/mpc83xx/spd_sdram.c

index ff15cda7a86bcccf0c2ff6584119aac40383a0ee..4704d2006f592b7d785111e8a918b5217594dfe6 100644 (file)
@@ -219,7 +219,8 @@ long int spd_sdram()
        ddr->cs_config[0] = ( 1 << 31
                            | (odt_rd_cfg << 20)
                            | (odt_wr_cfg << 16)
-                           | (spd.nrow_addr - 12) << 8
+                           | ((spd.nbanks == 8 ? 1 : 0) << 14)
+                           | ((spd.nrow_addr - 12) << 8)
                            | (spd.ncol_addr - 8) );
        debug("\n");
        debug("cs0_bnds = 0x%08x\n",ddr->csbnds[0].csbnds);
@@ -231,8 +232,9 @@ long int spd_sdram()
                ddr->cs_config[1] = ( 1<<31
                                    | (odt_rd_cfg << 20)
                                    | (odt_wr_cfg << 16)
-                                   | (spd.nrow_addr-12) << 8
-                                   | (spd.ncol_addr-8) );
+                                   | ((spd.nbanks == 8 ? 1 : 0) << 14)
+                                   | ((spd.nrow_addr - 12) << 8)
+                                   | (spd.ncol_addr - 8) );
                debug("cs1_bnds = 0x%08x\n",ddr->csbnds[1].csbnds);
                debug("cs1_config = 0x%08x\n",ddr->cs_config[1]);
        }
@@ -242,7 +244,8 @@ long int spd_sdram()
        ddr->cs_config[2] = ( 1 << 31
                            | (odt_rd_cfg << 20)
                            | (odt_wr_cfg << 16)
-                           | (spd.nrow_addr - 12) << 8
+                           | ((spd.nbanks == 8 ? 1 : 0) << 14)
+                           | ((spd.nrow_addr - 12) << 8)
                            | (spd.ncol_addr - 8) );
        debug("\n");
        debug("cs2_bnds = 0x%08x\n",ddr->csbnds[2].csbnds);
@@ -254,8 +257,9 @@ long int spd_sdram()
                ddr->cs_config[3] = ( 1<<31
                                    | (odt_rd_cfg << 20)
                                    | (odt_wr_cfg << 16)
-                                   | (spd.nrow_addr-12) << 8
-                                   | (spd.ncol_addr-8) );
+                                   | ((spd.nbanks == 8 ? 1 : 0) << 14)
+                                   | ((spd.nrow_addr - 12) << 8)
+                                   | (spd.ncol_addr - 8) );
                debug("cs3_bnds = 0x%08x\n",ddr->csbnds[3].csbnds);
                debug("cs3_config = 0x%08x\n",ddr->cs_config[3]);
        }