Re: [U-Boot] [PATCH v2 2/2] rockchip: fix incorrect detection of ram size

2018-11-15 Thread Philipp Tomsich
Marty,

> On 13.09.2018, at 23:55, Marty E. Plummer  wrote:
> 
> Taken from coreboot's src/soc/rockchip/rk3288/sdram.c
> 
> Without this change, my u-boot build for the asus c201 chromebook (4GiB)
> is incorrectly detected as 0 Bytes of ram.
> 
> Signed-off-by: Marty E. Plummer 

Please revise.
See below.

> ---
> arch/arm/mach-rockchip/sdram_common.c | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/sdram_common.c 
> b/arch/arm/mach-rockchip/sdram_common.c
> index 650d53e4d9..194dc74b9f 100644
> --- a/arch/arm/mach-rockchip/sdram_common.c
> +++ b/arch/arm/mach-rockchip/sdram_common.c
> @@ -48,6 +48,8 @@ size_t rockchip_sdram_size(phys_addr_t reg)
> rank, col, bk, cs0_row, bw, row_3_4);
>   }
> 
> + size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
> +

   aarch64:  +   evb-rk3399 firefly-rk3399 geekbox evb-px5 sheep-rk3368 
lion-rk3368 evb-rk3328 puma-rk3399
+In file included from include/linux/delay.h:6:0,
+ from include/common.h:26,
+ from arch/arm/mach-rockchip/sdram_common.c:6:
+arch/arm/mach-rockchip/sdram_common.c: In function 'rockchip_sdram_size':
+include/linux/kernel.h:161:17: error: comparison of distinct pointer types 
lacks a cast [-Werror]
+  (void) (&_min1 == &_min2);  \
+ ^
+arch/arm/mach-rockchip/sdram_common.c:51:12: note: in expansion of macro 'min'
+  size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
+^~~
+cc1: all warnings being treated as errors

>   return (size_t)size_mb << 20;
> }
> 
> -- 
> 2.18.0
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] rockchip: fix incorrect detection of ram size

2018-09-14 Thread Marty E. Plummer
On Fri, Sep 14, 2018 at 12:55:19PM +0200, Simon Glass wrote:
> Hi Marty,
> 
> 
> On 13 September 2018 at 23:55, Marty E. Plummer  
> wrote:
> > Taken from coreboot's src/soc/rockchip/rk3288/sdram.c
> >
> > Without this change, my u-boot build for the asus c201 chromebook (4GiB)
> > is incorrectly detected as 0 Bytes of ram.
> >
> > Signed-off-by: Marty E. Plummer 
> > ---
> >  arch/arm/mach-rockchip/sdram_common.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arm/mach-rockchip/sdram_common.c 
> > b/arch/arm/mach-rockchip/sdram_common.c
> > index 650d53e4d9..194dc74b9f 100644
> > --- a/arch/arm/mach-rockchip/sdram_common.c
> > +++ b/arch/arm/mach-rockchip/sdram_common.c
> > @@ -48,6 +48,8 @@ size_t rockchip_sdram_size(phys_addr_t reg)
> >   rank, col, bk, cs0_row, bw, row_3_4);
> > }
> >
> > +   size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
> > +
> 
> Is this because size_mb is only 32-bits?
>
Yeah. This has been discussed a bit before on the ml. 0x1__ for
4GiB, and due to memory mapped peripherals it can only address
0xff00_ bytes anyways so clamp it down. Code is lifted from
coreboot's init code.
> > return (size_t)size_mb << 20;
> >  }
> >
> > --
> > 2.18.0
> >
> 
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] rockchip: fix incorrect detection of ram size

2018-09-14 Thread Simon Glass
Hi Marty,


On 13 September 2018 at 23:55, Marty E. Plummer  wrote:
> Taken from coreboot's src/soc/rockchip/rk3288/sdram.c
>
> Without this change, my u-boot build for the asus c201 chromebook (4GiB)
> is incorrectly detected as 0 Bytes of ram.
>
> Signed-off-by: Marty E. Plummer 
> ---
>  arch/arm/mach-rockchip/sdram_common.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/sdram_common.c 
> b/arch/arm/mach-rockchip/sdram_common.c
> index 650d53e4d9..194dc74b9f 100644
> --- a/arch/arm/mach-rockchip/sdram_common.c
> +++ b/arch/arm/mach-rockchip/sdram_common.c
> @@ -48,6 +48,8 @@ size_t rockchip_sdram_size(phys_addr_t reg)
>   rank, col, bk, cs0_row, bw, row_3_4);
> }
>
> +   size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
> +

Is this because size_mb is only 32-bits?

> return (size_t)size_mb << 20;
>  }
>
> --
> 2.18.0
>

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] rockchip: fix incorrect detection of ram size

2018-09-13 Thread Marty E. Plummer
Taken from coreboot's src/soc/rockchip/rk3288/sdram.c

Without this change, my u-boot build for the asus c201 chromebook (4GiB)
is incorrectly detected as 0 Bytes of ram.

Signed-off-by: Marty E. Plummer 
---
 arch/arm/mach-rockchip/sdram_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-rockchip/sdram_common.c 
b/arch/arm/mach-rockchip/sdram_common.c
index 650d53e4d9..194dc74b9f 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -48,6 +48,8 @@ size_t rockchip_sdram_size(phys_addr_t reg)
  rank, col, bk, cs0_row, bw, row_3_4);
}
 
+   size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
+
return (size_t)size_mb << 20;
 }
 
-- 
2.18.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot