Skip to content

[nrf fromtree] Asserts in fast peripherals (spim120, pwm120) protecting against wrong PM configuration #2766

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

Merged
merged 3 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions drivers/pwm/pwm_nrfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL);

#if NRFX_FOREACH_PRESENT(PWM, PWM_NRFX_IS_FAST, (||), (0))
#define PWM_NRFX_FAST_PRESENT 1
/* If fast instances are used then system managed device PM cannot be used because
* it may call PM actions from locked context and fast PWM PM actions can only be
* called in a thread context.
*/
BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED));
#endif

#if defined(PWM_NRFX_FAST_PRESENT) && CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL
Expand Down
86 changes: 8 additions & 78 deletions drivers/spi/spi_nrfx_spim.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL);
#define SPIM_REQUESTS_CLOCK(idx) UTIL_OR(IS_EQ(idx, 120), \
IS_EQ(idx, 121))
#define USE_CLOCK_REQUESTS 1
/* If fast instances are used then system managed device PM cannot be used because
* it may call PM actions from locked context and fast SPIM PM actions can only be
* called from a thread context.
*/
BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED));
#else
#define SPIM_REQUESTS_CLOCK(idx) 0
#endif
Expand Down Expand Up @@ -856,82 +861,7 @@ static int spi_nrfx_init(const struct device *dev)
SPIM_MEM_REGION(idx)))))), \
())

#ifdef CONFIG_HAS_HW_NRF_SPIM0
SPI_NRFX_SPIM_DEFINE(0);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM1
SPI_NRFX_SPIM_DEFINE(1);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM2
SPI_NRFX_SPIM_DEFINE(2);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM3
SPI_NRFX_SPIM_DEFINE(3);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM4
SPI_NRFX_SPIM_DEFINE(4);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM00
SPI_NRFX_SPIM_DEFINE(00);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM20
SPI_NRFX_SPIM_DEFINE(20);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM21
SPI_NRFX_SPIM_DEFINE(21);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM22
SPI_NRFX_SPIM_DEFINE(22);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM30
SPI_NRFX_SPIM_DEFINE(30);
#endif
#define COND_NRF_SPIM_DEVICE(unused, prefix, i, _) \
IF_ENABLED(CONFIG_HAS_HW_NRF_SPIM##prefix##i, (SPI_NRFX_SPIM_DEFINE(prefix##i);))

#ifdef CONFIG_HAS_HW_NRF_SPIM120
SPI_NRFX_SPIM_DEFINE(120);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM121
SPI_NRFX_SPIM_DEFINE(121);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM130
SPI_NRFX_SPIM_DEFINE(130);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM131
SPI_NRFX_SPIM_DEFINE(131);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM132
SPI_NRFX_SPIM_DEFINE(132);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM133
SPI_NRFX_SPIM_DEFINE(133);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM134
SPI_NRFX_SPIM_DEFINE(134);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM135
SPI_NRFX_SPIM_DEFINE(135);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM136
SPI_NRFX_SPIM_DEFINE(136);
#endif

#ifdef CONFIG_HAS_HW_NRF_SPIM137
SPI_NRFX_SPIM_DEFINE(137);
#endif
NRFX_FOREACH_PRESENT(SPIM, COND_NRF_SPIM_DEVICE, (), (), _)