mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <[email protected]>
To: Johannes Schneider <[email protected]>,
	[email protected]
Cc: Marcin Niestroj <[email protected]>
Subject: Re: [PATCH v2] ARM: rpi: parse memory from vc fdt
Date: Wed, 11 Jan 2023 11:07:24 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 11.01.23 10:56, Johannes Schneider wrote:
> From: Marcin Niestroj <[email protected]>

Did you mean to resend a patch already applied to next..?

> 
> Currently for RaspberryPi platform there is only one memory bank
> created, based on information fetched over mailbox. This is fine for
> booting Barebox, but unfortunately all the other memory banks are not
> propagated to Linux during boot, thus cannot be utilized. In fact, even
> when using /vc.dtb as device-tree for Linux, all memory nodes in FDT are
> deleted and new ones are created by Barebox by memory fixup mechanism,
> using exising RAM information. As a result RaspberryPi 4 boots Linux
> with 1GB RAM available, instead of 2GB (2 banks, each 1GB).
> 
> At the end of VideoCore FDT parsing, do the same as of_probe_memory() in
> mem_initcall does, but for VideoCore provided devicetree/memory
> information. During Linux boot this information is used for memory fixup
> mechanism and in case of RaspberryPi 4 this results in 2 memory banks
> being propagated:
> 
>   # ls /proc/device-tree/memory*
>   /proc/device-tree/memory@0:
>   device_type  name         reg
> 
>   /proc/device-tree/memory@40000000:
>   device_type  name         reg
> 
> Signed-off-by: Marcin Niestroj <[email protected]>
> Reviewed-by: Ahmad Fatoum <[email protected]>
> Link: https://lore.barebox.org/[email protected]
> Signed-off-by: Sascha Hauer <[email protected]>
> ---
>  arch/arm/boards/raspberry-pi/rpi-common.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
> index 77935e5c88..c6c7fd52bd 100644
> --- a/arch/arm/boards/raspberry-pi/rpi-common.c
> +++ b/arch/arm/boards/raspberry-pi/rpi-common.c
> @@ -258,7 +258,7 @@ static u32 rpi_boot_mode, rpi_boot_part;
>  static void rpi_vc_fdt_parse(void *fdt)
>  {
>  	int ret;
> -	struct device_node *root, *chosen, *bootloader;
> +	struct device_node *root, *chosen, *bootloader, *memory;
>  	char *str;
>  
>  	root = of_unflatten_dtb(fdt, INT_MAX);
> @@ -324,6 +324,16 @@ static void rpi_vc_fdt_parse(void *fdt)
>  	if (IS_ENABLED(CONFIG_RESET_SOURCE))
>  		reset_source_set(rpi_decode_pm_rsts(chosen, bootloader));
>  
> +	/* Parse all available nodes with "memory" device_type */
> +	memory = root;
> +	while (1) {
> +		memory = of_find_node_by_type(memory, "memory");
> +		if (!memory)
> +			break;
> +
> +		of_add_memory(memory, false);
> +	}
> +
>  out:
>  	if (root)
>  		of_delete_node(root);

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2023-01-11 10:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  9:56 Johannes Schneider
2023-01-11 10:07 ` Ahmad Fatoum [this message]
2023-01-11 10:23   ` SCHNEIDER Johannes

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=c90633ae-7fec-0b9b-2964-e0c11489be0b@pengutronix.de \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
OSZAR »