diff mbox series

[v1,7/9] configs: gxp: add core support

Message ID 20220526185548.14104-7-nick.hawkins@hpe.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Introduce HPE GXP Architecture | expand

Commit Message

Hawkins, Nick May 26, 2022, 6:55 p.m. UTC
From: Nick Hawkins <nick.hawkins@hpe.com>

Add the include file for the gxp soc.

Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
---
 include/configs/gxp.h | 96 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 include/configs/gxp.h

Comments

Tom Rini June 1, 2022, 2:24 p.m. UTC | #1
On Thu, May 26, 2022 at 01:55:46PM -0500, nick.hawkins@hpe.com wrote:

> From: Nick Hawkins <nick.hawkins@hpe.com>
> 
> Add the include file for the gxp soc.
> 
> Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
[snip]
> +#ifdef CONFIG_TARGET_GXP
> +#ifdef CONFIG_GXP_ECC
> +    #define CONFIG_SYS_SDRAM_SIZE       0x0f800000
> +#else
> +    #define CONFIG_SYS_SDRAM_SIZE       0x1f000000
> +#endif
> +
> +#ifdef CONFIG_GXP_VROM_64MB
> +    #undef CONFIG_SYS_SDRAM_SIZE
> +    #ifdef CONFIG_GXP_ECC
> +	#define CONFIG_SYS_SDRAM_SIZE   0x0c000000
> +    #else
> +	#define CONFIG_SYS_SDRAM_SIZE   0x18000000
> +    #endif
> +#endif

Can we figure any of that out dynamically instead?  Since
CONFIG_SYS_SDRAM_SIZE is only used (for ARM) in board code, I'd rather
see this handled in there, with SZ_xxx and not use CONFIG_SYS_SDRAM_SIZE
at all.
Hawkins, Nick June 2, 2022, 2:46 p.m. UTC | #2
> Can we figure any of that out dynamically instead?  Since CONFIG_SYS_SDRAM_SIZE is only used (for ARM) in board code, I'd rather see this handled in there, with SZ_xxx and not use CONFIG_SYS_SDRAM_SIZE at all.

Hi Tom,

Would something like this be acceptable?

int dram_init(void)
{
#ifdef CONFIG_TARGET_GXP
        #ifdef CONFIG_GXP_ECC
        gd->ram_size = SZ_128M + SZ_64M + SZ_32M + SZ_16M + SZ_8M;
        #else
        gd->ram_size = SZ_256M + SZ_128M + SZ_64M + SZ_32M + SZ_16M;
        #endif
#endif

#ifdef CONFIG_GXP_VROM_64MB
        #ifdef CONFIG_GXP_ECC
        gd->ram_size = SZ_128M + SZ_64M;
        #else
        gd->ram_size = SZ_256M + SZ_128M;
        #endif
#endif
        return 0;
}

Thanks for the feedback,

-Nick Hawkins
Tom Rini June 2, 2022, 2:50 p.m. UTC | #3
On Thu, Jun 02, 2022 at 02:46:09PM +0000, Hawkins, Nick wrote:
> 
> 
> > Can we figure any of that out dynamically instead?  Since CONFIG_SYS_SDRAM_SIZE is only used (for ARM) in board code, I'd rather see this handled in there, with SZ_xxx and not use CONFIG_SYS_SDRAM_SIZE at all.
> 
> Hi Tom,
> 
> Would something like this be acceptable?
> 
> int dram_init(void)
> {
> #ifdef CONFIG_TARGET_GXP
>         #ifdef CONFIG_GXP_ECC
>         gd->ram_size = SZ_128M + SZ_64M + SZ_32M + SZ_16M + SZ_8M;
>         #else
>         gd->ram_size = SZ_256M + SZ_128M + SZ_64M + SZ_32M + SZ_16M;
>         #endif
> #endif
> 
> #ifdef CONFIG_GXP_VROM_64MB
>         #ifdef CONFIG_GXP_ECC
>         gd->ram_size = SZ_128M + SZ_64M;
>         #else
>         gd->ram_size = SZ_256M + SZ_128M;
>         #endif
> #endif
>         return 0;
> }
> 
> Thanks for the feedback,

