Skip to content
Snippets Groups Projects
Commit a6e87590 authored by Gianfranco Mariotti's avatar Gianfranco Mariotti
Browse files

[D18][ENV][BOARD] add kernel mem logo fdt support

* setup kernel mem logo address
* create the necessary device tree nodes for kernel mem logo at runtime:
  the fdt_memlogo function should subsequently be exported to a common
  file to also be used with other boards.
parent c2a284b9
Branches
Tags
No related merge requests found
......@@ -188,6 +188,59 @@ int dram_init_banksize(void)
return 0;
}
static int fdt_memlogo(void *fdt)
{
uint64_t address, size;
char *env;
int node;
int tmp;
env = env_get("memlogo_addr");
if (env)
address = simple_strtoul(env, NULL, 16);
else {
printf("memlogo: could not get address\n");
return -1;
}
env = env_get("memlogo_size");
if (env) {
size = simple_strtoul(env, NULL, 16);
if (size > 0x400000) {
printf("memlogo: logo size too big (max: 4MiB)\n");
return -1;
}
} else {
printf("memlogo: could not get size\n");
return -1;
}
tmp = fdt_add_mem_rsv(fdt, address, size);
if (tmp < 0) {
printf("memlogo: failed to reserve memory: %s\n", fdt_strerror(tmp));
return tmp;
}
node = fdt_find_or_add_subnode(fdt, 0, "seco-memlogo");
if (node < 0) {
printf("memlogo: unable to find/create seco-memlogo node: %s\n", fdt_strerror(node));
return node;
}
tmp = fdt_setprop_string(fdt, node, "compatible", "seco,memlogo");
if (!tmp)
tmp = fdt_setprop_u32(fdt, node, "address", address);
if (!tmp)
tmp = fdt_setprop_u32(fdt, node, "size", size);
if (tmp) {
printf("memlogo: failed to add seco-memlogo properties: %s\n", fdt_strerror(tmp));
return tmp;
}
return 0;
}
#ifdef CONFIG_OF_BOARD_SETUP
int ft_board_setup(void *blob, struct bd_info *bd)
{
......@@ -221,6 +274,8 @@ int ft_board_setup(void *blob, struct bd_info *bd)
strap_fdt_ram_setup(blob, bd);
fdt_memlogo(blob);
return 0;
}
#endif
......
......@@ -245,6 +245,9 @@
#define ENV_BOOT_TYPE booti
#define ENV_CUSTOM \
"memlogo_addr=63c00000\0"
#include "seco_mx8_env.h"
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment