@@ -19,6 +19,10 @@ LOG_MODULE_REGISTER(spi_nrfx_spis, CONFIG_SPI_LOG_LEVEL);
1919
2020#include "spi_context.h"
2121
22+ #ifdef CONFIG_SOC_NRF54H20_GPD
23+ #include <nrf/gpd.h>
24+ #endif
25+
2226struct spi_nrfx_data {
2327 struct spi_context ctx ;
2428 const struct device * dev ;
@@ -31,6 +35,9 @@ struct spi_nrfx_config {
3135 nrfx_spis_config_t config ;
3236 void (* irq_connect )(void );
3337 uint16_t max_buf_len ;
38+ #ifdef CONFIG_SOC_NRF54H20_GPD
39+ bool gpd_ctrl ;
40+ #endif
3441 const struct pinctrl_dev_config * pcfg ;
3542 struct gpio_dt_spec wake_gpio ;
3643};
@@ -299,6 +306,12 @@ static void spi_nrfx_suspend(const struct device *dev)
299306 nrf_spis_disable (dev_config -> spis .p_reg );
300307 }
301308
309+ #ifdef CONFIG_SOC_NRF54H20_GPD
310+ if (dev_config -> gpd_ctrl ) {
311+ nrf_gpd_retain_pins_set (dev_config -> pcfg , true);
312+ }
313+ #endif
314+
302315 (void )pinctrl_apply_state (dev_config -> pcfg , PINCTRL_STATE_SLEEP );
303316}
304317
@@ -308,6 +321,12 @@ static void spi_nrfx_resume(const struct device *dev)
308321
309322 (void )pinctrl_apply_state (dev_config -> pcfg , PINCTRL_STATE_DEFAULT );
310323
324+ #ifdef CONFIG_SOC_NRF54H20_GPD
325+ if (dev_config -> gpd_ctrl ) {
326+ nrf_gpd_retain_pins_set (dev_config -> pcfg , false);
327+ }
328+ #endif
329+
311330 if (dev_config -> wake_gpio .port == NULL ) {
312331 nrf_spis_enable (dev_config -> spis .p_reg );
313332 }
@@ -338,11 +357,6 @@ static int spi_nrfx_init(const struct device *dev)
338357 nrfx_err_t result ;
339358 int err ;
340359
341- err = pinctrl_apply_state (dev_config -> pcfg , PINCTRL_STATE_DEFAULT );
342- if (err < 0 ) {
343- return err ;
344- }
345-
346360 /* This sets only default values of mode and bit order. The ones to be
347361 * actually used are set in configure() when a transfer is prepared.
348362 */
@@ -435,6 +449,9 @@ static int spi_nrfx_init(const struct device *dev)
435449 .irq_connect = irq_connect##idx, \
436450 .pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPIS(idx)), \
437451 .max_buf_len = BIT_MASK(SPIS_PROP(idx, easydma_maxcnt_bits)), \
452+ IF_ENABLED(CONFIG_SOC_NRF54H20_GPD, \
453+ (.gpd_ctrl = NRF_PERIPH_GET_FREQUENCY(SPIS(idx)) > \
454+ NRFX_MHZ_TO_HZ(16UL),)) \
438455 .wake_gpio = GPIO_DT_SPEC_GET_OR(SPIS(idx), wake_gpios, {0}), \
439456 }; \
440457 BUILD_ASSERT(!DT_NODE_HAS_PROP(SPIS(idx), wake_gpios) || \
0 commit comments