diff mbox series

[1/2] ARM: uniphier: set gd->ram_base correctly

Message ID 20200130132038.9757-1-yamada.masahiro@socionext.com
State Accepted
Commit 6da69d33f5280c9c80690310e1fb3d3e1c821d3e
Delegated to: Masahiro Yamada
Headers show
Series [1/2] ARM: uniphier: set gd->ram_base correctly | expand

Commit Message

Masahiro Yamada Jan. 30, 2020, 1:20 p.m. UTC
gd->ram_base is not set at all if the end address of the DRAM ch0
exceeds 4GB.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/mach-uniphier/dram_init.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Masahiro Yamada Jan. 31, 2020, 4:56 p.m. UTC | #1
On Thu, Jan 30, 2020 at 10:21 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> gd->ram_base is not set at all if the end address of the DRAM ch0
> exceeds 4GB.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---


Applied to u-boot-uniphier.



>
>  arch/arm/mach-uniphier/dram_init.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c
> index 13821a928831..5f9d90fe6dc0 100644
> --- a/arch/arm/mach-uniphier/dram_init.c
> +++ b/arch/arm/mach-uniphier/dram_init.c
> @@ -248,12 +248,7 @@ int dram_init(void)
>
>                 max_size = (1ULL << 32) - dram_map[i].base;
>
> -               if (dram_map[i].size > max_size) {
> -                       gd->ram_size += max_size;
> -                       break;
> -               }
> -
> -               gd->ram_size += dram_map[i].size;
> +               gd->ram_size = min(dram_map[i].size, max_size);
>
>                 if (!valid_bank_found)
>                         gd->ram_base = dram_map[i].base;
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c
index 13821a928831..5f9d90fe6dc0 100644
--- a/arch/arm/mach-uniphier/dram_init.c
+++ b/arch/arm/mach-uniphier/dram_init.c
@@ -248,12 +248,7 @@  int dram_init(void)
 
 		max_size = (1ULL << 32) - dram_map[i].base;
 
-		if (dram_map[i].size > max_size) {
-			gd->ram_size += max_size;
-			break;
-		}
-
-		gd->ram_size += dram_map[i].size;
+		gd->ram_size = min(dram_map[i].size, max_size);
 
 		if (!valid_bank_found)
 			gd->ram_base = dram_map[i].base;