Skip to content

Commit a068709

Browse files
masz-nordicfabiobaltieri
authored andcommitted
drivers: spi: nrfx_spim: use clock phandle for HSFLL nodes
Instead of explicitly defining the SPIM instances that need it. Signed-off-by: Marcin Szymczyk <[email protected]>
1 parent cc83728 commit a068709

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/spi/spi_nrfx_spim.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,18 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL);
4343
#define SPI_BUFFER_IN_RAM 1
4444
#endif
4545

46-
#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL) && \
47-
(defined(CONFIG_HAS_HW_NRF_SPIM120) || \
48-
defined(CONFIG_HAS_HW_NRF_SPIM121))
49-
#define SPIM_REQUESTS_CLOCK(idx) UTIL_OR(IS_EQ(idx, 120), \
50-
IS_EQ(idx, 121))
46+
#if defined(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL)
47+
#define SPIM_REQUESTS_CLOCK(node) \
48+
DT_NODE_HAS_COMPAT(DT_NODELABEL(DT_CLOCKS_CTLR(node)), nordic_nrf_hsfll_global)
49+
#define SPIM_REQUESTS_CLOCK_OR(node) SPIM_REQUESTS_CLOCK(node) ||
50+
#if (DT_FOREACH_STATUS_OKAY(nordic_nrf_spim, SPIM_REQUESTS_CLOCK_OR) 0)
5151
#define USE_CLOCK_REQUESTS 1
5252
/* If fast instances are used then system managed device PM cannot be used because
5353
* it may call PM actions from locked context and fast SPIM PM actions can only be
5454
* called from a thread context.
5555
*/
5656
BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE_SYSTEM_MANAGED));
57+
#endif
5758
#else
5859
#define SPIM_REQUESTS_CLOCK(idx) 0
5960
#endif

0 commit comments

Comments
 (0)