Skip to content

Commit a5c9848

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 7f8e5ee commit a5c9848

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

drivers/pinctrl/pinctrl_nrf.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ 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
@@ -352,6 +356,47 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
352356
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
353357
break;
354358
#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) */
355400
#if defined(NRF_GRTC_CLKOUT_FAST)
356401
case NRF_FUN_GRTC_CLKOUT_FAST:
357402
#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)