Skip to content

Commit

Permalink
kboot: Expose ADT in phram MTD reserved memory node
Browse files Browse the repository at this point in the history
Requires CONFIG_MTD_PHRAM in Linux.

Signed-off-by: Janne Grunau <[email protected]>
  • Loading branch information
jannau authored and marcan committed Sep 24, 2024
1 parent d76dd3a commit 1d5556c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/kboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2265,6 +2265,23 @@ int kboot_set_chosen(const char *name, const char *value)
return i;
}

static int dt_setup_mtd_phram(void)
{
char node_name[64];
snprintf(node_name, sizeof(node_name), "flash@%lx", (u64)adt);

int node = dt_get_or_add_reserved_mem(node_name, "phram", false, (u64)adt,
ALIGN_UP(cur_boot_args.devtree_size, SZ_16K));

if (node > 0) {
int ret = fdt_setprop_string(dt, node, "label", "adt");
if (ret)
bail("FDT: failed to setup ADT MTD phram label\n");
}

return 0;
}

int kboot_prepare_dt(void *fdt)
{
if (dt) {
Expand All @@ -2290,6 +2307,8 @@ int kboot_prepare_dt(void *fdt)
if (fdt_add_mem_rsv(dt, (u64)_base, ((u64)_end) - ((u64)_base)))
bail("FDT: couldn't add reservation for m1n1\n");

dt_setup_mtd_phram();

if (dt_set_chosen())
return -1;
if (dt_set_serial_number())
Expand Down

0 comments on commit 1d5556c

Please sign in to comment.