Skip to content

Commit e262b47

Browse files
[nrf fromlist] drivers: pinctrl: nrf: Add support for TDM peripheral
Add support for configuring pins of the nRF TDM peripheral. Upstream PR #: 82144 Signed-off-by: Adam Kondraciuk <[email protected]>
1 parent 703bf48 commit e262b47

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

drivers/pinctrl/pinctrl_nrf.c

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,17 @@ 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_tdm)
98+
#define NRF_PSEL_TDM(reg, line) ((NRF_TDM_Type *)reg)->PSEL.line
99+
#endif
100+
97101
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_grtc) || defined(CONFIG_NRFX_GRTC)
98102
#if DT_NODE_HAS_PROP(DT_NODELABEL(grtc), clkout_fast_frequency)
99103
#define NRF_GRTC_CLKOUT_FAST 1
100104
#endif
101105
#if DT_NODE_HAS_PROP(DT_NODELABEL(grtc), clkout_32k_frequency)
102106
#define NRF_GRTC_CLKOUT_SLOW 1
103107
#endif
104-
#endif
105108

106109
#if defined(CONFIG_SOC_NRF54L15_CPUAPP)
107110
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrfe_mspi_controller) || defined(CONFIG_MSPI_NRFE)
@@ -352,6 +355,47 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
352355
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
353356
break;
354357
#endif /* defined(NRF_PSEL_QSPI) */
358+
#if defined(NRF_PSEL_TDM)
359+
case NRF_FUN_TDM_SCK_M:
360+
NRF_PSEL_TDM(reg, SCK) = psel;
361+
write = 0U;
362+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
363+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
364+
break;
365+
case NRF_FUN_TDM_SCK_S:
366+
NRF_PSEL_TDM(reg, SCK) = psel;
367+
dir = NRF_GPIO_PIN_DIR_INPUT;
368+
input = NRF_GPIO_PIN_INPUT_CONNECT;
369+
break;
370+
case NRF_FUN_TDM_FSYNC_M:
371+
NRF_PSEL_TDM(reg, FSYNC) = psel;
372+
write = 0U;
373+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
374+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
375+
break;
376+
case NRF_FUN_TDM_FSYNC_S:
377+
NRF_PSEL_TDM(reg, FSYNC) = psel;
378+
dir = NRF_GPIO_PIN_DIR_INPUT;
379+
input = NRF_GPIO_PIN_INPUT_CONNECT;
380+
break;
381+
case NRF_FUN_TDM_SDIN:
382+
NRF_PSEL_TDM(reg, SDIN) = psel;
383+
dir = NRF_GPIO_PIN_DIR_INPUT;
384+
input = NRF_GPIO_PIN_INPUT_CONNECT;
385+
break;
386+
case NRF_FUN_TDM_SDOUT:
387+
NRF_PSEL_TDM(reg, SDOUT) = psel;
388+
write = 0U;
389+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
390+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
391+
break;
392+
case NRF_FUN_TDM_MCK:
393+
NRF_PSEL_TDM(reg, MCK) = psel;
394+
write = 0U;
395+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
396+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
397+
break;
398+
#endif /* defined(NRF_PSEL_TDM) */
355399
#if defined(NRF_GRTC_CLKOUT_FAST)
356400
case NRF_FUN_GRTC_CLKOUT_FAST:
357401
#if NRF_GPIO_HAS_SEL && defined(GPIO_PIN_CNF_CTRLSEL_GRTC)

include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,20 @@
196196
#define NRF_FUN_SDP_MSPI_CS3 69U
197197
/** SDP_MSPI CS4 */
198198
#define NRF_FUN_SDP_MSPI_CS4 70U
199+
/** TDM SCK in master mode */
200+
#define NRF_FUN_TDM_SCK_M 71U
201+
/** TDM SCK in slave mode */
202+
#define NRF_FUN_TDM_SCK_S 72U
203+
/** TDM LRCK in master mode */
204+
#define NRF_FUN_TDM_FSYNC_M 73U
205+
/** TDM LRCK in slave mode */
206+
#define NRF_FUN_TDM_FSYNC_S 74U
207+
/** TDM SDIN */
208+
#define NRF_FUN_TDM_SDIN 75U
209+
/** TDM SDOUT */
210+
#define NRF_FUN_TDM_SDOUT 76U
211+
/** TDM MCK */
212+
#define NRF_FUN_TDM_MCK 77U
199213

200214
/** @} */
201215

0 commit comments

Comments
 (0)