-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: caam: hal: add caam_hal_sm_get_base_dt() implementation
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
1 parent
8f64525
commit 14bca26
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 Abstration 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters