-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers: firmware: scmi: add nxp specific processing
An option is added to allow vendor specific processing at scmi_shmem_write_message() and scmi_shmem_read_message(). Additionally code has been added specific to NXP which has some extended validation features. Signed-off-by: Andre Heinemans <andre.heinemans@nxp.com>
- Loading branch information
1 parent
1903a8f
commit 01c58ac
Showing
9 changed files
with
117 additions
and
9 deletions.
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
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
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
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
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,5 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
zephyr_library() | ||
|
||
zephyr_library_sources_ifdef(CONFIG_ARM_SCMI_NXP_VENDOR_EXTENSIONS shmem.c) |
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,8 @@ | ||
# Copyright 2025 NXP | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config ARM_SCMI_NXP_VENDOR_EXTENSIONS | ||
bool "Allow NXP specific SCMI features" | ||
select CRC | ||
help | ||
When enabled, additional SCMI features specific to NXP will be available |
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,50 @@ | ||
/* | ||
* Copyright 2025 NXP | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/drivers/firmware/scmi/shmem.h> | ||
#include <zephyr/sys/crc.h> | ||
#include <zephyr/logging/log.h> | ||
LOG_MODULE_REGISTER(arm_scmi_shmem_nxp); | ||
|
||
#define SMT_CRC_NONE 0U | ||
#define SMT_CRC_XOR 1U /* Unsupported */ | ||
#define SMT_CRC_J1850 2U /* Unsupported */ | ||
#define SMT_CRC_CRC32 3U | ||
|
||
int scmi_shmem_vendor_read_message(const struct scmi_shmem_layout *layout) | ||
{ | ||
uint32_t validation_type = layout->res1[0]; | ||
|
||
if (validation_type == SMT_CRC_CRC32) { | ||
if (layout->res1[1] != crc32_ieee((const uint8_t *)&layout->msg_hdr, layout->len)) { | ||
LOG_ERR("bad message crc"); | ||
return -EBADMSG; | ||
} | ||
} else if (validation_type == SMT_CRC_NONE) { | ||
/* do nothing */ | ||
} else { | ||
LOG_ERR("invalid validation type 0x%x", validation_type); | ||
return -EINVAL; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int scmi_shmem_vendor_write_message(struct scmi_shmem_layout *layout) | ||
{ | ||
uint32_t validation_type = layout->res1[0]; | ||
|
||
if (validation_type == SMT_CRC_CRC32) { | ||
layout->res1[1] = crc32_ieee((const uint8_t *)&layout->msg_hdr, layout->len); | ||
} else if (validation_type == SMT_CRC_NONE) { | ||
/* do nothing */ | ||
} else { | ||
LOG_ERR("invalid validation type 0x%x", validation_type); | ||
return -EINVAL; | ||
} | ||
|
||
return 0; | ||
} |
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
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