Without indenting the #ifdef's, yes, that's better.  Ideally you should
just call get_ram_size(base_addr, max-possible-valid-size) and that
will return the correct value.
diff mbox series

Patch

diff --git a/include/configs/gxp.h b/include/configs/gxp.h
new file mode 100644
index 0000000000..601d6e405d
--- /dev/null
+++ b/include/configs/gxp.h
@@ -0,0 +1,96 @@ 
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * GXP board
+ *
+ * (C) Copyright 2022 Hewlett Packard Enterprise Development LP.
+ * Author: Nick Hawkins <nick.hawkins@hpe.com>
+ * Author: Jean-Marie Verdun <verdun@hpe.com>
+ */
+
+#ifndef _GXP_H_
+#define _GXP_H_
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#define CONFIG_SYS_MALLOC_LEN   0x4000000
+#define CONFIG_SYS_INIT_SP_ADDR 0x2000000
+
+#ifdef CONFIG_TARGET_GXP
+#ifdef CONFIG_GXP_ECC
+    #define CONFIG_SYS_SDRAM_SIZE       0x0f800000
+#else
+    #define CONFIG_SYS_SDRAM_SIZE       0x1f000000
+#endif
+
+#ifdef CONFIG_GXP_VROM_64MB
+    #undef CONFIG_SYS_SDRAM_SIZE
+    #ifdef CONFIG_GXP_ECC
+	#define CONFIG_SYS_SDRAM_SIZE   0x0c000000
+    #else
+	#define CONFIG_SYS_SDRAM_SIZE   0x18000000
+    #endif
+#endif
+
+#ifdef CONFIG_GXP_VROM_32MB
+    #undef CONFIG_SYS_SDRAM_SIZE
+    #ifdef CONFIG_GXP_ECC
+	#define CONFIG_SYS_SDRAM_SIZE   0x0e000000
+    #else
+	#define CONFIG_SYS_SDRAM_SIZE   0x1c000000
+    #endif
+#endif
+#endif
+
+#ifdef CONFIG_TARGET_GXP2
+    #define CONFIG_SYS_SDRAM_SIZE   0x1b200000
+
+#ifdef CONFIG_GXP_VROM_64MB
+    #undef CONFIG_SYS_SDRAM_SIZE
+    #define CONFIG_SYS_SDRAM_SIZE   0x14000000
+#endif
+
+#ifdef CONFIG_GXP_VROM_32MB
+    #undef CONFIG_SYS_SDRAM_SIZE
+    #define CONFIG_SYS_SDRAM_SIZE   0x18000000
+#endif
+#endif
+
+#define CONFIG_SYS_SDRAM_BASE   0x40000000
+#define CONFIG_SYS_LOAD_ADDR    0x40100000
+#define CONFIG_BOOTCOMMAND  "run spiboot"
+//#define CONFIG_SYS_BOOTM_LEN    0xC00000
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"recover_file=openbmc-hpe-recovery-image.mtd\0" \
+	"recover_cmd=usb start; " \
+	"mw.b 0xD100000D 0x40; " \
+	"if fatload usb 0 0x50000000 $recover_file 0x4C0000 0x80000; then " \
+		"setenv bootargs console=ttyS0,115200 recovery; " \
+		"setenv force_recovery; " \
+		"saveenv; " \
+		"bootm  0x50000000; " \
+	"else " \
+		"while itest 0 < 1; do " \
+		"mw.b 0xd1000005 0xc0; " \
+		"sleep .1; " \
+		"mw.b 0xd1000005 0x00; " \
+		"sleep .1; " \
+		"done; " \
+	"fi; " \
+	"reset;\0" \
+	"spiboot=if itest.b *0xD10000B2 == 6; then " \
+		"run recover_cmd;" \
+	"fi;" \
+	"if printenv force_recovery; then " \
+		"run recover_cmd; " \
+	"else " \
+		"bootm 0xfc080000; " \
+		"run recover_cmd; " \
+	"fi;\0"
+
+/*--------------------------------------------------------------------------*/
+/*              Network Configuration             */
+/*--------------------------------------------------------------------------*/
+#define CONFIG_PHY_ADDR             0
+
+#endif