Skip to content

Commit

Permalink
drivers: caam: hal: add caam_hal_sm_get_base_dt() implementation
Browse files Browse the repository at this point in the history
Implement caam_hal_sm_get_base_dt() function when CFG_DT=y

Signed-off-by: Clement Faure <[email protected]>
Signed-off-by: Sahil Malhotra <[email protected]>
  • Loading branch information
clementfaure authored and sahilnxp committed Oct 24, 2024
1 parent 8f64525 commit 467a15b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
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

0 comments on commit 467a15b

Please sign in to comment.