public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/6] p1014rdb: set ddr bus width properly depending on SVR
@ 2012-08-13 18:10 Matthew McClintock
  2012-08-13 18:10 ` [U-Boot] [PATCH 2/6] p1010rdb: fix ddr values for p1014rdb (setting bus width to 16bit) Matthew McClintock
                   ` (4 more replies)
  0 siblings, 5 replies; 20+ messages in thread
From: Matthew McClintock @ 2012-08-13 18:10 UTC (permalink / raw)
  To: u-boot

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>
---
 arch/powerpc/include/asm/fsl_ddr_sdram.h      |    1 +
 nand_spl/board/freescale/p1010rdb/nand_boot.c |   11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/powerpc/include/asm/fsl_ddr_sdram.h b/arch/powerpc/include/asm/fsl_ddr_sdram.h
index 93639ba..157ae24 100644
--- a/arch/powerpc/include/asm/fsl_ddr_sdram.h
+++ b/arch/powerpc/include/asm/fsl_ddr_sdram.h
@@ -88,6 +88,7 @@ typedef ddr3_spd_eeprom_t generic_spd_eeprom_t;
 #define SDRAM_CFG_SDRAM_TYPE_MASK	0x07000000
 #define SDRAM_CFG_SDRAM_TYPE_SHIFT	24
 #define SDRAM_CFG_DYN_PWR		0x00200000
+#define SDRAM_CFG_DBW_MASK		0x00180000
 #define SDRAM_CFG_32_BE			0x00080000
 #define SDRAM_CFG_16_BE			0x00100000
 #define SDRAM_CFG_8_BE			0x00040000
diff --git a/nand_spl/board/freescale/p1010rdb/nand_boot.c b/nand_spl/board/freescale/p1010rdb/nand_boot.c
index 16eeb61..1f89ab5 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);
 
-- 
1.7.9.7

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2012-08-20 16:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-13 18:10 [U-Boot] [PATCH 1/6] p1014rdb: set ddr bus width properly depending on SVR Matthew McClintock
2012-08-13 18:10 ` [U-Boot] [PATCH 2/6] p1010rdb: fix ddr values for p1014rdb (setting bus width to 16bit) Matthew McClintock
2012-08-13 18:10 ` [U-Boot] [PATCH 3/6] powerpc/p1010rdb: nandboot: compare SVR properly Matthew McClintock
2012-08-13 18:10 ` [U-Boot] [PATCH 4/6] nand_spl: update udelay for Freescale boards Matthew McClintock
2012-08-13 22:56   ` Scott Wood
2012-08-13 23:14     ` McClintock Matthew-B29882
2012-08-13 23:22       ` Scott Wood
2012-08-13 23:28         ` McClintock Matthew-B29882
2012-08-13 23:35           ` Scott Wood
2012-08-13 18:10 ` [U-Boot] [PATCH 5/6] nand_spl: p1023rds: wait before enabling DDR controller Matthew McClintock
2012-08-13 18:18   ` Scott Wood
2012-08-13 18:50     ` McClintock Matthew-B29882
2012-08-13 18:10 ` [U-Boot] [PATCH 6/6] nand_spl: change out_be32 to raw_writel and depend on subsequent sync Matthew McClintock
2012-08-13 23:23   ` Scott Wood
2012-08-13 23:31     ` McClintock Matthew-B29882
2012-08-13 23:34       ` Scott Wood
2012-08-13 23:37         ` McClintock Matthew-B29882
2012-08-18 19:05     ` Scott Wood
2012-08-20 16:11       ` Andy Fleming
2012-08-20 16:51         ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox