Skip to contentSkip to conversation

ARMV7: OMAP4: Calculate SDRAM size

PATCH New Steve Sakoman 4 participants 18 messages Sep 23, 2010 – Sep 28, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

From: Aneesh V <[email protected]>

Calculate the SDRAM size from DMM configuration registers instead of using hard-coded values. This gives correct values for all different boards.

It's assumed that DMM sections do not overlap memory areas.

---
 arch/arm/cpu/armv7/omap4/board.c        |   30 +++++++++++++++++++++++++++++-
 arch/arm/include/asm/arch-omap4/omap4.h |   10 ++++++++++
 2 files changed, 39 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap4/board.c +29 -1
index 195be6e..8c1f395 100644
@@ -30,6 +30,7 @@
 #include <common.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/sizes.h>
 
 /*
  * Routine: s_init
@@ -66,6 +67,33 @@ void watchdog_init(void)
 	writel(WD_UNLOCK2, &wd2_base->wspr);
 }
 
+
+/*
+ * This function finds the SDRAM size available in the system
+ * based on DMM section configurations
+ * This is needed because the size of memory installed may be
+ * different on different versions of the board
+ */
+u32 sdram_size(void)
+{
+	u32 section, i, total_size = 0, size, addr;
+	for (i = 0; i < 4; i++) {
+		section	= __raw_readl(DMM_LISA_MAP_BASE + i*4);
+		addr = section & DMM_LISA_MAP_SYS_ADDR_MASK;
+		/* See if the address is valid */
+		if ((addr >= OMAP44XX_DRAM_ADDR_SPACE_START) &&
+		    (addr < OMAP44XX_DRAM_ADDR_SPACE_END)) {
+			size	= ((section & DMM_LISA_MAP_SYS_SIZE_MASK) >>
+				    DMM_LISA_MAP_SYS_SIZE_SHIFT);
+			size	= 1 << size;
+			size	*= SZ_16M;
+			total_size += size;
+		}
+	}
+	return total_size;
+}
+
+
 /*
  * Routine: dram_init
  * Description: sets uboots idea of sdram size
@@ -75,7 +103,7 @@ int dram_init(void)
 	DECLARE_GLOBAL_DATA_PTR;
 
 	gd->bd->bi_dram[0].start = 0x80000000;
-	gd->bd->bi_dram[0].size = 512 << 20;
+	gd->bd->bi_dram[0].size = sdram_size();
 	return 0;
 }
 
arch/arm/include/asm/arch-omap4/omap4.h +10 -0
index d0c808d..a30bb33 100644
@@ -42,6 +42,10 @@
 #define OMAP44XX_L4_WKUP_BASE	0x4A300000
 #define OMAP44XX_L4_PER_BASE	0x48000000
 
+#define OMAP44XX_DRAM_ADDR_SPACE_START	0x80000000
+#define OMAP44XX_DRAM_ADDR_SPACE_END	0xD0000000
+
+
 /* CONTROL */
 #define CTRL_BASE		(OMAP44XX_L4_CORE_BASE + 0x2000)
 #define CONTROL_PADCONF_CORE	(OMAP44XX_L4_CORE_BASE + 0x100000)
@@ -66,6 +70,12 @@
 /* GPMC */
 #define OMAP44XX_GPMC_BASE	0x50000000
 
+/* DMM */
+#define OMAP44XX_DMM_BASE		0x4E000000
+#define DMM_LISA_MAP_BASE		(OMAP44XX_DMM_BASE + 0x40)
+#define DMM_LISA_MAP_SYS_SIZE_MASK	(7 << 20)
+#define DMM_LISA_MAP_SYS_SIZE_SHIFT	20
+#define DMM_LISA_MAP_SYS_ADDR_MASK	(0xFF << 24)
 /*
  * Hardware Register Details
  */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Quoted 6 lines · Steve Sakoman

From: Aneesh V<[email protected]>

Calculate the SDRAM size from DMM configuration registers instead of using hard-coded values. This gives correct values for all different boards.

It's assumed that DMM sections do not overlap memory areas.

How do we handle NOR boot? is it assumed that the configuration will be done way befor the sdram_init?

Quoted 91 lines
---
  arch/arm/cpu/armv7/omap4/board.c        |   30 +++++++++++++++++++++++++++++-
  arch/arm/include/asm/arch-omap4/omap4.h |   10 ++++++++++
  2 files changed, 39 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap4/board.c +29 -1
