-
Notifications
You must be signed in to change notification settings - Fork 717
ironside tdd service #2938
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
ironside tdd service #2938
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/drivers/firmware/nrf_ironside/tdd.h> | ||
#include <zephyr/drivers/firmware/nrf_ironside/call.h> | ||
|
||
int ironside_se_tdd_configure(const enum ironside_se_tdd_config config) | ||
{ | ||
int err; | ||
struct ironside_call_buf *const buf = ironside_call_alloc(); | ||
|
||
buf->id = IRONSIDE_SE_CALL_ID_TDD_V0; | ||
buf->args[IRONSIDE_SE_TDD_SERVICE_REQ_CONFIG_IDX] = (uint32_t)config; | ||
|
||
ironside_call_dispatch(buf); | ||
|
||
if (buf->status == IRONSIDE_CALL_STATUS_RSP_SUCCESS) { | ||
err = buf->args[IRONSIDE_SE_TDD_SERVICE_RSP_RETCODE_IDX]; | ||
} else { | ||
err = buf->status; | ||
} | ||
|
||
ironside_call_release(buf); | ||
|
||
return err; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2025 Nordic Semiconductor ASA | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_TDD_H_ | ||
#define ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_TDD_H_ | ||
|
||
#include <zephyr/drivers/firmware/nrf_ironside/call.h> | ||
|
||
#include <nrfx.h> | ||
|
||
#define IRONSIDE_SE_TDD_SERVICE_ERROR_INVALID_CONFIG (1) | ||
|
||
#define IRONSIDE_SE_CALL_ID_TDD_V0 4 | ||
57300 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#define IRONSIDE_SE_TDD_SERVICE_REQ_CONFIG_IDX 0 | ||
#define IRONSIDE_SE_TDD_SERVICE_RSP_RETCODE_IDX 0 | ||
|
||
enum ironside_se_tdd_config { | ||
RESERVED0 = 0, /* Reserved */ | ||
/** Turn off the TDD */ | ||
IRONSIDE_SE_TDD_CONFIG_OFF = 1, | ||
/** Turn on the TDD with default configuration */ | ||
IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT = 2, | ||
}; | ||
|
||
/** | ||
* @brief Control the Trace and Debug Domain (TDD). | ||
* | ||
* @param config The configuration to be applied. | ||
* | ||
* @retval 0 on success. | ||
* @retval -IRONSIDE_SE_TDD_ERROR_EINVAL on invalid argument. | ||
*/ | ||
int ironside_se_tdd_configure(const enum ironside_se_tdd_config config); | ||
|
||
#endif /* ZEPHYR_INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_NRF_IRONSIDE_TDD_H_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,9 @@ | |
#include <soc/nrfx_coredep.h> | ||
#include <soc_lrcconf.h> | ||
#include <dmm.h> | ||
#include <uicr/uicr.h> | ||
#include <zephyr/drivers/firmware/nrf_ironside/cpuconf.h> | ||
#include <zephyr/drivers/firmware/nrf_ironside/tdd.h> | ||
|
||
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL); | ||
|
||
|
@@ -168,10 +170,26 @@ void soc_early_init_hook(void) | |
} | ||
} | ||
|
||
#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) | ||
#if defined(CONFIG_SOC_LATE_INIT_HOOK) | ||
|
||
void soc_late_init_hook(void) | ||
{ | ||
int err; | ||
#if defined(CONFIG_SOC_NRF54H20_TDD_ENABLE) | ||
int err_tdd; | ||
|
||
err_tdd = ironside_se_tdd_configure(IRONSIDE_SE_TDD_CONFIG_ON_DEFAULT); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also be invoked by PM state changes, if I'm not misunderstanding? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a final solution it can be, right now this will just force on tdd and leave it at that, hence preventing having to reconfigure all the coresight peripherals after a sleep etc, because JLink couldn't handle this. |
||
__ASSERT(err_tdd == 0, "err_tdd was %d", err_tdd); | ||
|
||
UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 3, GPIO_PIN_CNF_CTRLSEL_TND); | ||
UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 4, GPIO_PIN_CNF_CTRLSEL_TND); | ||
UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 5, GPIO_PIN_CNF_CTRLSEL_TND); | ||
UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 6, GPIO_PIN_CNF_CTRLSEL_TND); | ||
UICR_GPIO_PIN_CNF_CTRLSEL_SET(NRF_P7, 7, GPIO_PIN_CNF_CTRLSEL_TND); | ||
|
||
#endif | ||
|
||
#if defined(CONFIG_SOC_NRF54H20_CPURAD_ENABLE) | ||
int err_cpuconf; | ||
|
||
/* The msg will be used for communication prior to IPC | ||
* communication being set up. But at this moment no such | ||
|
@@ -210,8 +228,10 @@ void soc_late_init_hook(void) | |
/* Don't wait as this is not yet supported. */ | ||
bool cpu_wait = false; | ||
|
||
err = ironside_cpuconf(NRF_PROCESSOR_RADIOCORE, radiocore_address, cpu_wait, msg, msg_size); | ||
__ASSERT(err == 0, "err was %d", err); | ||
err_cpuconf = ironside_cpuconf(NRF_PROCESSOR_RADIOCORE, radiocore_address, cpu_wait, msg, | ||
msg_size); | ||
__ASSERT(err_cpuconf == 0, "err_cpuconf was %d", err_cpuconf); | ||
#endif | ||
} | ||
#endif | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This usage of the CLAIM register is not standardized, but instead a bespoke solution that we made. Should we leave CLAIM configuration out here? It could always be added later if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is in a nordic specific file I feel this is ok, we aren't providing a general jlink script to configure coresight peripherals here