diff mbox

[U-Boot,V3,1/6] tqm85xx: create fixed_sdram() to do sdram setup

Message ID 1292627879-9027-2-git-send-email-beckyb@kernel.crashing.org
State Accepted
Delegated to: Kumar Gala
Headers show

Commit Message

Becky Bruce Dec. 17, 2010, 11:17 p.m. UTC
Also, change this code to use phys_size_t instead of long int.
Using common naming for this function will enable us to use the common
initdram() for 85xx going forward.  Other than the type change,
this is just a code rearrange.

Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 board/tqc/tqm85xx/sdram.c |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

Comments

Kumar Gala Dec. 21, 2010, 5:52 p.m. UTC | #1
On Dec 17, 2010, at 5:17 PM, Becky Bruce wrote:

> Also, change this code to use phys_size_t instead of long int.
> Using common naming for this function will enable us to use the common
> initdram() for 85xx going forward.  Other than the type change,
> this is just a code rearrange.
> 
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> board/tqc/tqm85xx/sdram.c |   37 +++++++++++++++++++++++--------------
> 1 files changed, 23 insertions(+), 14 deletions(-)

Stefan, Wolfgang,

Any comment as TQM85xx maintainers

- k
Stefan Roese Dec. 22, 2010, 8:44 a.m. UTC | #2
On Tuesday 21 December 2010 18:52:30 Kumar Gala wrote:
> On Dec 17, 2010, at 5:17 PM, Becky Bruce wrote:
> > Also, change this code to use phys_size_t instead of long int.
> > Using common naming for this function will enable us to use the common
> > initdram() for 85xx going forward.  Other than the type change,
> > this is just a code rearrange.
> > 
> > Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> > ---
> > board/tqc/tqm85xx/sdram.c |   37 +++++++++++++++++++++++--------------
> > 1 files changed, 23 insertions(+), 14 deletions(-)
> 
> Stefan, Wolfgang,
> 
> Any comment as TQM85xx maintainers

Looks good to me, thanks:

Acked-by: Stefan Roese <sr@denx.de>

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de
Kumar Gala Jan. 5, 2011, 12:24 a.m. UTC | #3
On Dec 17, 2010, at 5:17 PM, Becky Bruce wrote:

> Also, change this code to use phys_size_t instead of long int.
> Using common naming for this function will enable us to use the common
> initdram() for 85xx going forward.  Other than the type change,
> this is just a code rearrange.
> 
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> board/tqc/tqm85xx/sdram.c |   37 +++++++++++++++++++++++--------------
> 1 files changed, 23 insertions(+), 14 deletions(-)

applied to 85xx

- k
diff mbox

Patch

diff --git a/board/tqc/tqm85xx/sdram.c b/board/tqc/tqm85xx/sdram.c
index 503c5e5..260cd1c 100644
--- a/board/tqc/tqm85xx/sdram.c
+++ b/board/tqc/tqm85xx/sdram.c
@@ -65,6 +65,7 @@  sdram_conf_t ddr_cs_conf[] = {
 #define	N_DDR_CS_CONF (sizeof(ddr_cs_conf) / sizeof(ddr_cs_conf[0]))
 
 int cas_latency (void);
+static phys_size_t sdram_setup(int);
 
 /*
  * Autodetect onboard DDR SDRAM on 85xx platforms
@@ -73,7 +74,26 @@  int cas_latency (void);
  *       so this should be extended for other future boards
  *       using this routine!
  */
-long int sdram_setup (int casl)
+phys_size_t fixed_sdram(void)
+{
+	int casl = 0;
+	phys_size_t dram_size = 0;
+
+	casl = cas_latency();
+	dram_size = sdram_setup(casl);
+	if ((dram_size == 0) && (casl != CONFIG_DDR_DEFAULT_CL)) {
+		/*
+		 * Try again with default CAS latency
+		 */
+		printf("Problem with CAS lantency, using default CL %d/10!\n",
+		       CONFIG_DDR_DEFAULT_CL);
+		dram_size = sdram_setup(CONFIG_DDR_DEFAULT_CL);
+		puts("       ");
+	}
+	return dram_size;
+}
+
+static phys_size_t sdram_setup(int casl)
 {
 	int i;
 	volatile ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
@@ -376,8 +396,7 @@  long int sdram_setup (int casl)
 
 phys_size_t initdram (int board_type)
 {
-	long dram_size = 0;
-	int casl;
+	phys_size_t dram_size = 0;
 
 #if defined(CONFIG_DDR_DLL)
 	/*
@@ -407,17 +426,7 @@  phys_size_t initdram (int board_type)
 	}
 #endif
 
-	casl = cas_latency ();
-	dram_size = sdram_setup (casl);
-	if ((dram_size == 0) && (casl != CONFIG_DDR_DEFAULT_CL)) {
-		/*
-		 * Try again with default CAS latency
-		 */
-		printf ("Problem with CAS lantency, using default CL %d/10!\n",
-			CONFIG_DDR_DEFAULT_CL);
-		dram_size = sdram_setup (CONFIG_DDR_DEFAULT_CL);
-		puts ("       ");
-	}
+	dram_size = fixed_sdram();
 
 	return dram_size;
 }