index 195be6e..8c1f395 100644
@@ -30,6 +30,7 @@
  #include<common.h>
  #include<asm/arch/cpu.h>
  #include<asm/arch/sys_proto.h>
+#include<asm/sizes.h>
 
  /*
   * Routine: s_init
@@ -66,6 +67,33 @@ void watchdog_init(void)
  	writel(WD_UNLOCK2,&wd2_base->wspr);
  }
 
+
+/*
+ * This function finds the SDRAM size available in the system
+ * based on DMM section configurations
+ * This is needed because the size of memory installed may be
+ * different on different versions of the board
+ */
+u32 sdram_size(void)
+{
+	u32 section, i, total_size = 0, size, addr;
+	for (i = 0; i<  4; i++) {
+		section	= __raw_readl(DMM_LISA_MAP_BASE + i*4);
+		addr = section&  DMM_LISA_MAP_SYS_ADDR_MASK;
+		/* See if the address is valid */
+		if ((addr>= OMAP44XX_DRAM_ADDR_SPACE_START)&&
+		    (addr<  OMAP44XX_DRAM_ADDR_SPACE_END)) {
+			size	= ((section&  DMM_LISA_MAP_SYS_SIZE_MASK)>>
+				    DMM_LISA_MAP_SYS_SIZE_SHIFT);
+			size	= 1<<  size;
+			size	*= SZ_16M;
+			total_size += size;
+		}
+	}
+	return total_size;
+}
+
+
  /*
   * Routine: dram_init
   * Description: sets uboots idea of sdram size
@@ -75,7 +103,7 @@ int dram_init(void)
  	DECLARE_GLOBAL_DATA_PTR;
 
  	gd->bd->bi_dram[0].start = 0x80000000;
-	gd->bd->bi_dram[0].size = 512<<  20;
+	gd->bd->bi_dram[0].size = sdram_size();
  	return 0;
  }
 
arch/arm/include/asm/arch-omap4/omap4.h +10 -0
index d0c808d..a30bb33 100644
@@ -42,6 +42,10 @@
  #define OMAP44XX_L4_WKUP_BASE	0x4A300000
  #define OMAP44XX_L4_PER_BASE	0x48000000
 
+#define OMAP44XX_DRAM_ADDR_SPACE_START	0x80000000
+#define OMAP44XX_DRAM_ADDR_SPACE_END	0xD0000000
+
+
  /* CONTROL */
  #define CTRL_BASE		(OMAP44XX_L4_CORE_BASE + 0x2000)
  #define CONTROL_PADCONF_CORE	(OMAP44XX_L4_CORE_BASE + 0x100000)
@@ -66,6 +70,12 @@
  /* GPMC */
  #define OMAP44XX_GPMC_BASE	0x50000000
 
+/* DMM */
+#define OMAP44XX_DMM_BASE		0x4E000000
+#define DMM_LISA_MAP_BASE		(OMAP44XX_DMM_BASE + 0x40)
+#define DMM_LISA_MAP_SYS_SIZE_MASK	(7<<  20)
+#define DMM_LISA_MAP_SYS_SIZE_SHIFT	20
+#define DMM_LISA_MAP_SYS_ADDR_MASK	(0xFF<<  24)
  /*
   * Hardware Register Details
   */
#2 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Dear Nishanth Menon,

Quoted 3 lines · In message <[email protected]> you wrote:

How do we handle NOR boot? is it assumed that the configuration will be done way befor the sdram_init?

What do you mean? Which configuration?

Please note that things have changed with the relocation patches; boards should now use get_ram_size() before relating to RAM.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The most difficult thing in the world is to know how to  do  a  thing
and to watch someone else doing it wrong, without commenting.
                                                        -- T.H. White
#3 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

In reply to Nishanth Menon
Quoted 10 lines · Nishanth Menon
Quoted 6 lines · Steve Sakoman

From: Aneesh V<[email protected]>

Calculate the SDRAM size from DMM configuration registers instead of using hard-coded values. This gives correct values for all different boards.

It's assumed that DMM sections do not overlap memory areas.

How do we handle NOR boot? is it assumed that the configuration will be done way befor the sdram_init?

None of the OMAP4 board configs currently supported in u-boot utilize NOR boot.

I would expect that NOR boot patches would be submitted when a board/config that requires it is added. We shouldn't add code for NOR until there is a need.

Steve

Quoted 91 lines
Quoted 90 lines
---
  arch/arm/cpu/armv7/omap4/board.c        |   30 +++++++++++++++++++++++++++++-
  arch/arm/include/asm/arch-omap4/omap4.h |   10 ++++++++++
  2 files changed, 39 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap4/board.c +29 -1
