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 
<[email protected]>
---
Changes for v2:
 - fix patch subject to 60 characters
---
 board/keymile/common/common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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);
 
-- 
1.8.3.1

-----Original Message-----
From: Priyanka Jain (OSS) <[email protected]> 
Sent: Dienstag, 19. Januar 2021 07:52
To: Aleksandar Gerasimovski <[email protected]>; 
[email protected]
Cc: Valentin Longchamp <[email protected]>; Holger 
Brunck <[email protected]>; Rainer Boschung 
<[email protected]>; Matteo Ghidoni 
<[email protected]>
Subject: RE: [PATCH 3/4] board: keymile: common: fix pnvramaddr and varaddr 
address calculation

CAUTION: This email originated from outside of the organization. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.


>-----Original Message-----
>From: U-Boot <[email protected]> On Behalf Of Aleksandar 
>Gerasimovski
>Sent: Wednesday, January 13, 2021 9:51 PM
>To: [email protected]
>Cc: Valentin Longchamp <[email protected]>; 
>Holger Brunck <[email protected]>; Rainer Boschung 
><[email protected]>; Matteo Ghidoni 
><[email protected]>
>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

Reply via email to