All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5] boot: fdt: fixup the memory dt nodes falcon boot
Date: Tue, 18 Apr 2017 15:25:12 +0200	[thread overview]
Message-ID: <20170418152512.14b12e4b@jawa> (raw)
In-Reply-To: <1492516647-26840-6-git-send-email-ravibabu@ti.com>

Hi Ravi,

> In single stage bootmode or falcon boot mode,
> the SPL shall update the memory dt nodes
> spl_fixup_fdt() based on DDR configuration for
> specific platform.
> 
> Signed-off-by: Ravi Babu <ravibabu@ti.com>
> ---
>  common/spl/spl.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index f11b370..b9b1331 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -17,6 +17,7 @@
>  #include <malloc.h>
>  #include <dm/root.h>
>  #include <linux/compiler.h>
> +#include <fdt_support.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -56,6 +57,14 @@ __weak int spl_start_uboot(void)
>  	return 1;
>  }
>  
> +/* weak default platform specific function to initialize
> + * dram banks
> + */
> +__weak int dram_init_banksize(void)
> +{
> +	return 0;
> +}
> +
>  /*
>   * Weak default function for arch specific zImage check. Return zero
>   * and fill start and end address if image is recognized.
> @@ -66,6 +75,33 @@ int __weak bootz_setup(ulong image, ulong *start,
> ulong *end) }
>  #endif
>  
> +void spl_fixup_fdt(void)
> +{
> +#if defined(CONFIG_SPL_OF_LIBFDT) &&
> defined(CONFIG_SYS_SPL_ARGS_ADDR)
> +	void *fdt_blob = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
> +	int err;
> +
> +	err = fdt_check_header(fdt_blob);
> +	if (err < 0) {
> +		printf("fdt_root: %s\n", fdt_strerror(err));
> +		return;
> +	}
> +
> +	/* fixup the memory dt node */
> +	err = fdt_shrink_to_minimum(fdt_blob, 0);
> +	if (err == 0) {
> +		printf("spl: fdt_shrink_to_minimum err - %d\n", err);
> +		return;
> +	}
> +
> +	err = arch_fixup_fdt(fdt_blob);
> +	if (err) {
> +		printf("spl: arch_fixup_fdt err - %d\n", err);
> +		return;
> +	}
> +#endif
> +}
> +
>  /*
>   * Weak default function for board specific cleanup/preparation
> before
>   * Linux boot. Some boards/platforms might not need it, so just
> provide @@ -323,6 +359,9 @@ void board_init_r(gd_t *dummy1, ulong
> dummy2) 
>  	debug(">>spl:board_init_r()\n");
>  	gd->bd = &bdata;
> +#ifdef CONFIG_SPL_OS_BOOT
> +	dram_init_banksize();

	What is the purpose of this function? In this point the SDRAM
	should be already configured.

In patch 2/5 you already configured TI's specific "board_init_f" to add
some memory related information to gd struct.


> +#endif
>  
>  #if defined(CONFIG_SYS_SPL_MALLOC_START)
>  	mem_malloc_init(CONFIG_SYS_SPL_MALLOC_START,
> @@ -361,6 +400,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  #ifdef CONFIG_SPL_OS_BOOT
>  	case IH_OS_LINUX:
>  		debug("Jumping to Linux\n");
> +		spl_fixup_fdt();
>  		spl_board_prepare_for_linux();
>  		jump_to_image_linux(&spl_image,
>  				    (void
> *)CONFIG_SYS_SPL_ARGS_ADDR);




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

  reply	other threads:[~2017-04-18 13:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 11:57 [U-Boot] [PATCH 0/5] QSPI: Falcon or single stage boot mode support Ravi Babu
2017-04-18 11:57 ` [U-Boot] [PATCH 1/5] spl: reorder the assignment of board info to global data Ravi Babu
2017-04-18 13:25   ` Lukasz Majewski
2017-04-18 13:42   ` Tom Rini
2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
2017-08-03  0:53   ` York Sun
2017-04-18 11:57 ` [U-Boot] [PATCH 2/5] arch: arm: omap: Declare size of ddr very early Ravi Babu
2017-04-18 13:33   ` Lukasz Majewski
2017-04-18 14:09     ` B, Ravi
2017-04-20  2:08     ` Lokesh Vutla
2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-18 11:57 ` [U-Boot] [PATCH 3/5] qspi: dra7xx: enable qspi-boot for dra7x paltform Ravi Babu
2017-04-18 13:33   ` Lukasz Majewski
2017-05-12 17:18   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-18 11:57 ` [U-Boot] [PATCH 4/5] spl: fdt: support for fdt fixup for falcon boot Ravi Babu
2017-04-18 13:35   ` Lukasz Majewski
2017-05-12 17:19   ` [U-Boot] [U-Boot, " Tom Rini
2017-04-18 11:57 ` [U-Boot] [PATCH 5/5] boot: fdt: fixup the memory dt nodes " Ravi Babu
2017-04-18 13:25   ` Lukasz Majewski [this message]
2017-04-18 14:05     ` B, Ravi
2017-04-20  1:54     ` Lokesh Vutla
2017-05-12 17:19   ` [U-Boot] [U-Boot, " Tom Rini
2017-08-02 19:10   ` York Sun
2017-08-02 19:32     ` Tom Rini
2017-08-26 11:50       ` Jagan Teki
2017-08-28 16:47         ` York Sun
2017-08-29 19:29           ` Jagan Teki
2017-08-29 20:21             ` York Sun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170418152512.14b12e4b@jawa \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.