index 195be6e..8c1f395 100644
@@ -30,6 +30,7 @@
  #include<common.h>
  #include<asm/arch/cpu.h>
  #include<asm/arch/sys_proto.h>
+#include<asm/sizes.h>
 
  /*
   * Routine: s_init
@@ -66,6 +67,33 @@ void watchdog_init(void)
  	writel(WD_UNLOCK2,&wd2_base->wspr);
  }
 
+
+/*
+ * This function finds the SDRAM size available in the system
+ * based on DMM section configurations
+ * This is needed because the size of memory installed may be
+ * different on different versions of the board
+ */
+u32 sdram_size(void)
+{
+	u32 section, i, total_size = 0, size, addr;
+	for (i = 0; i<  4; i++) {
+		section	= __raw_readl(DMM_LISA_MAP_BASE + i*4);
+		addr = section&  DMM_LISA_MAP_SYS_ADDR_MASK;
+		/* See if the address is valid */
+		if ((addr>= OMAP44XX_DRAM_ADDR_SPACE_START)&&
+		    (addr<  OMAP44XX_DRAM_ADDR_SPACE_END)) {
+			size	= ((section&  DMM_LISA_MAP_SYS_SIZE_MASK)>>
+				    DMM_LISA_MAP_SYS_SIZE_SHIFT);
+			size	= 1<<  size;
+			size	*= SZ_16M;
+			total_size += size;
+		}
+	}
+	return total_size;
+}
+
+
  /*
   * Routine: dram_init
   * Description: sets uboots idea of sdram size
@@ -75,7 +103,7 @@ int dram_init(void)
  	DECLARE_GLOBAL_DATA_PTR;
 
  	gd->bd->bi_dram[0].start = 0x80000000;
-	gd->bd->bi_dram[0].size = 512<<  20;
+	gd->bd->bi_dram[0].size = sdram_size();
  	return 0;
  }
 
arch/arm/include/asm/arch-omap4/omap4.h +10 -0
index d0c808d..a30bb33 100644
@@ -42,6 +42,10 @@
  #define OMAP44XX_L4_WKUP_BASE	0x4A300000
  #define OMAP44XX_L4_PER_BASE	0x48000000
 
+#define OMAP44XX_DRAM_ADDR_SPACE_START	0x80000000
+#define OMAP44XX_DRAM_ADDR_SPACE_END	0xD0000000
+
+
  /* CONTROL */
  #define CTRL_BASE		(OMAP44XX_L4_CORE_BASE + 0x2000)
  #define CONTROL_PADCONF_CORE	(OMAP44XX_L4_CORE_BASE + 0x100000)
@@ -66,6 +70,12 @@
  /* GPMC */
  #define OMAP44XX_GPMC_BASE	0x50000000
 
+/* DMM */
+#define OMAP44XX_DMM_BASE		0x4E000000
+#define DMM_LISA_MAP_BASE		(OMAP44XX_DMM_BASE + 0x40)
+#define DMM_LISA_MAP_SYS_SIZE_MASK	(7<<  20)
+#define DMM_LISA_MAP_SYS_SIZE_SHIFT	20
+#define DMM_LISA_MAP_SYS_ADDR_MASK	(0xFF<<  24)
  /*
   * Hardware Register Details
   */
#4 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

In reply to Nishanth Menon

Hi Nishanth

Quoted 13 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Nishanth Menon
Sent: Saturday, September 25, 2010 8:30 PM
To: Steve Sakoman
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMV7: OMAP4: Calculate SDRAM size

Quoted 3 lines · Steve Sakoman

From: Aneesh V<[email protected]>

Calculate the SDRAM size from DMM configuration registers instead

of using

Quoted 9 lines
Quoted 1 line

hard-coded values. This gives correct values for all different

boards.

Quoted 2 lines

It's assumed that DMM sections do not overlap memory areas.

How do we handle NOR boot? is it assumed that the configuration will be
done way befor the sdram_init?

I think you are referring to SDRAM initialization. Yes, it is assumed that SDRAM initialization(at least the DMM part of it) is done before the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

Best regards,
Aneesh

#5 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Dear "V, Aneesh",

Quoted 5 lines · In message <[email protected]> you…

I think you are referring to SDRAM initialization. Yes, it is assumed that SDRAM initialization(at least the DMM part of it) is done before the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

If you have to deal with boards which may come with different memory sizes, these may need different initializations. I don't know your hardware - you may or may not be able to read the needed configuration from the hardware. Eventually you need to try out different configurations, in which case the SDRAM initialization has to be part of the RAM initialization code (as it has to be retried for each possible configuration).

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I knew then (in 1970) that a 4-kbyte minicomputer would cost as much
as a house. So I reasoned  that  after  college,  I'd  have  to  live
cheaply in an apartment and put all my money into owning a computer."
      - Apple co-founder Steve Wozniak, EE Times, June 6, 1988, pg 45
#6 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

In reply to V
Quoted 25 lines · Aneesh

Hi Nishanth

Quoted 13 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Nishanth Menon
Sent: Saturday, September 25, 2010 8:30 PM
To: Steve Sakoman
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] ARMV7: OMAP4: Calculate SDRAM size

Quoted 3 lines · Steve Sakoman

From: Aneesh V<[email protected]>

Calculate the SDRAM size from DMM configuration registers instead

of using

Quoted 9 lines
Quoted 1 line

hard-coded values. This gives correct values for all different

boards.

Quoted 2 lines

It's assumed that DMM sections do not overlap memory areas.

How do we handle NOR boot? is it assumed that the configuration will be
done way befor the sdram_init?

Quoted 4 lines

I think you are referring to SDRAM initialization. Yes, it is assumed that SDRAM initialization(at least the DMM part of it) is done before the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

thanks for the clarification.. NOR boot is usually going to have initial part in XIP -> we'd traditionally relocate to SDRAM before the call to sdram_size() happens.

Regards,
Nishanth Menon

#7 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Dear Nishanth Menon,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

I think you are referring to SDRAM initialization. Yes, it is assumed that SDRAM initialization(at least the DMM part of it) is done before the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

thanks for the clarification.. NOR boot is usually going to have initial part in XIP -> we'd traditionally relocate to SDRAM before the call to sdram_size() happens.

Yes, this was the way how many ARM boards id, and this is what I'm trying to explain: this is WRONG.

SDRAM configuration must be done while still running from NOR, i. e. before relocation. Only then free reconfiguration, auto-sizing etc. is possible.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... The prejudices people feel about each other disappear  when  then
get to know each other.
	-- Kirk, "Elaan of Troyius", stardate 4372.5
#8 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Quoted 13 lines · Wolfgang Denk

Dear Nishanth Menon,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

I think you are referring to SDRAM initialization. Yes, it is assumed that SDRAM initialization(at least the DMM part of it) is done before the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

thanks for the clarification.. NOR boot is usually going to have initial part in XIP -> we'd traditionally relocate to SDRAM before the call to sdram_size() happens.

Quoted 6 lines

Yes, this was the way how many ARM boards id, and this is what I'm trying to explain: this is WRONG.

SDRAM configuration must be done while still running from NOR, i. e. before relocation. Only then free reconfiguration, auto-sizing etc. is possible.

I'll make sure that this is done properly when(if?) a patch series for an OMAP4 board with NOR boot is prepared.

Getting back to the subject patch, though :-)

This patch fixes a bug in the current Panda board support in rc2. Without this patch U-boot will return an erroneous size for available RAM. We should consider it for inclusion as soon as practical.

Regards,

Steve

#9 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Quoted 21 lines · Steve Sakoman
Quoted 13 lines · Wolfgang Denk

Dear Nishanth Menon,

Quoted 9 lines · In message<[email protected]> you wrote:
Quoted 5 lines

I think you are referring to SDRAM initialization. Yes, it is assumed that SDRAM initialization(at least the DMM part of it) is done before the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

thanks for the clarification.. NOR boot is usually going to have initial part in XIP -> we'd traditionally relocate to SDRAM before the call to sdram_size() happens.

Quoted 6 lines

Yes, this was the way how many ARM boards id, and this is what I'm trying to explain: this is WRONG.

SDRAM configuration must be done while still running from NOR, i. e. before relocation. Only then free reconfiguration, auto-sizing etc. is possible.

Quoted 8 lines

I'll make sure that this is done properly when(if?) a patch series for an OMAP4 board with NOR boot is prepared.

Getting back to the subject patch, though :-)

This patch fixes a bug in the current Panda board support in rc2. Without this patch U-boot will return an erroneous size for available RAM. We should consider it for inclusion as soon as practical.

I tend to agree, I might rather have my panda functioning properly and improve the location of sdram_size read at a later point of time -> for cleanups, we should probably start with the mux stuff..

That said, can we compromise by adding a FIXME: comment so that we dont really forget to fix it later on?

