diff mbox series

[v1,9/9] verdin-imx8mm: automatic ram size detection

Message ID 20201028095816.23906-9-igor.opaniuk@gmail.com
State New
Delegated to: Stefano Babic
Headers show
Series [v1,1/9] toradex: tdx-cfg-clock: add new i.mx 8m mini/plus skus | expand

Commit Message

Igor Opaniuk Oct. 28, 2020, 9:58 a.m. UTC
From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

Implement board_phys_sdram_size() to automatically detect Verdin iMX8M
Mini DualLite 1GB vs. Verdin iMX8M Mini Quad 2GB.

Note: This only works if we keep using similar RAM chips!

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
---

 board/toradex/verdin-imx8mm/verdin-imx8mm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Oleksandr Suvorov Oct. 29, 2020, 4:15 p.m. UTC | #1
On Wed, Oct 28, 2020 at 11:59 AM Igor Opaniuk <igor.opaniuk@gmail.com> wrote:
>
> From: Marcel Ziswiler <marcel.ziswiler@toradex.com>
>
> Implement board_phys_sdram_size() to automatically detect Verdin iMX8M
> Mini DualLite 1GB vs. Verdin iMX8M Mini Quad 2GB.
>
> Note: This only works if we keep using similar RAM chips!
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>

Acked-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>


> ---
>
>  board/toradex/verdin-imx8mm/verdin-imx8mm.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> index 9c6f35e778..7cfae8767c 100644
> --- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> +++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
> @@ -180,6 +180,16 @@ int board_late_init(void)
>         return 0;
>  }
>
> +int board_phys_sdram_size(phys_size_t *size)
> +{
> +       if (!size)
> +               return -EINVAL;
> +
> +       *size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
> +
> +       return 0;
> +}
> +
>  #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
>  int ft_board_setup(void *blob, struct bd_info *bd)
>  {
> --
> 2.17.1
>


--
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00
diff mbox series

Patch

diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 9c6f35e778..7cfae8767c 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -180,6 +180,16 @@  int board_late_init(void)
 	return 0;
 }
 
+int board_phys_sdram_size(phys_size_t *size)
+{
+	if (!size)
+		return -EINVAL;
+
+	*size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
+
+	return 0;
+}
+
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {