Skip to content

Commit

Permalink
kernel: dt_driver: Add driver probing also for external device tree use
Browse files Browse the repository at this point in the history
When external device tree is configured for use OP-TEE's drivers should be
loaded based on its definitions. Add support to probe drivers also with
external device tree.

This allows same system device tree to be used to define devices for
bootloader, OP-TEE and OS.

In any case if embedded device tree is defined this will take precedense.

Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
  • Loading branch information
vesajaaskelainen committed Oct 23, 2022
1 parent 0d4767a commit fc3f70a
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions core/kernel/dt_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,12 +677,10 @@ static TEE_Result probe_dt_drivers_early(void)
TEE_Result res = TEE_ERROR_GENERIC;
const void *fdt = NULL;

if (!IS_ENABLED(CFG_EMBED_DTB))
fdt = get_dt();
if (!fdt)
return TEE_SUCCESS;

fdt = get_embedded_dt();
assert(fdt);

parse_node(fdt, fdt_path_offset(fdt, "/"));

res = process_probe_list(fdt);
Expand All @@ -700,12 +698,10 @@ static TEE_Result probe_dt_drivers(void)
TEE_Result res = TEE_ERROR_GENERIC;
const void *fdt = NULL;

if (!IS_ENABLED(CFG_EMBED_DTB))
fdt = get_dt();
if (!fdt)
return TEE_SUCCESS;

fdt = get_embedded_dt();
assert(fdt);

res = process_probe_list(fdt);
if (res || !TAILQ_EMPTY(&dt_driver_failed_list)) {
EMSG("Probe sequence result: %#"PRIx32, res);
Expand All @@ -726,13 +722,12 @@ static TEE_Result release_probe_lists(void)
struct dt_driver_probe *next = NULL;
struct dt_driver_provider *prov = NULL;
struct dt_driver_provider *next_prov = NULL;
const void * __maybe_unused fdt = NULL;
const void *fdt = NULL;

if (!IS_ENABLED(CFG_EMBED_DTB))
fdt = get_dt();
if (!fdt)
return TEE_SUCCESS;

fdt = get_embedded_dt();

assert(fdt && TAILQ_EMPTY(&dt_driver_probe_list));

TAILQ_FOREACH_SAFE(elt, &dt_driver_ready_list, link, next)
Expand Down

0 comments on commit fc3f70a

Please sign in to comment.