Regards,
Nishanth Menon

#10 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

In reply to Wolfgang Denk

Dear Wolfgang Denk,

Quoted 24 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Sunday, September 26, 2010 8:07 PM
To: Nishanth Menon
Cc: V, Aneesh; u-boot at lists.denx.de; Steve Sakoman
Subject: Re: [U-Boot] [PATCH] ARMV7: OMAP4: Calculate SDRAM size

Dear Nishanth Menon,

Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines

I think you are referring to SDRAM initialization. Yes, it is

assumed

Quoted 1 line
Quoted 1 line

that SDRAM initialization(at least the DMM part of it) is done

before

Quoted 4 lines
Quoted 2 lines

the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

thanks for the clarification.. NOR boot is usually going to have

initial

Quoted 1 line

part in XIP -> we'd traditionally relocate to SDRAM before the

call to

Quoted 1 line

sdram_size() happens.

Quoted 7 lines

Yes, this was the way how many ARM boards id, and this is what I'm trying to explain: this is WRONG.

SDRAM configuration must be done while still running from NOR, i. e. before relocation. Only then free reconfiguration, auto-sizing etc. is
possible.

We shall rework the patch to do SDRAM size calculation as part of 'lowlevel_init' that is called before relocation. I hope that should solve the problem.

Please note that we are always running from SDRAM because none of the OMAP4 boards so far have any XIP device.

Regarding true run-time detection of SDRAM size and configuration:
We do not support it today. However, LPDDR2 supports Mode Registers that have size info and our memory controller can read it. This coupled with the base AC timings specified by the LPDDR2 spec creates the possibility of doing a truly run-time detection and configuration of SDRAM that works for all boards. I was indeed thinking of trying it out sometime. Please note that the base AC timing values may not be optimal for all memory parts.

Best regards,
Aneesh

#11 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Dear Wolfgang Denk,

Quoted 39 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of V, Aneesh
Sent: Monday, September 27, 2010 12:03 PM
To: Wolfgang Denk; Nishanth Menon
Cc: u-boot at lists.denx.de; Steve Sakoman
Subject: Re: [U-Boot] [PATCH] ARMV7: OMAP4: Calculate SDRAM size

Dear Wolfgang Denk,

Quoted 20 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Sunday, September 26, 2010 8:07 PM
To: Nishanth Menon
Cc: V, Aneesh; u-boot at lists.denx.de; Steve Sakoman
Subject: Re: [U-Boot] [PATCH] ARMV7: OMAP4: Calculate SDRAM size

Dear Nishanth Menon,

Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines

I think you are referring to SDRAM initialization. Yes, it is

assumed

Quoted 1 line
Quoted 1 line

that SDRAM initialization(at least the DMM part of it) is done

before

Quoted 4 lines
Quoted 2 lines

the call to sdram_size(). The right location for this seems to be the initial part of sdram_init().

thanks for the clarification.. NOR boot is usually going to have

initial

Quoted 8 lines
Quoted 1 line

part in XIP -> we'd traditionally relocate to SDRAM before the

call to

Quoted 1 line

sdram_size() happens.

Yes, this was the way how many ARM boards id, and this is what I'm trying to explain: this is WRONG.

SDRAM configuration must be done while still running from NOR, i.

e.

Quoted 8 lines
Quoted 1 line

before relocation. Only then free reconfiguration, auto-sizing

etc.

Quoted 2 lines

is
possible.

We shall rework the patch to do SDRAM size calculation as part of 'lowlevel_init' that is called before relocation. I hope that should solve the problem.

I realize that gd will not be setup at this point of time. So, I would
propose keeping the same patch. sdram_size() can be called at any point of time as SDRAM is initialized by the time u-boot starts. We can do whatever extra needed to support the new relocation scheme
once those patches are upstream.

Quoted 4 lines

Please note that we are always running from SDRAM because none of the OMAP4 boards so far have any XIP device.

Quoted 9 lines

Regarding true run-time detection of SDRAM size and configuration:
We do not support it today. However, LPDDR2 supports Mode Registers that have size info and our memory controller can read it. This coupled with the base AC timings specified by the LPDDR2 spec creates the possibility of doing a truly run-time detection and configuration of SDRAM that works for all boards. I was indeed thinking of trying it out sometime. Please note that the base AC timing values may not be optimal for all memory parts.

Best regards,
Aneesh

#12 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

In reply to V

Dear "V, Aneesh",

Quoted 9 lines · In message <[email protected]> you…
Quoted 5 lines

SDRAM configuration must be done while still running from NOR, i. e. before relocation. Only then free reconfiguration, auto-sizing etc. is
possible.

We shall rework the patch to do SDRAM size calculation as part of 'lowlevel_init' that is called before relocation. I hope that should solve the problem.

No. This is not where it belongs. RAM initialization is done by the dram_init() function, which is an entry in the init_sequence[] array; see arch/arm/lib/board.c

Quoted 2 lines

Please note that we are always running from SDRAM because none of the OMAP4 boards so far have any XIP device.

I see.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Digital computers are themselves more complex than most things people
build: They have very large numbers of states. This makes conceiving,
describing, and testing them hard. Software systems  have  orders-of-
magnitude more states than computers do.           - Fred Brooks, Jr.
#13 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Quoted 13 lines · Wolfgang Denk

Dear "V, Aneesh",

Quoted 9 lines · In message <[email protected]> you…
Quoted 5 lines

SDRAM configuration must be done while still running from NOR, i. e. before relocation. Only then free reconfiguration, auto-sizing etc. is
possible.

We shall rework the patch to do SDRAM size calculation as part of 'lowlevel_init' that is called before relocation. I hope that should solve the problem.

Quoted 8 lines

No. This is not where it belongs. RAM initialization is done by the dram_init() function, which is an entry in the init_sequence[] array; see arch/arm/lib/board.c

Quoted 2 lines

Please note that we are always running from SDRAM because none of the OMAP4 boards so far have any XIP device.

I see.

I fear that all this discussion of what might happen someday with a XIP NOR implementation on OMAP4 may have distracted from the consideration of this patch for a real problem on today's hardware! The current Panda implementation returns an incorrect value for system ram size.

The subject patch does indeed set the ram size properly in the OMAP4 specific dram_init() function. As Wolfgang says above, this is the proper place. If there are no other objections we should try to get this integrated.

Regards,

Steve

#14 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Dear Steve Sakoman,

Quoted 5 lines · In message <1285622277.4705.43.camel@quadra> you wrote:

The subject patch does indeed set the ram size properly in the OMAP4 specific dram_init() function. As Wolfgang says above, this is the proper place. If there are no other objections we should try to get this integrated.

It's ok with me. Just waiting for a pull request.

24 hours to go.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
GUIs  are  virtually  useless.  Learn  tools.  They're  configurable,
scriptable, automatable, cron-able, interoperable, etc. We don't need
no brain-dead winslurping monolithic claptrap.
                               -- Tom Christiansen in 371140df at csnews
#15 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Quoted 4 lines · Wolfgang Denk

Dear Steve Sakoman,

Quoted 1 line · In message <1285622277.4705.43.camel@quadra> you wrote:
Quoted 8 lines
Quoted 4 lines

The subject patch does indeed set the ram size properly in the OMAP4 specific dram_init() function. As Wolfgang says above, this is the proper place. If there are no other objections we should try to get this integrated.

It's ok with me. Just waiting for a pull request.

24 hours to go.

Thanks Wolfgang.

Copying Sandeep so he knows he has to work fast :-)

Steve

#16 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Dear Sandeep,

Quoted 10 lines · In message <1285623705.4705.45.camel@quadra> Steve Sakoman wrote:
Quoted 9 lines · Wolfgang Denk

Dear Steve Sakoman,

Quoted 5 lines · In message <1285622277.4705.43.camel@quadra> you wrote:

The subject patch does indeed set the ram size properly in the OMAP4 specific dram_init() function. As Wolfgang says above, this is the proper place. If there are no other objections we should try to get this integrated.

Quoted 7 lines
Quoted 3 lines

It's ok with me. Just waiting for a pull request.

24 hours to go.

Thanks Wolfgang.

Copying Sandeep so he knows he has to work fast :-)

Ping???

Best regards,

Wolfgang Denk

Signature · 9 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
This was an  amazing  creation  using  small  squares  of  compressed
vegetable  matter on which letters were made by means of small carbon
particles from a stylus, giving an effect similar to the  traditional
word-processor  screen. It seemed amazingly portable and I never once
saw him have to change the batteries.
        - Terry Pratchett & Stephen Briggs, _The Discworld Companion_
#17 lore raw

PATCH 1/1 ARMV7: OMAP4: Calculate SDRAM size

Quoted 7 lines
Quoted 5 lines

Thanks Wolfgang.

Copying Sandeep so he knows he has to work fast :-)

Ping???

Its coming in a few minutes