From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/6] nand_spl: p1023rds: wait before enabling DDR controller
Date: Mon, 13 Aug 2012 13:18:59 -0500 [thread overview]
Message-ID: <50294513.3050201@freescale.com> (raw)
In-Reply-To: <1344881442-22671-5-git-send-email-msm@freescale.com>
On 08/13/2012 01:10 PM, Matthew McClintock wrote:
> We have a requirement to wait a period of time before enabling the
> DDR controller
>
> Signed-off-by: Matthew McClintock <msm@freescale.com>
> ---
> nand_spl/board/freescale/p1023rds/Makefile | 6 +++++-
> nand_spl/board/freescale/p1023rds/nand_boot.c | 14 ++++++++++++--
> 2 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/nand_spl/board/freescale/p1023rds/Makefile b/nand_spl/board/freescale/p1023rds/Makefile
> index 168e868..da43521 100644
> --- a/nand_spl/board/freescale/p1023rds/Makefile
> +++ b/nand_spl/board/freescale/p1023rds/Makefile
> @@ -34,7 +34,8 @@ CFLAGS += -DCONFIG_NAND_SPL
>
> SOBJS = start.o resetvec.o
> COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
> - nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
> + nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o \
> + ../common.o
>
> SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
> OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
> @@ -114,6 +115,9 @@ ifneq ($(OBJTREE), $(SRCTREE))
> $(obj)nand_boot.c:
> @rm -f $(obj)nand_boot.c
> ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
> +$(obj)../common.c:
> + @rm -f $(obj)../common.c
> + ln -s $(SRCTREE)/nand_spl/board/freescale/common.c $(obj)../common.c
> endif
>
> #########################################################################
> diff --git a/nand_spl/board/freescale/p1023rds/nand_boot.c b/nand_spl/board/freescale/p1023rds/nand_boot.c
> index 0065c87..9309936 100644
> --- a/nand_spl/board/freescale/p1023rds/nand_boot.c
> +++ b/nand_spl/board/freescale/p1023rds/nand_boot.c
> @@ -25,6 +25,7 @@
> #include <asm/io.h>
> #include <nand.h>
> #include <asm/fsl_law.h>
> +#include <asm/fsl_ddr_sdram.h>
>
> /* Fixed sdram init -- doesn't use serial presence detect. */
> void sdram_init(void)
> @@ -53,12 +54,21 @@ void sdram_init(void)
> out_be32(&ddr->ddr_wrlvl_cntl, CONFIG_SYS_DDR_WRLVL_CNTL);
> out_be32(&ddr->ddr_cdr1, CONFIG_SYS_DDR_CDR_1);
> out_be32(&ddr->ddr_cdr2, CONFIG_SYS_DDR_CDR_2);
> - out_be32(&ddr->sdram_cfg, CONFIG_SYS_DDR_CONTROL);
> + /* Set, but do not enable the memory */
> + out_be32(&ddr->sdram_cfg, CONFIG_SYS_DDR_CONTROL & ~SDRAM_CFG_MEM_EN);
> +
> + asm volatile("sync;isync");
> + udelay(500);
> +
> + /* Let the controller go */
> + out_be32(&ddr->sdram_cfg, in_be32(&ddr->sdram_cfg) | SDRAM_CFG_MEM_EN);
> }
>
> +u32 bus_clk;
> +
> void board_init_f(ulong bootflag)
> {
> - u32 plat_ratio, bus_clk;
> + u32 plat_ratio;
> ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
>
> /* initialize selected port with appropriate baud rate */
>
This is before relocation, so you can't use global variables. Use
gd->bus_clk.
In our SDK where this code has already been applied, I spent some debug
time tracking why the first word of the SPL was getting corrupted (the
BSS goes right after the end of the NAND buffer and it wraps around),
when trying to find the cause of other corruption (the rest was bad DDR
settings).
-Scott
next prev parent reply other threads:[~2012-08-13 18:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50294513.3050201@freescale.com \
--to=scottwood@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox