public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V5 REPOST 2/7] ARM: rpi_b: use bcm2835 mbox driver to get memory size
Date: Wed, 20 Mar 2013 16:31:02 +0100	[thread overview]
Message-ID: <20130320163102.491dc920@lilith> (raw)
In-Reply-To: <1358303219-17503-2-git-send-email-swarren@wwwdotorg.org>

Hi Stephen,

On Tue, 15 Jan 2013 19:26:54 -0700, Stephen Warren
<swarren@wwwdotorg.org> wrote:

> The firmware running on the bcm2835 SoC's VideoCore CPU determines how
> much of the system RAM is available for use by the ARM CPU. Previously,
> U-Boot assumed that only 128MB was available, since this was the
> smallest value configured by any public firmware. However, we can now
> query the actual value at run-time from the firmware using the mbox
> property protocol.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> ---
> v5: No change; merged patch series.
> v4: No change; rebased.
> v3: No change.
> v2: Updated to use macros etc. added in v2 of mbox driver patch.
> ---
>  board/raspberrypi/rpi_b/rpi_b.c |   21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/board/raspberrypi/rpi_b/rpi_b.c b/board/raspberrypi/rpi_b/rpi_b.c
> index 688b0aa..3c654a1 100644
> --- a/board/raspberrypi/rpi_b/rpi_b.c
> +++ b/board/raspberrypi/rpi_b/rpi_b.c
> @@ -15,13 +15,32 @@
>   */
>  
>  #include <common.h>
> +#include <asm/arch/mbox.h>
>  #include <asm/global_data.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +struct msg_get_arm_mem {
> +	struct bcm2835_mbox_hdr hdr;
> +	struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
> +	u32 end_tag;
> +};
> +
>  int dram_init(void)
>  {
> -	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
> +	ALLOC_ALIGN_BUFFER(struct msg_get_arm_mem, msg, 1, 16);
> +	int ret;
> +
> +	BCM2835_MBOX_INIT_HDR(msg);
> +	BCM2835_MBOX_INIT_TAG(&msg->get_arm_mem, GET_ARM_MEMORY);
> +
> +	ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
> +	if (ret) {
> +		printf("bcm2835: Could not query ARM memory size\n");
> +		return -1;
> +	}
> +
> +	gd->ram_size = msg->get_arm_mem.body.resp.mem_size;
>  
>  	return 0;
>  }

Applied to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

  reply	other threads:[~2013-03-20 15:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16  2:26 [U-Boot] [PATCH V5 REPOST 1/7] ARM: bcm2835: add mailbox driver Stephen Warren
2013-01-16  2:26 ` [U-Boot] [PATCH V5 REPOST 2/7] ARM: rpi_b: use bcm2835 mbox driver to get memory size Stephen Warren
2013-03-20 15:31   ` Albert ARIBAUD [this message]
2013-01-16  2:26 ` [U-Boot] [PATCH V5 REPOST 3/7] lcd: calculate line_length after lcd_ctrl_init() Stephen Warren
2013-03-20 15:46   ` Albert ARIBAUD
2013-01-16  2:26 ` [U-Boot] [PATCH V5 REPOST 4/7] ARM: rpi_b: disable rpi_b dcache explicitly Stephen Warren
2013-03-20 15:31   ` Albert ARIBAUD
2013-01-16  2:26 ` [U-Boot] [PATCH V5 REPOST 5/7] video: add a driver for the bcm2835 Stephen Warren
2013-03-20 15:31   ` Albert ARIBAUD
2013-01-16  2:26 ` [U-Boot] [PATCH V5 REPOST 6/7] mmc: add bcm2835 driver Stephen Warren
2013-02-03 11:27   ` Albert ARIBAUD
2013-02-15  3:05     ` Stephen Warren
2013-03-10  6:34     ` Stephen Warren
2013-03-11  6:35       ` Albert ARIBAUD
2013-03-15 22:51         ` Stephen Warren
2013-03-16  8:09           ` Albert ARIBAUD
2013-03-20 14:33             ` Albert ARIBAUD
2013-03-20 15:31   ` Albert ARIBAUD
2013-01-16  2:26 ` [U-Boot] [PATCH V5 REPOST 7/7] ARM: rpi_b: enable SD controller, add related env/cmds Stephen Warren
2013-03-20 15:31   ` Albert ARIBAUD
2013-03-20 15:30 ` [U-Boot] [PATCH V5 REPOST 1/7] ARM: bcm2835: add mailbox driver Albert ARIBAUD

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=20130320163102.491dc920@lilith \
    --to=albert.u.boot@aribaud.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox