Skip to contentSkip to conversation

p1014rdb: set ddr bus width properly depending on SVR

PATCH New Matthew McClintock 4 participants 20 messages Aug 13, 2012 – Aug 20, 2012 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 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

---
 arch/powerpc/include/asm/fsl_ddr_sdram.h      |    1 +
 nand_spl/board/freescale/p1010rdb/nand_boot.c |   11 +++++++++++
 2 files changed, 12 insertions(+)
arch/powerpc/include/asm/fsl_ddr_sdram.h +1 -0
index 93639ba..157ae24 100644
@@ -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
nand_spl/board/freescale/p1010rdb/nand_boot.c +11 -0
index 16eeb61..1f89ab5 100644
@@ -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);
 
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 2/6 p1010rdb: fix ddr values for p1014rdb (setting bus width to 16bit)

There was an extra 0 in front of the value we were using to mask, remove it to improve the code.

Also fix the value written to ddr_sdram_cfg to set the bus width properly to 16 bits

---
 board/freescale/p1010rdb/ddr.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
board/freescale/p1010rdb/ddr.c +4 -3
index 10c5a42..6d00caf 100644
@@ -147,10 +147,11 @@ phys_size_t fixed_sdram(void)
 	cpu = gd->cpu;
 	/* P1014 and it's derivatives support max 16bit DDR width */
 	if (cpu->soc_ver == SVR_P1014) {
+		ddr_cfg_regs.ddr_sdram_cfg &= ~SDRAM_CFG_DBW_MASK;
 		ddr_cfg_regs.ddr_sdram_cfg |= SDRAM_CFG_16_BE;
-		ddr_cfg_regs.cs[0].bnds = CONFIG_SYS_DDR_CS0_BNDS >> 1;
-		ddr_cfg_regs.ddr_sdram_cfg &= ~0x00180000;
-		ddr_cfg_regs.ddr_sdram_cfg |= 0x001080000;
+		/* divide SA and EA by two and then mask the rest so we don't
+		 * write to reserved fields */
+		ddr_cfg_regs.cs[0].bnds = (CONFIG_SYS_DDR_CS0_BNDS >> 1) & 0x0fff0fff;
 	}
 
 	ddr_size = (phys_size_t) CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
Signature · 1 line
1.7.9.7
#2 lore raw

PATCH 3/6 powerpc/p1010rdb: nandboot: compare SVR properly

In reply to Matthew McClintock

We were not comparing the SVRs properly previously. This comparison will properly shift the SVR and mask off the E bit

This fixes the boot output to show the correct DDR bus width:

512 MiB (DDR3, 16-bit, CL=5, ECC off)

instead of

512 MiB (DDR3, 32-bit, CL=5, ECC off)

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
nand_spl/board/freescale/p1010rdb/nand_boot.c +2 -1
index 1f89ab5..f5294d0 100644
@@ -35,7 +35,8 @@ 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);
+	/* mask off E bit */
+	u32 svr = SVR_SOC_VER(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);
Signature · 1 line
1.7.9.7
#3 lore raw

PATCH 4/6 nand_spl: update udelay for Freescale boards

In reply to Matthew McClintock

Let's use the more appropriate udelay for the nand_spl. While we can't make use of u-boot's full udelay we can atl east use a for loop that won't get optimized away .Since we have the bus clock we can use the timebase to calculate wall time.

Looked at reusing the u-boot udelay functions but it pulls in a lot of code as well as depends on the gd struct and would require a lot of rework

---
 nand_spl/board/freescale/common.c                 |   36 +++++++++++++++++++++
 nand_spl/board/freescale/p1010rdb/Makefile        |    6 +++-
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |    8 ++---
 nand_spl/board/freescale/p1_p2_rdb_pc/Makefile    |    6 +++-
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |    9 ++----
 5 files changed, 52 insertions(+), 13 deletions(-)
 create mode 100644 nand_spl/board/freescale/common.c
nand_spl/board/freescale/common.c new file +36 -0
new file mode 100644
index 0000000..9008cf4
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ * Author: Matthew McClintock <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+
+
+#include <common.h>
+#include <asm/processor.h>
+
+extern u32 bus_clk;
+
+void udelay(unsigned long usec) {
+	u32 ticks_per_usec = bus_clk / (8 * 1000000);
+	u32 ticks = ticks_per_usec * usec;
+	u32 s = mfspr(SPRN_TBRL);
+
+	while ((mfspr(SPRN_TBRL)-s) < ticks);
+}
nand_spl/board/freescale/p1010rdb/Makefile +5 -1
index 8d240ea..cdbd492 100644
@@ -39,7 +39,8 @@ CFLAGS	+= -DCONFIG_NAND_SPL
 
 SOBJS	= start.o resetvec.o ticks.o
 COBJS	= cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
-	  nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o
+	  nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o \
+	  ../common.o
 
 SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -123,6 +124,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
 
 #########################################################################
nand_spl/board/freescale/p1010rdb/nand_boot.c +3 -5
index f5294d0..931e562 100644
@@ -28,8 +28,6 @@
 #include <asm/fsl_ddr_sdram.h>
 #include <asm/fsl_law.h>
 
-#define udelay(x) { int j; for (j = 0; j < x * 10000; j++) isync(); }
-
 unsigned long ddr_freq_mhz;
 
 void sdram_init(void)
@@ -82,8 +80,7 @@ void sdram_init(void)
 		__raw_writel((CONFIG_SYS_DDR_CS0_BNDS >> 1) & 0x0fff0fff, &ddr->cs0_bnds);
 	}
 
-	/* mimic 500us delay, with busy isync() loop */
-	udelay(100);
+	udelay(500);
 
 	/* Let the controller go */
 	out_be32(&ddr->sdram_cfg, in_be32(&ddr->sdram_cfg) | SDRAM_CFG_MEM_EN);
@@ -91,10 +88,11 @@ void sdram_init(void)
 	set_next_law(CONFIG_SYS_NAND_DDR_LAW, LAW_SIZE_1G, LAW_TRGT_IF_DDR_1);
 }
 
+u32 bus_clk;
+
 void board_init_f(ulong bootflag)
 {
 	u32 plat_ratio, ddr_ratio;
-	unsigned long bus_clk;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
 	/* initialize selected port with appropriate baud rate */
nand_spl/board/freescale/p1_p2_rdb_pc/Makefile +5 -1
index 475cc49..46cf709 100644
@@ -39,7 +39,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))
@@ -119,6 +120,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
 
 #########################################################################
nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c +3 -6
index b9796ea..e7906e8 100644
@@ -26,11 +26,6 @@
 #include <asm/fsl_law.h>
 #include <asm/fsl_ddr_sdram.h>
 
-#define udelay(x) {int i, j; \
-			for (i = 0; i < x; i++) \
-				for (j = 0; j < 10000; j++) \
-					; }
-
 /*
  * Fixed sdram init -- doesn't use serial presence detect.
  */
@@ -74,9 +69,11 @@ void sdram_init(void)
 	set_next_law(0, CONFIG_SYS_SDRAM_SIZE_LAW, LAW_TRGT_IF_DDR_1);
 }
 
+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;
 #ifndef CONFIG_QE
 	ccsr_gpio_t *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR);
Signature · 1 line
1.7.9.7
#4 lore raw

PATCH 4/6 nand_spl: update udelay for Freescale boards

Quoted 8 lines · Matthew McClintock

Let's use the more appropriate udelay for the nand_spl. While we can't make use of u-boot's full udelay we can atl east use a for loop that won't get optimized away .Since we have the bus clock we can use the timebase to calculate wall time.

Looked at reusing the u-boot udelay functions but it pulls in a lot of code as well as depends on the gd struct and would require a lot of rework

What's wrong with depending on the gd struct?

Quoted 1 line

+extern u32 bus_clk;

Change to gd->bus_clk as mentioned in patch 5/6.

nand_spl/board/freescale/common.c line 36

Quoted 7 lines
nand_spl/board/freescale/common.c new file +7 -0
+void udelay(unsigned long usec) {
+	u32 ticks_per_usec = bus_clk / (8 * 1000000);
+	u32 ticks = ticks_per_usec * usec;
+	u32 s = mfspr(SPRN_TBRL);
+
+	while ((mfspr(SPRN_TBRL)-s) < ticks);
+}

Opening brace goes on its own line for function definitions. Use spaces around that '-'.

Dividing the bus clock by 8 only works for e500v1/v2, but this isn't labelled as specific to those cores.

Quoted 15 lines
nand_spl/board/freescale/p1010rdb/Makefile +2 -1
index 8d240ea..cdbd492 100644
@@ -39,7 +39,8 @@ CFLAGS	+= -DCONFIG_NAND_SPL
 
 SOBJS	= start.o resetvec.o ticks.o
 COBJS	= cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
-	  nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o
+	  nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o \
+	  ../common.o
 
 SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))

nand_spl/board/freescale/p1010rdb/Makefile ifneq ($(OBJTREE), $(SRCTREE)) · line 130

Quoted 7 lines
nand_spl/board/freescale/p1010rdb/Makefile +3 -0
@@ -123,6 +124,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

Why are you creating a link in the parent directory?

-Scott

#5 lore raw

PATCH 4/6 nand_spl: update udelay for Freescale boards

Quoted 11 lines · Scott Wood
Quoted 8 lines · Matthew McClintock

Let's use the more appropriate udelay for the nand_spl. While we can't make use of u-boot's full udelay we can atl east use a for loop that won't get optimized away .Since we have the bus clock we can use the timebase to calculate wall time.

Looked at reusing the u-boot udelay functions but it pulls in a lot of code as well as depends on the gd struct and would require a lot of rework

What's wrong with depending on the gd struct?

Perhaps the wording is wrong a bit off. It's just pulling in other stuff and as you know we are very space constrained.

Quoted 3 lines
Quoted 1 line

+extern u32 bus_clk;

Change to gd->bus_clk as mentioned in patch 5/6.

Yes, v2 was already sent: http://patchwork.ozlabs.org/patch/177047/

Quoted 10 lines

nand_spl/board/freescale/common.c line 36

Quoted 7 lines
nand_spl/board/freescale/common.c new file +7 -0
+void udelay(unsigned long usec) {
+     u32 ticks_per_usec = bus_clk / (8 * 1000000);
+     u32 ticks = ticks_per_usec * usec;
+     u32 s = mfspr(SPRN_TBRL);
+
+     while ((mfspr(SPRN_TBRL)-s) < ticks);
+}

Opening brace goes on its own line for function definitions. Use spaces around that '-'.

Will fix.

Quoted 2 lines

Dividing the bus clock by 8 only works for e500v1/v2, but this isn't labelled as specific to those cores.

Updated to use CONFIG_SYS_FSL_TBCLK_DIV

Quoted 13 lines
Quoted 13 lines
nand_spl/board/freescale/p1010rdb/Makefile +2 -1
index 8d240ea..cdbd492 100644
@@ -39,7 +39,8 @@ CFLAGS      += -DCONFIG_NAND_SPL
 
 SOBJS        = start.o resetvec.o ticks.o
 COBJS        = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
-       nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o
+       nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o \
+       ../common.o
 
Quoted 12 lines

nand_spl/board/freescale/p1010rdb/Makefile ifneq ($(OBJTREE), $(SRCTREE)) · line 130

Quoted 10 lines
nand_spl/board/freescale/p1010rdb/Makefile +3 -0
 SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
 OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
@@ -123,6 +124,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

Why are you creating a link in the parent directory?

The typical build process picks out files needed for the build and symlinks them to nand_spl folder - or if building out of tree then it symlinks to the out of tree folder. This is true for all files in nand_spl as it currently exists not just this new file.

-M

#6 lore raw

PATCH 4/6 nand_spl: update udelay for Freescale boards

Quoted 7 lines · On 08/13/2012 06:14 PM, McClintock Matthew-B29882 wrote:
Quoted 6 lines · Scott Wood
Quoted 5 lines · Matthew McClintock

Let's use the more appropriate udelay for the nand_spl. While we can't make use of u-boot's full udelay we can atl east use a for loop that won't get optimized away .Since we have the bus clock we can use the timebase to calculate wall time.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Looked at reusing the u-boot udelay functions but it pulls in a lot of code as well as depends on the gd struct and would require a lot of rework

What's wrong with depending on the gd struct?

Perhaps the wording is wrong a bit off. It's just pulling in other stuff and as you know we are very space constrained.

A struct definition doesn't take up space. Maybe you meant a dependency on certain specific code that puts things in the gd struct?

Quoted 11 lines
Quoted 10 lines

nand_spl/board/freescale/p1010rdb/Makefile ifneq ($(OBJTREE), $(SRCTREE)) · line 130

Quoted 8 lines
nand_spl/board/freescale/p1010rdb/Makefile +3 -0
@@ -123,6 +124,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

Why are you creating a link in the parent directory?

Quoted 4 lines

The typical build process picks out files needed for the build and symlinks them to nand_spl folder - or if building out of tree then it symlinks to the out of tree folder. This is true for all files in nand_spl as it currently exists not just this new file.

This is the first time I've seen a link go in $(obj)../ rather than $(obj)

-Scott

#7 lore raw

PATCH 4/6 nand_spl: update udelay for Freescale boards

Quoted 12 lines · Scott Wood
Quoted 11 lines · On 08/13/2012 06:14 PM, McClintock Matthew-B29882 wrote:
Quoted 10 lines · Scott Wood
Quoted 8 lines · Matthew McClintock

Let's use the more appropriate udelay for the nand_spl. While we can't make use of u-boot's full udelay we can atl east use a for loop that won't get optimized away .Since we have the bus clock we can use the timebase to calculate wall time.

Looked at reusing the u-boot udelay functions but it pulls in a lot of code as well as depends on the gd struct and would require a lot of rework

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

What's wrong with depending on the gd struct?

Perhaps the wording is wrong a bit off. It's just pulling in other stuff and as you know we are very space constrained.

A struct definition doesn't take up space. Maybe you meant a dependency on certain specific code that puts things in the gd struct?

Correct.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

nand_spl/board/freescale/p1010rdb/Makefile ifneq ($(OBJTREE), $(SRCTREE)) · line 130

Quoted 8 lines
nand_spl/board/freescale/p1010rdb/Makefile +3 -0
@@ -123,6 +124,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

Why are you creating a link in the parent directory?

Quoted 6 lines
Quoted 4 lines

The typical build process picks out files needed for the build and symlinks them to nand_spl folder - or if building out of tree then it symlinks to the out of tree folder. This is true for all files in nand_spl as it currently exists not just this new file.

This is the first time I've seen a link go in $(obj)../ rather than $(obj)

It's because that's where the includes reference it. When building in tree, it does nothing because it can just reference the C file in the parent directory. When it's out of tree - we need to install the symlink in the proper location in the build folder.

-M

#8 lore raw

PATCH 4/6 nand_spl: update udelay for Freescale boards

Quoted 39 lines · On 08/13/2012 06:28 PM, McClintock Matthew-B29882 wrote:
Quoted 12 lines · Scott Wood
Quoted 11 lines · On 08/13/2012 06:14 PM, McClintock Matthew-B29882 wrote:
Quoted 10 lines · Scott Wood
Quoted 8 lines · Matthew McClintock

Let's use the more appropriate udelay for the nand_spl. While we can't make use of u-boot's full udelay we can atl east use a for loop that won't get optimized away .Since we have the bus clock we can use the timebase to calculate wall time.

Looked at reusing the u-boot udelay functions but it pulls in a lot of code as well as depends on the gd struct and would require a lot of rework

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

What's wrong with depending on the gd struct?

Perhaps the wording is wrong a bit off. It's just pulling in other stuff and as you know we are very space constrained.

A struct definition doesn't take up space. Maybe you meant a dependency on certain specific code that puts things in the gd struct?

Correct.

Quoted 16 lines
Quoted 15 lines
Quoted 10 lines

nand_spl/board/freescale/p1010rdb/Makefile ifneq ($(OBJTREE), $(SRCTREE)) · line 130

Quoted 8 lines
nand_spl/board/freescale/p1010rdb/Makefile +3 -0
@@ -123,6 +124,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

Why are you creating a link in the parent directory?

The typical build process picks out files needed for the build and symlinks them to nand_spl folder - or if building out of tree then it symlinks to the out of tree folder. This is true for all files in nand_spl as it currently exists not just this new file.

Quoted 6 lines
Quoted 1 line

This is the first time I've seen a link go in $(obj)../ rather than $(obj)

It's because that's where the includes reference it. When building in tree, it does nothing because it can just reference the C file in the parent directory. When it's out of tree - we need to install the symlink in the proper location in the build folder.

I'm not thrilled with it, but it shouldn't have long to live since new-spl doesn't do the symlink thing.

-Scott

#9 lore raw

PATCH 5/6 nand_spl: p1023rds: wait before enabling DDR controller

In reply to Matthew McClintock

We have a requirement to wait a period of time before enabling the DDR controller

---
 nand_spl/board/freescale/p1023rds/Makefile    |    6 +++++-
 nand_spl/board/freescale/p1023rds/nand_boot.c |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
nand_spl/board/freescale/p1023rds/Makefile +5 -1
index 168e868..da43521 100644
@@ -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
 
 #########################################################################
nand_spl/board/freescale/p1023rds/nand_boot.c +12 -2
index 0065c87..9309936 100644
@@ -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 */
Signature · 1 line
1.7.9.7
#10 lore raw

PATCH 5/6 nand_spl: p1023rds: wait before enabling DDR controller

Quoted 60 lines · Matthew McClintock

We have a requirement to wait a period of time before enabling the DDR controller

---
 nand_spl/board/freescale/p1023rds/Makefile    |    6 +++++-
 nand_spl/board/freescale/p1023rds/nand_boot.c |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
nand_spl/board/freescale/p1023rds/Makefile +5 -1
index 168e868..da43521 100644
@@ -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
 
 #########################################################################
nand_spl/board/freescale/p1023rds/nand_boot.c +9 -1
index 0065c87..9309936 100644
@@ -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);
 }

nand_spl/board/freescale/p1023rds/nand_boot.c void sdram_init(void) · line 74

Quoted 10 lines
nand_spl/board/freescale/p1023rds/nand_boot.c +3 -1
 
+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

#11 lore raw

PATCH 5/6 nand_spl: p1023rds: wait before enabling DDR controller

Quoted 75 lines · Scott Wood
Quoted 60 lines · Matthew McClintock

We have a requirement to wait a period of time before enabling the DDR controller

---
 nand_spl/board/freescale/p1023rds/Makefile    |    6 +++++-
 nand_spl/board/freescale/p1023rds/nand_boot.c |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
nand_spl/board/freescale/p1023rds/Makefile +5 -1
index 168e868..da43521 100644
@@ -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
 
 #########################################################################
nand_spl/board/freescale/p1023rds/nand_boot.c +9 -1
index 0065c87..9309936 100644
@@ -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);
 }

nand_spl/board/freescale/p1023rds/nand_boot.c void sdram_init(void) · line 74

Quoted 10 lines
nand_spl/board/freescale/p1023rds/nand_boot.c +3 -1
 
+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.

Quoted 5 lines

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).

Thanks, v2 coming.

-M

#12 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

In reply to Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
 nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
 3 files changed, 71 insertions(+), 73 deletions(-)
nand_spl/board/freescale/p1010rdb/nand_boot.c +26 -28
index 931e562..7190b00 100644
@@ -36,39 +36,37 @@ void sdram_init(void)
 	/* mask off E bit */
 	u32 svr = SVR_SOC_VER(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);
-	out_be32(&ddr->cs0_config, CONFIG_SYS_DDR_CS0_CONFIG);
-	out_be32(&ddr->sdram_cfg_2, CONFIG_SYS_DDR_CONTROL_2);
-	out_be32(&ddr->sdram_data_init, CONFIG_SYS_DDR_DATA_INIT);
+	__raw_writel(CONFIG_SYS_DDR_CONTROL | SDRAM_CFG_32_BE, &ddr->sdram_cfg);
+	__raw_writel(CONFIG_SYS_DDR_CS0_BNDS, &ddr->cs0_bnds);
+	__raw_writel(CONFIG_SYS_DDR_CS0_CONFIG, &ddr->cs0_config);
+	__raw_writel(CONFIG_SYS_DDR_CONTROL_2, &ddr->sdram_cfg_2);
+	__raw_writel(CONFIG_SYS_DDR_DATA_INIT, &ddr->sdram_data_init);
 
 	if (ddr_freq_mhz < 700) {
-		out_be32(&ddr->timing_cfg_3, CONFIG_SYS_DDR_TIMING_3_667);
-		out_be32(&ddr->timing_cfg_0, CONFIG_SYS_DDR_TIMING_0_667);
-		out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1_667);
-		out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2_667);
-		out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1_667);
-		out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2_667);
-		out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL_667);
-		out_be32(&ddr->sdram_clk_cntl, CONFIG_SYS_DDR_CLK_CTRL_667);
-		out_be32(&ddr->ddr_wrlvl_cntl,
-				CONFIG_SYS_DDR_WRLVL_CONTROL_667);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_3_667, &ddr->timing_cfg_3);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_0_667, &ddr->timing_cfg_0);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_1_667, &ddr->timing_cfg_1);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_2_667, &ddr->timing_cfg_2);
+		__raw_writel(CONFIG_SYS_DDR_MODE_1_667, &ddr->sdram_mode);
+		__raw_writel(CONFIG_SYS_DDR_MODE_2_667, &ddr->sdram_mode_2);
+		__raw_writel(CONFIG_SYS_DDR_INTERVAL_667, &ddr->sdram_interval);
+		__raw_writel(CONFIG_SYS_DDR_CLK_CTRL_667, &ddr->sdram_clk_cntl);
+		__raw_writel(CONFIG_SYS_DDR_WRLVL_CONTROL_667, &ddr->ddr_wrlvl_cntl);
 	} else {
-		out_be32(&ddr->timing_cfg_3, CONFIG_SYS_DDR_TIMING_3_800);
-		out_be32(&ddr->timing_cfg_0, CONFIG_SYS_DDR_TIMING_0_800);
-		out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1_800);
-		out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2_800);
-		out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1_800);
-		out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2_800);
-		out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL_800);
-		out_be32(&ddr->sdram_clk_cntl, CONFIG_SYS_DDR_CLK_CTRL_800);
-		out_be32(&ddr->ddr_wrlvl_cntl,
-				CONFIG_SYS_DDR_WRLVL_CONTROL_800);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_3_800, &ddr->timing_cfg_3);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_0_800, &ddr->timing_cfg_0);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_1_800, &ddr->timing_cfg_1);
+		__raw_writel(CONFIG_SYS_DDR_TIMING_2_800, &ddr->timing_cfg_2);
+		__raw_writel(CONFIG_SYS_DDR_MODE_1_800, &ddr->sdram_mode);
+		__raw_writel(CONFIG_SYS_DDR_MODE_2_800, &ddr->sdram_mode_2);
+		__raw_writel(CONFIG_SYS_DDR_INTERVAL_800, &ddr->sdram_interval);
+		__raw_writel(CONFIG_SYS_DDR_CLK_CTRL_800, &ddr->sdram_clk_cntl);
+		__raw_writel(CONFIG_SYS_DDR_WRLVL_CONTROL_800, &ddr->ddr_wrlvl_cntl);
 	}
 
-	out_be32(&ddr->timing_cfg_4, CONFIG_SYS_DDR_TIMING_4);
-	out_be32(&ddr->timing_cfg_5, CONFIG_SYS_DDR_TIMING_5);
-	out_be32(&ddr->ddr_zq_cntl, CONFIG_SYS_DDR_ZQ_CONTROL);
+	__raw_writel(CONFIG_SYS_DDR_TIMING_4, &ddr->timing_cfg_4);
+	__raw_writel(CONFIG_SYS_DDR_TIMING_5, &ddr->timing_cfg_5);
+	__raw_writel(CONFIG_SYS_DDR_ZQ_CONTROL, &ddr->ddr_zq_cntl);
 
 	/* P1014 and it's derivatives support max 16bit DDR width */
 	if (svr == SVR_P1014) {
nand_spl/board/freescale/p1023rds/nand_boot.c +21 -21

49 lines not on this page · raw message

nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c +24 -24

69 lines not on this page · raw message

Signature · 1 line
1.7.9.7
#13 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

Quoted 5 lines · Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

Quoted 8 lines

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
 nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
 3 files changed, 71 insertions(+), 73 deletions(-)

This should come first if the other patches break without it, to preserve bisectability.

Note that I'm going to try to convert this stuff (at least one board as an example, but hopefully it should be easy enough to do additional boards once the first is done) to the new spl Really Soon Now(tm), so it doesn't make much sense to fiddle around with the old stuff right now unless I miss the merge window. I'll incorporate these changes into the new-spl version. I may do that by applying these patches first, but I'd rather they not go via the mpc85xx tree (and please CC me on NAND patches).

-Scott

#14 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

Quoted 15 lines · Scott Wood
Quoted 5 lines · Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

Quoted 8 lines

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
 nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
 3 files changed, 71 insertions(+), 73 deletions(-)
Quoted 2 lines

This should come first if the other patches break without it, to preserve bisectability.

I think they all work on at least some compilers.... not that that's extremely helpful.

-M

Quoted 16 lines

Note that I'm going to try to convert this stuff (at least one board as an example, but hopefully it should be easy enough to do additional boards once the first is done) to the new spl Really Soon Now(tm), so it doesn't make much sense to fiddle around with the old stuff right now unless I miss the merge window. I'll incorporate these changes into the new-spl version. I may do that by applying these patches first, but I'd rather they not go via the mpc85xx tree (and please CC me on NAND patches).

-Scott

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

#15 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

Quoted 16 lines · On 08/13/2012 06:31 PM, McClintock Matthew-B29882 wrote:
Quoted 15 lines · Scott Wood
Quoted 13 lines · Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
 nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
 3 files changed, 71 insertions(+), 73 deletions(-)
Quoted 5 lines
Quoted 2 lines

This should come first if the other patches break without it, to preserve bisectability.

I think they all work on at least some compilers.... not that that's extremely helpful.

Was this patch meant to free up room for the other patches, or was it just bundled in because it's touching the same code?

-Scott

#16 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

Quoted 17 lines · Scott Wood
Quoted 16 lines · On 08/13/2012 06:31 PM, McClintock Matthew-B29882 wrote:
Quoted 15 lines · Scott Wood
Quoted 13 lines · Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
 nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
 3 files changed, 71 insertions(+), 73 deletions(-)
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

This should come first if the other patches break without it, to preserve bisectability.

I think they all work on at least some compilers.... not that that's extremely helpful.

Was this patch meant to free up room for the other patches, or was it just bundled in because it's touching the same code?

I believe I was tasked with fixing builds on our newer toolchains (or was it older toolchains?) since some combinations ran out of space. The exact reasoning escapes me, also why did it last a well...

I can reorder them if you would like...

-M

#17 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

In reply to Scott Wood
Quoted 18 lines · Scott Wood
Quoted 5 lines · Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

Quoted 8 lines

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---
 nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
 nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
 3 files changed, 71 insertions(+), 73 deletions(-)

This should come first if the other patches break without it, to preserve bisectability.

Quoted 7 lines

Note that I'm going to try to convert this stuff (at least one board as an example, but hopefully it should be easy enough to do additional boards once the first is done) to the new spl Really Soon Now(tm), so it doesn't make much sense to fiddle around with the old stuff right now unless I miss the merge window. I'll incorporate these changes into the new-spl version. I may do that by applying these patches first, but I'd rather they not go via the mpc85xx tree (and please CC me on NAND patches).

I'm not going to have this working by the end of the merge window, so these patches can go in as is. Andy, do you want to take them or should I?

-Scott

#18 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

I'm ok if you take them. I should be doing a push today, so either way works for me.

Quoted 32 lines · Scott Wood
Quoted 18 lines · Scott Wood
Quoted 5 lines · Matthew McClintock

This change reduces the SPL size by removing the redundant syncs produced by out_be32 and just replies on one final sync

Done with:

Quoted 8 lines

sed -r '/in_be32/b; s/(out_be32)\(([^,]*),\s+(.*)\)/__raw_writel(\3, \2)/g' -i git grep --name-only sdram_init nand_spl/

---

nand_spl/board/freescale/p1010rdb/nand_boot.c     |   54 ++++++++++-----------
nand_spl/board/freescale/p1023rds/nand_boot.c     |   42 ++++++++--------
nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |   48 +++++++++---------
3 files changed, 71 insertions(+), 73 deletions(-)

This should come first if the other patches break without it, to preserve bisectability.

Quoted 7 lines

Note that I'm going to try to convert this stuff (at least one board as an example, but hopefully it should be easy enough to do additional boards once the first is done) to the new spl Really Soon Now(tm), so it doesn't make much sense to fiddle around with the old stuff right now unless I miss the merge window. I'll incorporate these changes into the new-spl version. I may do that by applying these patches first, but I'd rather they not go via the mpc85xx tree (and please CC me on NAND patches).

I'm not going to have this working by the end of the merge window, so these patches can go in as is. Andy, do you want to take them or should I?

-Scott

#19 lore raw

PATCH 6/6 nand_spl: change out_be32 to raw_writel and depend on subsequent sync

Quoted 1 line · Andy Fleming

I'm ok if you take them. I should be doing a push today, so either way works for me.

If you're doing one today, go ahead and take them:

-Scott