Skip to content

Commit 07a1741

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 ab89cdb commit 07a1741

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
int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
98102
uintptr_t reg)
99103
{
@@ -336,6 +340,47 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
336340
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
337341
break;
338342
#endif /* defined(NRF_PSEL_QSPI) */
343+
#if defined(NRF_PSEL_TDM)
344+
case NRF_FUN_TDM_SCK_M:
345+
NRF_PSEL_TDM(reg, SCK) = psel;
346+
write = 0U;
347+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
348+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
349+
break;
350+
case NRF_FUN_TDM_SCK_S:
351+
NRF_PSEL_TDM(reg, SCK) = psel;
352+
dir = NRF_GPIO_PIN_DIR_INPUT;
353+
input = NRF_GPIO_PIN_INPUT_CONNECT;
354+
break;
355+
case NRF_FUN_TDM_FSYNC_M:
356+
NRF_PSEL_TDM(reg, FSYNC) = psel;
357+
write = 0U;
358+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
359+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
360+
break;
361+
case NRF_FUN_TDM_FSYNC_S:
362+
NRF_PSEL_TDM(reg, FSYNC) = psel;
363+
dir = NRF_GPIO_PIN_DIR_INPUT;
364+
input = NRF_GPIO_PIN_INPUT_CONNECT;
365+
break;
366+
case NRF_FUN_TDM_SDIN:
367+
NRF_PSEL_TDM(reg, SDIN) = psel;
368+
dir = NRF_GPIO_PIN_DIR_INPUT;
369+
input = NRF_GPIO_PIN_INPUT_CONNECT;
370+
break;
371+
case NRF_FUN_TDM_SDOUT:
372+
NRF_PSEL_TDM(reg, SDOUT) = 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_MCK:
378+
NRF_PSEL_TDM(reg, MCK) = psel;
379+
write = 0U;
380+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
381+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
382+
break;
383+
#endif /* defined(NRF_PSEL_TDM) */
339384
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_can)
340385
/* Pin routing is controlled by secure domain, via UICR */
341386
case NRF_FUN_CAN_TX:

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,20 @@
162162
#define NRF_FUN_CAN_TX 46U
163163
/** CAN RX */
164164
#define NRF_FUN_CAN_RX 47U
165+
/** TDM SCK in master mode */
166+
#define NRF_FUN_TDM_SCK_M 48U
167+
/** TDM SCK in slave mode */
168+
#define NRF_FUN_TDM_SCK_S 49U
169+
/** TDM LRCK in master mode */
170+
#define NRF_FUN_TDM_FSYNC_M 50U
171+
/** TDM LRCK in slave mode */
172+
#define NRF_FUN_TDM_FSYNC_S 51U
173+
/** TDM SDIN */
174+
#define NRF_FUN_TDM_SDIN 52U
175+
/** TDM SDOUT */
176+
#define NRF_FUN_TDM_SDOUT 53U
177+
/** TDM MCK */
178+
#define NRF_FUN_TDM_MCK 54U
165179

166180
/** @} */
167181

0 commit comments

Comments
 (0)