[U-Boot] [PATCH v4 8/8] armv8: cavium: Get DRAM size from ATF

Jagan Teki jteki at openedev.com
Tue Aug 18 14:59:28 CEST 2015


On 18 August 2015 at 17:56, Sergey Temerkhanov <s.temerkhanov at gmail.com> wrote:
> Change the dram_init() function on ThunderX to query ATF services for
> the real installed DRAM size
>
> Signed-off-by: Sergey Temerkhanov <s.temerkhanov at gmail.com>
> Signed-off-by: Radha Mohan Chintakuntla <rchintakuntla at cavium.com>
> ---
>
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  board/cavium/thunderx/Makefile   |  2 +-
>  board/cavium/thunderx/dram.c     | 35 +++++++++++++++++++++++++++++++++++
>  board/cavium/thunderx/thunderx.c | 12 ------------
>  3 files changed, 36 insertions(+), 13 deletions(-)
>  create mode 100644 board/cavium/thunderx/dram.c
>
> diff --git a/board/cavium/thunderx/Makefile b/board/cavium/thunderx/Makefile
> index c78c414..9200dd6 100644
> --- a/board/cavium/thunderx/Makefile
> +++ b/board/cavium/thunderx/Makefile
> @@ -5,4 +5,4 @@
>  # SPDX-License-Identifier:     GPL-2.0+
>  #
>
> -obj-y  := thunderx.o atf.o
> +obj-y  := thunderx.o atf.o dram.o
> diff --git a/board/cavium/thunderx/dram.c b/board/cavium/thunderx/dram.c
> new file mode 100644
> index 0000000..858699d
> --- /dev/null
> +++ b/board/cavium/thunderx/dram.c

Use the same board file where you tried on 6/8 and do dram_init, may not
require to do an extra file for DDR initialization unless it a pure ddr driver.

Skip dram_init on 6/8 and add this patch on board file.

> @@ -0,0 +1,35 @@
> +/**
> + * (C) Copyright 2014, Cavium Inc.
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> +**/
> +
> +#include <common.h>
> +#include <cavium/atf.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +int dram_init(void)
> +{
> +       ssize_t node_count = atf_node_count();
> +       ssize_t dram_size;
> +       int node;
> +
> +       printf("Initializing\nNodes in system: %zd\n", node_count);
> +
> +       gd->ram_size = 0;
> +
> +       for (node = 0; node < node_count; node++) {
> +               dram_size = atf_dram_size(node);
> +               printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20);
> +               gd->ram_size += dram_size;
> +       }
> +
> +       gd->ram_size -= MEM_BASE;
> +
> +       *(unsigned long *)CPU_RELEASE_ADDR = 0;
> +
> +       puts("DRAM size:");
> +
> +       return 0;
> +}
> diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c
> index c478dd7..6d37e22 100644
> --- a/board/cavium/thunderx/thunderx.c
> +++ b/board/cavium/thunderx/thunderx.c
> @@ -43,18 +43,6 @@ int board_init(void)
>         return 0;
>  }
>
> -int dram_init(void)
> -{
> -       /*
> -        * Clear spin table so that secondary processors
> -        * observe the correct value after waken up from wfe.
> -        */
> -       *(unsigned long *)CPU_RELEASE_ADDR = 0;
> -
> -       gd->ram_size = PHYS_SDRAM_1_SIZE;
> -       return 0;
> -}
> -
>  int timer_init(void)
>  {
>         return 0;
> --
> 2.2.0
>

thanks!
-- 
Jagan | openedev.


More information about the U-Boot mailing list