diff mbox series

[3/4] board: keymile: common: fix pnvramaddr and varaddr address calculation

Message ID VI1PR06MB4029EC75BE4B4C253D514BD0D2A90@VI1PR06MB4029.eurprd06.prod.outlook.com
State Changes Requested
Delegated to: Priyanka Jain
Headers show
Series [1/4] board: keymile: common: fix qrio compilation for arm | expand

Commit Message

Aleksandar Gerasimovski Jan. 13, 2021, 4:21 p.m. UTC
Take into account SDRAM_BASE address when calculating pnvramaddr and
varaddr offsets.
Up to now Keymile designs had SDRAM_BASE equal to zero and the offsets
where calculated correctly, this fix is for the upcoming designs that
have SDRAM_BASE different then zero.

Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-powergrids.com>
---
 board/keymile/common/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Priyanka Jain (OSS) Jan. 19, 2021, 6:52 a.m. UTC | #1
>-----Original Message-----
>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Aleksandar
>Gerasimovski
>Sent: Wednesday, January 13, 2021 9:51 PM
>To: u-boot@lists.denx.de
>Cc: Valentin Longchamp <valentin.longchamp@hitachi-powergrids.com>; Holger
>Brunck <holger.brunck@hitachi-powergrids.com>; Rainer Boschung
><rainer.boschung@hitachi-powergrids.com>; Matteo Ghidoni
><matteo.ghidoni@hitachi-powergrids.com>
>Subject: [PATCH 3/4] board: keymile: common: fix pnvramaddr and varaddr
>address calculation
>
Please trim subject line to 60 characters
>Take into account SDRAM_BASE address when calculating pnvramaddr and
>varaddr offsets.
>Up to now Keymile designs had SDRAM_BASE equal to zero and the offsets where
>calculated correctly, this fix is for the upcoming designs that have SDRAM_BASE
>different then zero.
>
>Signed-off-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachi-
>powergrids.com>
<snip>

Regards
Priyanka
diff mbox series

Patch

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index df507e2..e3e9c4a 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -49,8 +49,8 @@  int set_km_env(void)
 	char *p;
 	unsigned long rootfssize = 0;
 
-	pnvramaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM
-			- CONFIG_KM_PNVRAM;
+	pnvramaddr = CONFIG_SYS_SDRAM_BASE + gd->ram_size -
+		CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM - CONFIG_KM_PNVRAM;
 	sprintf((char *)buf, "0x%x", pnvramaddr);
 	env_set("pnvramaddr", (char *)buf);
 
@@ -63,7 +63,8 @@  int set_km_env(void)
 	sprintf((char *)buf, "0x%x", pram);
 	env_set("pram", (char *)buf);
 
-	varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
+	varaddr = CONFIG_SYS_SDRAM_BASE + gd->ram_size -
+		CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM;
 	sprintf((char *)buf, "0x%x", varaddr);
 	env_set("varaddr", (char *)buf);