Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: caam: hal: add caam_hal_sm_get_base_dt() implementation #7093

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions core/drivers/crypto/caam/hal/common/hal_sm_dt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: BSD-2-Clause
/*
* Copyright 2024 NXP
*
* Brief CAAM Secure Memory Hardware Abstraction Layer.
*/

#include <caam_common.h>
#include <caam_hal_sm.h>
#include <kernel/dt.h>
#include <libfdt.h>

static const char *dt_sm_match_table = {
"fsl,imx6q-caam-sm",
};

void caam_hal_sm_get_base_dt(void *fdt, vaddr_t *sm_base)
{
int node = 0;
int ret = 0;
size_t size = 0;

*sm_base = 0;

node = fdt_node_offset_by_compatible(fdt, 0, dt_sm_match_table);

if (node < 0) {
HAL_TRACE("CAAM Node not found err = 0x%X", node);
return;
}

/* Map the device in the system if not already present */
ret = dt_map_dev(fdt, node, sm_base, &size, DT_MAP_AUTO);
if (ret < 0) {
HAL_TRACE("Cannot map node 0x%X", node);
return;
}
}
2 changes: 1 addition & 1 deletion core/drivers/crypto/caam/hal/common/sub.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ incdirs-y += ../../include
incdirs-y += ../$(CAAM_HAL_DIR)
incdirs-y += .

srcs-$(CFG_DT) += hal_cfg_dt.c
srcs-$(CFG_DT) += hal_cfg_dt.c hal_sm_dt.c
srcs-y += hal_cfg.c
srcs-y += hal_rng.c
srcs-y += hal_jr.c
Expand Down
Loading