-
Notifications
You must be signed in to change notification settings - Fork 7.7k
soc: nordic: nrf53: assign pin xl1,xl2 to app core if lfxo disabled #92664
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
Open
ivynya
wants to merge
1
commit into
zephyrproject-rtos:main
Choose a base branch
from
ivynya:nrf53-lfxo-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+10
−78
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -54,22 +54,17 @@ | |
#define HFXO_NODE DT_NODELABEL(hfxo) | ||
|
||
/* LFXO config from DT */ | ||
#if DT_NODE_HAS_STATUS_OKAY(LFXO_NODE) | ||
BUILD_ASSERT(DT_NODE_HAS_PROP(LFXO_NODE, load_capacitors)); | ||
#define LFXO_PIN_SEL NRF_GPIO_PIN_SEL_PERIPHERAL | ||
#if DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, external) | ||
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_EXTERNAL | ||
#elif DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, internal) | ||
#define LFXO_CAP (DT_ENUM_IDX(LFXO_NODE, load_capacitance_picofarad) + 1U) | ||
#endif /*DT_ENUM_HAS_VALUE(LFXO_NODE, load_capacitors, external) */ | ||
#else | ||
/* LFXO config from legacy Kconfig */ | ||
#if defined(CONFIG_SOC_LFXO_CAP_INT_6PF) | ||
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_6PF | ||
#elif defined(CONFIG_SOC_LFXO_CAP_INT_7PF) | ||
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_7PF | ||
#elif defined(CONFIG_SOC_LFXO_CAP_INT_9PF) | ||
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_9PF | ||
#else | ||
#define LFXO_CAP NRF_OSCILLATORS_LFXO_CAP_EXTERNAL | ||
#endif | ||
#endif | ||
#define LFXO_PIN_SEL NRF_GPIO_PIN_SEL_APP | ||
#endif /* DT_NODE_HAS_STATUS_OKAY(LFXO_NODE) */ | ||
|
||
/* HFXO config from DT */ | ||
#if DT_ENUM_HAS_VALUE(HFXO_NODE, load_capacitors, internal) | ||
|
@@ -496,17 +491,17 @@ void soc_early_init_hook(void) | |
#endif | ||
|
||
#ifdef CONFIG_SOC_NRF5340_CPUAPP | ||
#if defined(LFXO_CAP) | ||
#if DT_NODE_HAS_STATUS_OKAY(LFXO_NODE) | ||
nrf_oscillators_lfxo_cap_set(NRF_OSCILLATORS, LFXO_CAP); | ||
#if !defined(CONFIG_BUILD_WITH_TFM) | ||
/* This can only be done from secure code. | ||
* This is handled by the TF-M platform so we skip it when TF-M is | ||
* enabled. | ||
*/ | ||
nrf_gpio_pin_control_select(PIN_XL1, NRF_GPIO_PIN_SEL_PERIPHERAL); | ||
nrf_gpio_pin_control_select(PIN_XL2, NRF_GPIO_PIN_SEL_PERIPHERAL); | ||
nrf_gpio_pin_control_select(PIN_XL1, LFXO_PIN_SEL); | ||
nrf_gpio_pin_control_select(PIN_XL2, LFXO_PIN_SEL); | ||
#endif /* !defined(CONFIG_BUILD_WITH_TFM) */ | ||
#endif /* defined(LFXO_CAP) */ | ||
#endif /* DT_NODE_HAS_STATUS_OKAY(LFXO_NODE) */ | ||
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. How about defining something like
Wouldn't that be clearer? |
||
#if defined(HFXO_CAP_VAL_X2) | ||
/* This register is only accessible from secure code. */ | ||
uint32_t xosc32mtrim = soc_secure_read_xosc32mtrim(); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's probably better to mark this property as required in the devicetree binding. But anyway, as long as the legacy Kconfig options are available, we cannot require this property to be present.
Uh oh!
There was an error while loading. Please reload this page.
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.
Marking it as required is an issue since the lfxo is not neccesarily present, which I believe is noted by the lfxo node having status = "disabled". In this case, if the prop is required, some random value has to be set even though it can not be correct given there is no lfxo on the board :) The same issue is present for the comparator where some properties are required only if the comp is actually enabled :)
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.
I don't think I understand the issue. Properties with
required: true
are required by dtc only for nodes with status "okay", so for disabled nodes you don't need to provide any value for them.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.
ah, I though they where always required, given what "disabled" means according to devicetree spec, seems we have our own rule which matches zephyrs bindings better :)