Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

Commit

Permalink
WIP: Cache and dump boot registers
Browse files Browse the repository at this point in the history
This is the first step in exposing the FW-supplied DT.

mkknlimg or equivalent also needs to be run for this to get a DT rather
than ATAGS. Hopefully we'll find a way to build that directly into the
U-Boot image to avoid reliance on external tools.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
  • Loading branch information
swarren committed Aug 13, 2016
1 parent f4b0df1 commit 8097d58
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions board/raspberrypi/rpi/rpi.c
Expand Up @@ -255,6 +255,21 @@ static struct mm_region bcm2837_mem_map[] = {
struct mm_region *mem_map = bcm2837_mem_map;
#endif

static uint32_t boot_r0 __attribute__ ((section(".data")));
static uint32_t boot_r1 __attribute__ ((section(".data")));
static uint32_t boot_r2 __attribute__ ((section(".data")));
static uint32_t boot_r3 __attribute__ ((section(".data")));

void save_boot_params_ret(void);
void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
{
boot_r0 = r0;
boot_r1 = r1;
boot_r2 = r2;
boot_r3 = r3;
save_boot_params_ret();
}

int dram_init(void)
{
ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_arm_mem, msg, 1);
Expand All @@ -274,6 +289,13 @@ int dram_init(void)
return 0;
}

ulong board_get_usable_ram_top(ulong total_size)
{
if ((gd->ram_top - boot_r2) > SZ_64M)
return gd->ram_top;
return boot_r2 & 0xffff0000;
}

static void set_fdtfile(void)
{
const char *fdtfile;
Expand Down Expand Up @@ -441,6 +463,7 @@ static void get_board_rev(void)
}

printf("RPI %s (0x%x)\n", model->name, revision);
printf("boot regs: 0x%08x 0x%08x 0x%08x 0x%08x\n", boot_r0, boot_r1, boot_r2, boot_r3);
}

int board_init(void)
Expand Down

0 comments on commit 8097d58

Please sign in to comment.