[U-Boot] [PATCH V5 REPOST 2/7] ARM: rpi_b: use bcm2835 mbox driver to get memory size

Albert ARIBAUD albert.u.boot at aribaud.net
Wed Mar 20 16:31:02 CET 2013


Hi Stephen,

On Tue, 15 Jan 2013 19:26:54 -0700, Stephen Warren
<swarren at 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 at 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.


More information about the U-Boot mailing list