summaryrefslogtreecommitdiff
path: root/nand_spl
diff options
context:
space:
mode:
authorMatthew McClintock <msm@freescale.com>2012-08-13 08:10:37 +0000
committerAndy Fleming <afleming@freescale.com>2012-08-23 10:24:16 -0500
commit9c6b47d53ed329b31c5f26e9ec710f67559c07f0 (patch)
treee249bf392017d29d3a90389685ac2f972c5fc4a9 /nand_spl
parentbe7bebeac24f33bd7eef2f5047579c1a680d8df1 (diff)
p1014rdb: set ddr bus width properly depending on SVR
Currently, for NAND boot for the P1010/4RDB we hard code the DDR configuration. We can still dynamically set the DDR bus width in the nand spl so the P1010/4RDB boards can boot from the same u-boot image Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'nand_spl')
-rw-r--r--nand_spl/board/freescale/p1010rdb/nand_boot.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/nand_spl/board/freescale/p1010rdb/nand_boot.c b/nand_spl/board/freescale/p1010rdb/nand_boot.c
index 16eeb61d85..1f89ab5816 100644
--- a/nand_spl/board/freescale/p1010rdb/nand_boot.c
+++ b/nand_spl/board/freescale/p1010rdb/nand_boot.c
@@ -35,6 +35,7 @@ unsigned long ddr_freq_mhz;
void sdram_init(void)
{
ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC85xx_DDR_ADDR;
+ u32 svr = mfspr(SPRN_SVR);
out_be32(&ddr->sdram_cfg, CONFIG_SYS_DDR_CONTROL | SDRAM_CFG_32_BE);
out_be32(&ddr->cs0_bnds, CONFIG_SYS_DDR_CS0_BNDS);
@@ -70,6 +71,16 @@ void sdram_init(void)
out_be32(&ddr->timing_cfg_5, CONFIG_SYS_DDR_TIMING_5);
out_be32(&ddr->ddr_zq_cntl, CONFIG_SYS_DDR_ZQ_CONTROL);
+ /* P1014 and it's derivatives support max 16bit DDR width */
+ if (svr == SVR_P1014) {
+ __raw_writel(ddr->sdram_cfg & ~SDRAM_CFG_DBW_MASK, &ddr->sdram_cfg);
+ __raw_writel(ddr->sdram_cfg | SDRAM_CFG_16_BE, &ddr->sdram_cfg);
+ /* For CS0_BNDS we divide the start and end address by 2, so we can just
+ * shift the entire register to achieve the desired result and the mask
+ * the value so we don't write reserved fields */
+ __raw_writel((CONFIG_SYS_DDR_CS0_BNDS >> 1) & 0x0fff0fff, &ddr->cs0_bnds);
+ }
+
/* mimic 500us delay, with busy isync() loop */
udelay(100);