Skip to contentSkip to conversation

ads5121: support for running from memory

PATCH New Nikita V. Youshchenko 3 participants 3 messages Oct 2, 2008 – Oct 4, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ads5121: support for running from memory

commit 599e6d1ff1fbab0abda4ef685f6078c4d2f1d2eb

Author: Nikita V. Youshchenko <[email protected]>
Date:   Tue Sep 2 07:51:05 2008 +0400

ads5121: support for running from memory

This patch makes it possible to start u-boot from memory on ads5121
board.

It does two simple things:
- skips initialization of memory controller if already running from
memory,
- helps u-boot to find it's environment in flash when CFG_MONITOR_BASE
does
not point to u-boot flash address.

board/ads5121/ads5121.c +3 -2
index deaa292..644d85e 100644
@@ -120,8 +120,9 @@ phys_size_t initdram (int board_type)
  */
 long int fixed_sdram (void)
 {
-	volatile immap_t *im = (immap_t *) CFG_IMMR;
 	u32 msize = CFG_DDR_SIZE * 1024 * 1024;
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+	volatile immap_t *im = (immap_t *) CFG_IMMR;
 	u32 msize_log2 = __ilog2 (msize);
 	u32 i;
 
@@ -203,7 +204,7 @@ long int fixed_sdram (void)
 	/* Start MDDRC */
 	im->mddrc.ddr_time_config0 = CFG_MDDRC_TIME_CFG0_RUN;
 	im->mddrc.ddr_sys_config = CFG_MDDRC_SYS_CFG_RUN;
-
+#endif
 	return msize;
 }
 
include/configs/ads5121.h +5 -0
index d6f7e02..6ff7762 100644
@@ -322,7 +322,12 @@
  */
 #define CONFIG_ENV_IS_IN_FLASH	1
 /* This has to be a multiple of the Flash sector size */
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
 #define CONFIG_ENV_ADDR		(CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#else
+#define CFG_MONITOR_FLASH_BASE	0xfff00000
+#define CONFIG_ENV_ADDR		(CFG_MONITOR_FLASH_BASE + CFG_MONITOR_LEN)
+#endif
 #define CONFIG_ENV_SIZE		0x2000
 #ifdef CONFIG_BKUP_FLASH
 #define CONFIG_ENV_SECT_SIZE	0x20000	/* one sector (256K) for env */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081003/44655c4c/attachment.pgp

#1 lore raw

PATCH 1/1 ads5121: support for running from memory

Dear "Nikita V. Youshchenko",

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

ads5121: support for running from memory

Ummm... (NOR) flash is memory, too. I guess you mean explicitely running from RAM, don't you? Then please write what you mean.

Quoted 2 lines

- helps u-boot to find it's environment in flash when CFG_MONITOR_BASE does not point to u-boot flash address.

Helps to find? You are hard-wiring the value, don't you? So not much needs to be found ... ?

include/configs/ads5121.h line 333

Quoted 13 lines
include/configs/ads5121.h +5 -0
@@ -322,7 +322,12 @@
  */
 #define CONFIG_ENV_IS_IN_FLASH	1
 /* This has to be a multiple of the Flash sector size */
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
 #define CONFIG_ENV_ADDR		(CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#else
+#define CFG_MONITOR_FLASH_BASE	0xfff00000
+#define CONFIG_ENV_ADDR		(CFG_MONITOR_FLASH_BASE + CFG_MONITOR_LEN)
+#endif
 #define CONFIG_ENV_SIZE		0x2000
 #ifdef CONFIG_BKUP_FLASH
 #define CONFIG_ENV_SECT_SIZE	0x20000	/* one sector (256K) for env */

Hm ... you use CFG_MONITOR_FLASH_BASE just a single time, to set CONFIG_ENV_ADDR. Why don't you set CONFIG_ENV_ADDR directly?

Best regards,

Wolfgang Denk

Signature · 5 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
To understand a program you must become  both  the  machine  and  the
program.
#2 lore raw

PATCH 1/1 ads5121: support for running from memory

This version fixes pointed issues. Is it better?

commit 03f4cf26950e498d83c21fd040977db9633d77e2

Author: Nikita V. Youshchenko <[email protected]>
Date:   Tue Sep 2 07:51:05 2008 +0400

ads5121: support for running from RAM

This patch makes it possible to start u-boot from RAM on ads5121 board.

It does two simple things:
- skips initialization of RAM controller if already running from RAM,
- makes CONFIG_ENV_ADDR absolute, not relative to CFG_MONITOR_BASE

board/ads5121/ads5121.c +3 -2
index deaa292..644d85e 100644
@@ -120,8 +120,9 @@ phys_size_t initdram (int board_type)
  */
 long int fixed_sdram (void)
 {
-	volatile immap_t *im = (immap_t *) CFG_IMMR;
 	u32 msize = CFG_DDR_SIZE * 1024 * 1024;
+#if CFG_MONITOR_BASE >= CFG_FLASH_BASE
+	volatile immap_t *im = (immap_t *) CFG_IMMR;
 	u32 msize_log2 = __ilog2 (msize);
 	u32 i;
 
@@ -203,7 +204,7 @@ long int fixed_sdram (void)
 	/* Start MDDRC */
 	im->mddrc.ddr_time_config0 = CFG_MDDRC_TIME_CFG0_RUN;
 	im->mddrc.ddr_sys_config = CFG_MDDRC_SYS_CFG_RUN;
-
+#endif
 	return msize;
 }
 
include/configs/ads5121.h +1 -1
index d6f7e02..4086ce9 100644
@@ -322,7 +322,7 @@
  */
 #define CONFIG_ENV_IS_IN_FLASH	1
 /* This has to be a multiple of the Flash sector size */
-#define CONFIG_ENV_ADDR		(CFG_MONITOR_BASE + CFG_MONITOR_LEN)
+#define CONFIG_ENV_ADDR		0xfff40000
 #define CONFIG_ENV_SIZE		0x2000
 #ifdef CONFIG_BKUP_FLASH
 #define CONFIG_ENV_SECT_SIZE	0x20000	/* one sector (256K) for env */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081004/ee57593c/attachment.pgp