@@ -94,9 +94,8 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = {
9494#define NRF_PSEL_QSPI (reg , line ) ((NRF_QSPI_Type *)reg)->PSEL.line
9595#endif
9696
97- #if DT_HAS_COMPAT_STATUS_OKAY (nordic_nrf_twis ) || defined(CONFIG_NRFX_TWIS )
98- #include <hal/nrf_twis.h>
99- #define NRF_PSEL_TWIS (reg , line ) ((NRF_TWIS_Type *)reg)->PSEL.line
97+ #if DT_HAS_COMPAT_STATUS_OKAY (nordic_nrf_tdm )
98+ #define NRF_PSEL_TDM (reg , line ) ((NRF_TDM_Type *)reg)->PSEL.line
10099#endif
101100
102101#if DT_HAS_COMPAT_STATUS_OKAY (nordic_nrf_grtc ) || defined(CONFIG_NRFX_GRTC )
@@ -118,10 +117,6 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = {
118117int pinctrl_configure_pins (const pinctrl_soc_pin_t * pins , uint8_t pin_cnt ,
119118 uintptr_t reg )
120119{
121- #ifdef CONFIG_SOC_NRF54H20_GPD
122- bool gpd_requested = false;
123- #endif
124-
125120 for (uint8_t i = 0U ; i < pin_cnt ; i ++ ) {
126121 nrf_gpio_pin_drive_t drive ;
127122 uint8_t drive_idx = NRF_GET_DRIVE (pins [i ]);
@@ -361,6 +356,47 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
361356 input = NRF_GPIO_PIN_INPUT_DISCONNECT ;
362357 break ;
363358#endif /* defined(NRF_PSEL_QSPI) */
359+ #if defined(NRF_PSEL_TDM )
360+ case NRF_FUN_TDM_SCK_M :
361+ NRF_PSEL_TDM (reg , SCK ) = psel ;
362+ write = 0U ;
363+ dir = NRF_GPIO_PIN_DIR_OUTPUT ;
364+ input = NRF_GPIO_PIN_INPUT_DISCONNECT ;
365+ break ;
366+ case NRF_FUN_TDM_SCK_S :
367+ NRF_PSEL_TDM (reg , SCK ) = psel ;
368+ dir = NRF_GPIO_PIN_DIR_INPUT ;
369+ input = NRF_GPIO_PIN_INPUT_CONNECT ;
370+ break ;
371+ case NRF_FUN_TDM_FSYNC_M :
372+ NRF_PSEL_TDM (reg , FSYNC ) = psel ;
373+ write = 0U ;
374+ dir = NRF_GPIO_PIN_DIR_OUTPUT ;
375+ input = NRF_GPIO_PIN_INPUT_DISCONNECT ;
376+ break ;
377+ case NRF_FUN_TDM_FSYNC_S :
378+ NRF_PSEL_TDM (reg , FSYNC ) = psel ;
379+ dir = NRF_GPIO_PIN_DIR_INPUT ;
380+ input = NRF_GPIO_PIN_INPUT_CONNECT ;
381+ break ;
382+ case NRF_FUN_TDM_SDIN :
383+ NRF_PSEL_TDM (reg , SDIN ) = psel ;
384+ dir = NRF_GPIO_PIN_DIR_INPUT ;
385+ input = NRF_GPIO_PIN_INPUT_CONNECT ;
386+ break ;
387+ case NRF_FUN_TDM_SDOUT :
388+ NRF_PSEL_TDM (reg , SDOUT ) = psel ;
389+ write = 0U ;
390+ dir = NRF_GPIO_PIN_DIR_OUTPUT ;
391+ input = NRF_GPIO_PIN_INPUT_DISCONNECT ;
392+ break ;
393+ case NRF_FUN_TDM_MCK :
394+ NRF_PSEL_TDM (reg , MCK ) = psel ;
395+ write = 0U ;
396+ dir = NRF_GPIO_PIN_DIR_OUTPUT ;
397+ input = NRF_GPIO_PIN_INPUT_DISCONNECT ;
398+ break ;
399+ #endif /* defined(NRF_PSEL_TDM) */
364400#if defined(NRF_GRTC_CLKOUT_FAST )
365401 case NRF_FUN_GRTC_CLKOUT_FAST :
366402#if NRF_GPIO_HAS_SEL && defined(GPIO_PIN_CNF_CTRLSEL_GRTC )
@@ -409,24 +445,6 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
409445 input = NRF_GPIO_PIN_INPUT_DISCONNECT ;
410446 break ;
411447#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_exmif) */
412- #if defined(NRF_PSEL_TWIS )
413- case NRF_FUN_TWIS_SCL :
414- NRF_PSEL_TWIS (reg , SCL ) = psel ;
415- if (drive == NRF_GPIO_PIN_S0S1 ) {
416- drive = NRF_GPIO_PIN_S0D1 ;
417- }
418- dir = NRF_GPIO_PIN_DIR_INPUT ;
419- input = NRF_GPIO_PIN_INPUT_CONNECT ;
420- break ;
421- case NRF_FUN_TWIS_SDA :
422- NRF_PSEL_TWIS (reg , SDA ) = psel ;
423- if (drive == NRF_GPIO_PIN_S0S1 ) {
424- drive = NRF_GPIO_PIN_S0D1 ;
425- }
426- dir = NRF_GPIO_PIN_DIR_INPUT ;
427- input = NRF_GPIO_PIN_INPUT_CONNECT ;
428- break ;
429- #endif /* defined(NRF_PSEL_TWIS) */
430448#if defined(CONFIG_SOC_NRF54L15_CPUAPP )
431449#if DT_HAS_COMPAT_STATUS_OKAY (nordic_nrfe_mspi_controller )
432450 case NRF_FUN_SDP_MSPI_CS0 :
@@ -459,17 +477,16 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
459477
460478#ifdef CONFIG_SOC_NRF54H20_GPD
461479 if (NRF_GET_GPD_FAST_ACTIVE1 (pins [i ]) == 1U ) {
462- if (!gpd_requested ) {
463- int ret ;
464-
465- ret = nrf_gpd_request (NRF_GPD_SLOW_ACTIVE );
466- if (ret < 0 ) {
467- return ret ;
468- }
469- gpd_requested = true;
480+ int ret ;
481+ uint32_t d_pin = pin ;
482+ NRF_GPIO_Type * port = nrf_gpio_pin_port_decode (& d_pin );
483+
484+ ret = nrf_gpd_request (NRF_GPD_SLOW_ACTIVE );
485+ if (ret < 0 ) {
486+ return ret ;
470487 }
471488
472- nrf_gpio_pin_retain_disable ( pin );
489+ port -> RETAINCLR = BIT ( d_pin );
473490 }
474491#endif /* CONFIG_SOC_NRF54H20_GPD */
475492
@@ -490,22 +507,20 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
490507#endif
491508#ifdef CONFIG_SOC_NRF54H20_GPD
492509 if (NRF_GET_GPD_FAST_ACTIVE1 (pins [i ]) == 1U ) {
493- nrf_gpio_pin_retain_enable (pin );
494- }
495- #endif /* CONFIG_SOC_NRF54H20_GPD */
496- }
497- }
510+ int ret ;
511+ uint32_t d_pin = pin ;
512+ NRF_GPIO_Type * port = nrf_gpio_pin_port_decode (& d_pin );
498513
499- #ifdef CONFIG_SOC_NRF54H20_GPD
500- if (gpd_requested ) {
501- int ret ;
514+ port -> RETAINSET = BIT (d_pin );
502515
503- ret = nrf_gpd_release (NRF_GPD_SLOW_ACTIVE );
504- if (ret < 0 ) {
505- return ret ;
516+ ret = nrf_gpd_release (NRF_GPD_SLOW_ACTIVE );
517+ if (ret < 0 ) {
518+ return ret ;
519+ }
520+ }
521+ #endif /* CONFIG_SOC_NRF54H20_GPD */
506522 }
507523 }
508- #endif
509524
510525 return 0 ;
511526}
0 commit comments