-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
modules: hal_nordic: nrfx: update API version to 3.2.0 #64476
modules: hal_nordic: nrfx: update API version to 3.2.0 #64476
Conversation
c949017
to
2a755b3
Compare
6f91599
to
8b47ff6
Compare
@anangl CI seems to be green, can we proceed with review and merging? |
ebe5cce
to
0dfdbd2
Compare
0dfdbd2
to
7eca915
Compare
Rebased the PR. Hopefully now the unrelated:
will be fixed |
@@ -18,7 +18,7 @@ | |||
|
|||
/** @brief Symbol specifying minor version of the nrfx API to be used. */ | |||
#ifndef NRFX_CONFIG_API_VER_MINOR | |||
#define NRFX_CONFIG_API_VER_MINOR 0 | |||
#define NRFX_CONFIG_API_VER_MINOR 2 |
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.
To preserve bisectability, it would be good to make all related changes in drivers in the same commit.
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.
That would make that one commit huge, combining multiple areas - is it really better?
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.
Yes, because otherwise the code does not build. Any commit that does not build is significantly slowing down bisect because you have to skip one, or more, commits which significantly increases the required number of checks. The required number of checks, when all commits in history do build correctly, is log2(N) where N is the number of commits in between good and bad revisions.
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.
The commits should really be:
- Update nrfx API version with all drivers adjusted for new API. No actual functional changes (if possible).
- Any subsequent commits are the functional changes related to things that were not possible with earlier nrfx version.
drivers/adc/adc_nrfx_saadc.c
Outdated
@@ -7,6 +7,7 @@ | |||
#define ADC_CONTEXT_USES_KERNEL_TIMER | |||
#include "adc_context.h" | |||
#include <hal/nrf_saadc.h> | |||
#include <nrfx_saadc.h> |
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.
The nrfx_saadc driver is not used here, so it's a bit weird and misleading to include this header just to use one macro that is defined there. Also the commit message is misleading.
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.
NRFX_SAADC_SAMPLES_TO_BYTES
is used.
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.
Yes, and in my opinion this is wrong.
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.
Dropped whole SAADC
drivers/adc/adc_nrfx_saadc.c
Outdated
@@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(adc_nrfx_saadc); | |||
|
|||
#define DT_DRV_COMPAT nordic_nrf_saadc | |||
|
|||
#if !(NRF_SAADC_HAS_AIN_AS_PIN) |
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.
The changes in adc_nrfx_saadc.c
are not related to the API update to 3.2.0. I think it would be better to process them in a separate PR.
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.
Dropped whole SAADC
#if defined(NRF_TRUSTZONE_NONSECURE) | ||
#define NRF_GPIOTE1 NRF_GPIOTE1_NS | ||
#else | ||
#if !defined(NRF_TRUSTZONE_NONSECURE) | ||
#define NRF_CACHE NRF_CACHE_S | ||
#define NRF_CACHEINFO NRF_CACHEINFO_S | ||
#define NRF_CACHEDATA NRF_CACHEDATA_S | ||
#define NRF_CRYPTOCELL NRF_CRYPTOCELL_S | ||
#define NRF_CTI NRF_CTI_S | ||
#define NRF_FICR NRF_FICR_S | ||
#define NRF_GPIOTE0 NRF_GPIOTE0_S |
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.
These changes should be dropped, for nRF91 as well.
#define BUTTON_PORT DT_GPIO_CTLR(DT_ALIAS(sw0), gpios) | ||
#define GPIOTE_PHANDLE DT_PHANDLE(BUTTON_PORT, gpiote_instance) | ||
#define GPIOTE_IDX DT_PROP(GPIOTE_PHANDLE, instance) |
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.
The code below is not related to the sw0
button so these changes in the current form are misleading. I'd propose to use instead:
#define BUTTON_PORT DT_GPIO_CTLR(DT_ALIAS(sw0), gpios) | |
#define GPIOTE_PHANDLE DT_PHANDLE(BUTTON_PORT, gpiote_instance) | |
#define GPIOTE_IDX DT_PROP(GPIOTE_PHANDLE, instance) | |
#define GPIOTE_IDX DT_PROP(DT_NODELABEL(gpiote), instance) |
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.
Changed
CHECK_DT_REG(gpiote, NRF_GPIOTE); | ||
#if defined(NRF_GPIOTE) | ||
CHECK_DT_REG(gpiote0, NRF_GPIOTE); | ||
#else | ||
CHECK_DT_REG(gpiote0, NRF_GPIOTE0); | ||
#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.
Why?
IMO it should be:
CHECK_DT_REG(gpiote, NRF_GPIOTE); | |
#if defined(NRF_GPIOTE) | |
CHECK_DT_REG(gpiote0, NRF_GPIOTE); | |
#else | |
CHECK_DT_REG(gpiote0, NRF_GPIOTE0); | |
#endif | |
CHECK_DT_REG(gpiote, NRF_GPIOTE); | |
CHECK_DT_REG(gpiote0, NRF_GPIOTE0); |
with
#if !defined(NRF_GPIOTE0) && defined(NRF_GPIOTE)
#define NRF_GPIOTE0 NRF_GPIOTE
#endif
added at the top of the file.
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 still causes compilation error on nrf5340_cpuapp
as it has both gpiote
and gpiote0
nodes defined, but only NRF_GPIOTE0
. Adding #define NRF_GPIOTE NRF_GPIOTE0
would fix it but I'm not sure if this is a better solution than what we have now.
samples/boards/nrf/nrfx/src/main.c
Outdated
#define INPUT_PIN DT_GPIO_PIN(DT_ALIAS(sw0), gpios) | ||
#define INPUT_PORT DT_GPIO_CTLR(DT_ALIAS(sw0), gpios) | ||
#define GPIOTE_PHANDLE DT_PHANDLE(INPUT_PORT, gpiote_instance) | ||
#define GPIOTE_IDX DT_PROP(GPIOTE_PHANDLE, instance) |
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 does not make much sense as the sample will anyway work only with GPIOTE0 (only this one is enabled in Kconfig). Since only nrf52840dk_nrf52840
and nrf9160dk_nrf9160
are allowed platforms here, I'd rather go with hardcoded instance 0 in the code.
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.
Reworked Kconfig to take into account any GPIOTE instance.
drivers/pwm/pwm_nrf_sw.c
Outdated
#define GPIO_NODE(pin) DT_GPIO_CTLR_BY_IDX(DT_DRV_INST(0), channel_gpios, pin) | ||
#define GPIOTE_PHANDLE(pin) DT_PHANDLE(GPIO_NODE(pin), gpiote_instance) | ||
#define GPIOTE_IDX(pin) DT_PROP(GPIOTE_PHANDLE(pin), instance) |
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.
#define GPIO_NODE(pin) DT_GPIO_CTLR_BY_IDX(DT_DRV_INST(0), channel_gpios, pin) | |
#define GPIOTE_PHANDLE(pin) DT_PHANDLE(GPIO_NODE(pin), gpiote_instance) | |
#define GPIOTE_IDX(pin) DT_PROP(GPIOTE_PHANDLE(pin), instance) | |
#define GPIO_NODE(channel) DT_GPIO_CTLR_BY_IDX(DT_DRV_INST(0), \ | |
channel_gpios, channel) | |
#define GPIOTE_PHANDLE(channel) DT_PHANDLE(GPIO_NODE(channel), gpiote_instance) | |
#define GPIOTE_IDX(channel) DT_PROP(GPIOTE_PHANDLE(channel), instance) |
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.
Removed unnecessary whitespaces, but breaking line 60 is not needed.
#define GPIOTE_PHANDLE(pin) DT_PHANDLE(GPIO_NODE(pin), gpiote_instance) | ||
#define GPIOTE_IDX(pin) DT_PROP(GPIOTE_PHANDLE(pin), instance) | ||
|
||
static nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(GPIOTE_IDX(col_gpios)); |
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 should not assume a single GPIOTE instance. I think that a similar scheme as in pwm_nrf_sw.c
should be used instead.
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.
Done
drivers/spi/spi_nrfx_spim.c
Outdated
}; | ||
|
||
#ifdef CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58 | ||
static const nrfx_gpiote_t gpiote = NRFX_GPIOTE_INSTANCE(0); |
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 would be better to move this to anomaly_58_workaround_init()
as it is needed only there. In other places NRF_GPIOTE
can be used as it is now.
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.
Done
7eca915
to
e93e113
Compare
2d151ad
to
f7d640d
Compare
f7d640d
to
5a2b291
Compare
boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c
Outdated
Show resolved
Hide resolved
boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c
Outdated
Show resolved
Hide resolved
boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_cpunet_reset.c
Outdated
Show resolved
Hide resolved
e6385cd
to
8f2a74c
Compare
subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c
Outdated
Show resolved
Hide resolved
subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h
Outdated
Show resolved
Hide resolved
Change the GPIOTE driver to HAL to prevent instantiation issues with a multi-instance GPIOTE driver. Signed-off-by: Jakub Zymelka <[email protected]>
8f2a74c
to
93d3fa6
Compare
7a980f9
to
d655294
Compare
Added GPIOTE0, GPIOTE1 instances for legacy devices, GPIOTE20, GPIOTE30 for Moonlight and GPIOTE130, GPIOTE131 instances for Haltium. Signed-off-by: Jakub Zymelka <[email protected]>
After adding new GPIOTE instances, there is a need to enable the instance for individual boards. Signed-off-by: Jakub Zymelka <[email protected]>
Updated API version enables multi-instance GPIOTE driver. Additionally obsolete symbol that was used to specify API version in the past was removed. Affected drivers have been adjusted and appropriate changes in affected files have been made. Signed-off-by: Jakub Zymelka <[email protected]>
d655294
to
aecd53a
Compare
Updated API version enables multi-instance GPIOTE driver.
Additionally obsolete symbol that was used to specify API version in the past was removed.