[U-Boot] [PATCH] [NEXT] Cleanup use of CONFIG_SYS_SRAM_BASE and CONFIG_SYS_SRAM_SIZE

Traditionally many boards used local definitions for SRAM base address and size (like SRAM_BASE, SRAM_LEN and/or SRAM_SIZE), while the (now) "official" names are CONFIG_SYS_SRAM_BASE and CONFIG_SYS_SRAM_SIZE.
The corresponding code in arch/powerpc/lib/board.c was board specific, and has never actually been maintained well. Replace this by feature- specific code and adapt the boards that actually use this.
NOTE: there is still a ton of boards using the old #defines, which therefor contain incorrect values in bi_sramstart and bi_sramsize.
All respective board maintainers are requested to clean up their respective configurations. Thanks.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Josef Wagner Wagner@Microsys.de Cc: Stefan Roese sr@denx.de Cc: Heiko Schocher hs@denx.de Cc: Wolfgang Denk wd@denx.de --- arch/powerpc/lib/board.c | 9 +++------ include/configs/CPC45.h | 5 +++-- include/configs/IP860.h | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0e00d86..6b1ff08 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -519,15 +519,12 @@ void board_init_f (ulong bootflag) bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of DRAM memory */ bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
-#ifdef CONFIG_IP860 - bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */ - bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */ -#elif defined CONFIG_MPC8220 +#ifdef CONFIG_SYS_SRAM_BASE bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM memory */ bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM memory */ #else - bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */ - bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */ + bd->bi_sramstart = 0; + bd->bi_sramsize = 0; #endif
#if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \ diff --git a/include/configs/CPC45.h b/include/configs/CPC45.h index 91d262a..c2e506c 100644 --- a/include/configs/CPC45.h +++ b/include/configs/CPC45.h @@ -347,13 +347,12 @@ #define BOOTFLAG_WARM 0x02 /* Software reboot */
-#define SRAM_BASE 0x80000000 /* SRAM base address */ -#define SRAM_END 0x801FFFFF
/*----------------------------------------------------------------------*/ /* CPC45 Memory Map */ /*----------------------------------------------------------------------*/ #define SRAM_BASE 0x80000000 /* SRAM base address */ +#define SRAM_END 0x801FFFFF #define ST16552_A_BASE 0x80200000 /* ST16552 channel A */ #define ST16552_B_BASE 0x80400000 /* ST16552 channel A */ #define BCSR_BASE 0x80600000 /* board control / status registers */ @@ -361,6 +360,8 @@ #define PCMCIA_MEM_BASE 0x83000000 /* PCMCIA memory window base */ #define PCMCIA_IO_BASE 0xFE000000 /* PCMCIA IO window base */
+#define CONFIG_SYS_SRAM_BASE SRAM_BASE +#define CONFIG_SYS_SRAM_SIZE (SRAM_SIZE + SRAM_END + 1)
/*---------------------------------------------------------------------*/ /* CPC45 Control/Status Registers */ diff --git a/include/configs/IP860.h b/include/configs/IP860.h index be63ea5..ed6b7fd 100644 --- a/include/configs/IP860.h +++ b/include/configs/IP860.h @@ -375,6 +375,8 @@ extern unsigned long ip860_get_clk_freq (void); #define SRAM_SIZE (1 + (~(CONFIG_SYS_OR3 & BR_BA_MSK))) #define CONFIG_SYS_OR3_PRELIM CONFIG_SYS_OR3 /* Make sure to map early */ #define CONFIG_SYS_BR3_PRELIM CONFIG_SYS_BR3 /* in case it's used for ENV */ +#define CONFIG_SYS_SRAM_BASE SRAM_BASE +#define CONFIG_SYS_SRAM_SIZE SRAM_SIZE
/* * BR4/OR4 - Board Control & Status (8 bit)

On Wed, Aug 11, 2010 at 3:38 AM, Wolfgang Denk wrote:
Traditionally many boards used local definitions for SRAM base address and size (like SRAM_BASE, SRAM_LEN and/or SRAM_SIZE), while the (now) "official" names are CONFIG_SYS_SRAM_BASE and CONFIG_SYS_SRAM_SIZE.
The corresponding code in arch/powerpc/lib/board.c was board specific, and has never actually been maintained well. Replace this by feature- specific code and adapt the boards that actually use this.
NOTE: there is still a ton of boards using the old #defines, which therefor contain incorrect values in bi_sramstart and bi_sramsize.
All respective board maintainers are requested to clean up their respective configurations. Thanks.
#if defined(SRAM_BASE) || defined(SRAM_LEN) || defined(SRAM_SIZE) # warning "your board config.h needs to update its SRAM define names to CONFI_SYS_SRAM_xxx" #endif -mike

A number of boards define CONFIG_SYS_SRAM_BASE but fail to define CONFIG_SYS_SRAM_SIZE which is needed when cleaning up the code that prints this information with the bdinfo command.
Add the missing deinitions.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Stefan Roese sr@denx.de --- include/configs/bubinga.h | 1 + include/configs/canyonlands.h | 1 + include/configs/intip.h | 1 + include/configs/luan.h | 1 + include/configs/t3corp.h | 1 + 5 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/configs/bubinga.h b/include/configs/bubinga.h index 627060a..159a265 100644 --- a/include/configs/bubinga.h +++ b/include/configs/bubinga.h @@ -179,6 +179,7 @@ * (Set up by the startup code) */ #define CONFIG_SYS_SRAM_BASE 0xFFF00000 +#define CONFIG_SYS_SRAM_SIZE (256 << 10) #define CONFIG_SYS_FLASH_BASE 0xFFF80000
/*----------------------------------------------------------------------- diff --git a/include/configs/canyonlands.h b/include/configs/canyonlands.h index 6fe7639..e2c58a5 100644 --- a/include/configs/canyonlands.h +++ b/include/configs/canyonlands.h @@ -111,6 +111,7 @@
#define CONFIG_SYS_OCM_BASE 0xE3000000 /* OCM: 64k */ #define CONFIG_SYS_SRAM_BASE 0xE8000000 /* SRAM: 256k */ +#define CONFIG_SYS_SRAM_SIZE (256 << 10) #define CONFIG_SYS_LOCAL_CONF_REGS 0xEF000000
#define CONFIG_SYS_PERIPHERAL_BASE 0xEF600000 /* internal peripherals */ diff --git a/include/configs/intip.h b/include/configs/intip.h index 19f12fa..0c0bb37 100644 --- a/include/configs/intip.h +++ b/include/configs/intip.h @@ -93,6 +93,7 @@
#define CONFIG_SYS_OCM_BASE 0xE3000000 /* OCM: 64k */ #define CONFIG_SYS_SRAM_BASE 0xE8000000 /* SRAM: 256k */ +#define CONFIG_SYS_SRAM_SIZE (256 << 10) #define CONFIG_SYS_LOCAL_CONF_REGS 0xEF000000
#define CONFIG_SYS_PERIPHERAL_BASE 0xEF600000 /* internal periph. */ diff --git a/include/configs/luan.h b/include/configs/luan.h index b158b74..ccd9397 100644 --- a/include/configs/luan.h +++ b/include/configs/luan.h @@ -53,6 +53,7 @@ #define CONFIG_SYS_LARGE_FLASH 0xffc00000 /* 4MB flash address CS0 */ #define CONFIG_SYS_SMALL_FLASH 0xff900000 /* 1MB flash address CS2 */ #define CONFIG_SYS_SRAM_BASE 0xff800000 /* 1MB SRAM address CS2 */ +#define CONFIG_SYS_SRAM_SIZE (1 << 20) #define CONFIG_SYS_EPLD_BASE 0xff000000 /* EPLD and FRAM CS1 */
#define CONFIG_SYS_ISRAM_BASE 0xf8000000 /* internal 8k SRAM (L2 cache) */ diff --git a/include/configs/t3corp.h b/include/configs/t3corp.h index b38886b..41ee15b 100644 --- a/include/configs/t3corp.h +++ b/include/configs/t3corp.h @@ -86,6 +86,7 @@
#define CONFIG_SYS_OCM_BASE 0xE7000000 /* OCM: 64k */ #define CONFIG_SYS_SRAM_BASE 0xE8000000 /* SRAM: 256k */ +#define CONFIG_SYS_SRAM_SIZE (256 << 10) #define CONFIG_SYS_LOCAL_CONF_REGS 0xEF000000
#define CONFIG_SYS_PERIPHERAL_BASE 0xEF600000 /* internal periph. */

Hi Wolfgang,
On Saturday 11 September 2010 21:40:05 Wolfgang Denk wrote:
A number of boards define CONFIG_SYS_SRAM_BASE but fail to define CONFIG_SYS_SRAM_SIZE which is needed when cleaning up the code that prints this information with the bdinfo command.
Add the missing deinitions.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Stefan Roese sr@denx.de
Acked-by: Stefan Roese sr@denx.de
Feel free to pull this patch directly if needed.
Thanks.
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

In message 1284234005-9658-1-git-send-email-wd@denx.de you wrote:
A number of boards define CONFIG_SYS_SRAM_BASE but fail to define CONFIG_SYS_SRAM_SIZE which is needed when cleaning up the code that prints this information with the bdinfo command.
Add the missing deinitions.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Stefan Roese sr@denx.de
include/configs/bubinga.h | 1 + include/configs/canyonlands.h | 1 + include/configs/intip.h | 1 + include/configs/luan.h | 1 + include/configs/t3corp.h | 1 + 5 files changed, 5 insertions(+), 0 deletions(-)
Applied to "next" branch.

Traditionally many boards used local definitions for SRAM base address and size (like SRAM_BASE, SRAM_LEN and/or SRAM_SIZE), while the (now) "official" names are CONFIG_SYS_SRAM_BASE and CONFIG_SYS_SRAM_SIZE.
The corresponding code in arch/powerpc/lib/board.c was board specific, and has never actually been maintained well. Replace this by feature- specific code and adapt the boards that actually use this.
NOTE: there is still a ton of boards using the old #defines, which therefor contain incorrect values in bi_sramstart and bi_sramsize.
All respective board maintainers are requested to clean up their respective configurations. Thanks.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Josef Wagner Wagner@Microsys.de Cc: Stefan Roese sr@denx.de Cc: Heiko Schocher hs@denx.de Cc: Wolfgang Denk wd@denx.de --- V2: fixed bug in CPC45 config file (did not compile)
arch/powerpc/lib/board.c | 9 +++------ include/configs/CPC45.h | 5 +++-- include/configs/IP860.h | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c index 0e00d86..6b1ff08 100644 --- a/arch/powerpc/lib/board.c +++ b/arch/powerpc/lib/board.c @@ -519,15 +519,12 @@ void board_init_f (ulong bootflag) bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of DRAM memory */ bd->bi_memsize = gd->ram_size; /* size of DRAM memory in bytes */
-#ifdef CONFIG_IP860 - bd->bi_sramstart = SRAM_BASE; /* start of SRAM memory */ - bd->bi_sramsize = SRAM_SIZE; /* size of SRAM memory */ -#elif defined CONFIG_MPC8220 +#ifdef CONFIG_SYS_SRAM_BASE bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM memory */ bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM memory */ #else - bd->bi_sramstart = 0; /* FIXME */ /* start of SRAM memory */ - bd->bi_sramsize = 0; /* FIXME */ /* size of SRAM memory */ + bd->bi_sramstart = 0; + bd->bi_sramsize = 0; #endif
#if defined(CONFIG_8xx) || defined(CONFIG_8260) || defined(CONFIG_5xx) || \ diff --git a/include/configs/CPC45.h b/include/configs/CPC45.h index 91d262a..668cfa2 100644 --- a/include/configs/CPC45.h +++ b/include/configs/CPC45.h @@ -347,13 +347,12 @@ #define BOOTFLAG_WARM 0x02 /* Software reboot */
-#define SRAM_BASE 0x80000000 /* SRAM base address */ -#define SRAM_END 0x801FFFFF
/*----------------------------------------------------------------------*/ /* CPC45 Memory Map */ /*----------------------------------------------------------------------*/ #define SRAM_BASE 0x80000000 /* SRAM base address */ +#define SRAM_END 0x801FFFFF #define ST16552_A_BASE 0x80200000 /* ST16552 channel A */ #define ST16552_B_BASE 0x80400000 /* ST16552 channel A */ #define BCSR_BASE 0x80600000 /* board control / status registers */ @@ -361,6 +360,8 @@ #define PCMCIA_MEM_BASE 0x83000000 /* PCMCIA memory window base */ #define PCMCIA_IO_BASE 0xFE000000 /* PCMCIA IO window base */
+#define CONFIG_SYS_SRAM_BASE SRAM_BASE +#define CONFIG_SYS_SRAM_SIZE (SRAM_END - SRAM_BASE + 1)
/*---------------------------------------------------------------------*/ /* CPC45 Control/Status Registers */ diff --git a/include/configs/IP860.h b/include/configs/IP860.h index be63ea5..ed6b7fd 100644 --- a/include/configs/IP860.h +++ b/include/configs/IP860.h @@ -375,6 +375,8 @@ extern unsigned long ip860_get_clk_freq (void); #define SRAM_SIZE (1 + (~(CONFIG_SYS_OR3 & BR_BA_MSK))) #define CONFIG_SYS_OR3_PRELIM CONFIG_SYS_OR3 /* Make sure to map early */ #define CONFIG_SYS_BR3_PRELIM CONFIG_SYS_BR3 /* in case it's used for ENV */ +#define CONFIG_SYS_SRAM_BASE SRAM_BASE +#define CONFIG_SYS_SRAM_SIZE SRAM_SIZE
/* * BR4/OR4 - Board Control & Status (8 bit)

In message 1284234142-10234-1-git-send-email-wd@denx.de you wrote:
Traditionally many boards used local definitions for SRAM base address and size (like SRAM_BASE, SRAM_LEN and/or SRAM_SIZE), while the (now) "official" names are CONFIG_SYS_SRAM_BASE and CONFIG_SYS_SRAM_SIZE.
The corresponding code in arch/powerpc/lib/board.c was board specific, and has never actually been maintained well. Replace this by feature- specific code and adapt the boards that actually use this.
NOTE: there is still a ton of boards using the old #defines, which therefor contain incorrect values in bi_sramstart and bi_sramsize.
All respective board maintainers are requested to clean up their respective configurations. Thanks.
Signed-off-by: Wolfgang Denk wd@denx.de Cc: Josef Wagner Wagner@Microsys.de Cc: Stefan Roese sr@denx.de Cc: Heiko Schocher hs@denx.de Cc: Wolfgang Denk wd@denx.de
V2: fixed bug in CPC45 config file (did not compile)
arch/powerpc/lib/board.c | 9 +++------ include/configs/CPC45.h | 5 +++-- include/configs/IP860.h | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-)
Applied to "next" branch.
participants (3)
-
Mike Frysinger
-
Stefan Roese
-
Wolfgang Denk