Skip to content

Commit d2b73a7

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 b7ac15c commit d2b73a7

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
@@ -108,6 +108,10 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = {
108108
#endif
109109
#endif
110110

111+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_tdm)
112+
#define NRF_PSEL_TDM(reg, line) ((NRF_TDM_Type *)reg)->PSEL.line
113+
#endif
114+
111115
int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
112116
uintptr_t reg)
113117
{
@@ -354,6 +358,47 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
354358
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
355359
break;
356360
#endif /* defined(NRF_PSEL_QSPI) */
361+
#if defined(NRF_PSEL_TDM)
362+
case NRF_FUN_TDM_SCK_M:
363+
NRF_PSEL_TDM(reg, SCK) = psel;
364+
write = 0U;
365+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
366+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
367+
break;
368+
case NRF_FUN_TDM_SCK_S:
369+
NRF_PSEL_TDM(reg, SCK) = psel;
370+
dir = NRF_GPIO_PIN_DIR_INPUT;
371+
input = NRF_GPIO_PIN_INPUT_CONNECT;
372+
break;
373+
case NRF_FUN_TDM_FSYNC_M:
374+
NRF_PSEL_TDM(reg, FSYNC) = psel;
375+
write = 0U;
376+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
377+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
378+
break;
379+
case NRF_FUN_TDM_FSYNC_S:
380+
NRF_PSEL_TDM(reg, FSYNC) = psel;
381+
dir = NRF_GPIO_PIN_DIR_INPUT;
382+
input = NRF_GPIO_PIN_INPUT_CONNECT;
383+
break;
384+
case NRF_FUN_TDM_SDIN:
385+
NRF_PSEL_TDM(reg, SDIN) = psel;
386+
dir = NRF_GPIO_PIN_DIR_INPUT;
387+
input = NRF_GPIO_PIN_INPUT_CONNECT;
388+
break;
389+
case NRF_FUN_TDM_SDOUT:
390+
NRF_PSEL_TDM(reg, SDOUT) = psel;
391+
write = 0U;
392+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
393+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
394+
break;
395+
case NRF_FUN_TDM_MCK:
396+
NRF_PSEL_TDM(reg, MCK) = psel;
397+
write = 0U;
398+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
399+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
400+
break;
401+
#endif /* defined(NRF_PSEL_TDM) */
357402
#if defined(NRF_GRTC_CLKOUT_FAST)
358403
case NRF_FUN_GRTC_CLKOUT_FAST:
359404
#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
@@ -172,6 +172,20 @@
172172
#define NRF_FUN_GRTC_CLKOUT_FAST 55U
173173
/** GRTC slow clock output */
174174
#define NRF_FUN_GRTC_CLKOUT_32K 56U
175+
/** TDM SCK in master mode */
176+
#define NRF_FUN_TDM_SCK_M 71U
177+
/** TDM SCK in slave mode */
178+
#define NRF_FUN_TDM_SCK_S 72U
179+
/** TDM LRCK in master mode */
180+
#define NRF_FUN_TDM_FSYNC_M 73U
181+
/** TDM LRCK in slave mode */
182+
#define NRF_FUN_TDM_FSYNC_S 74U
183+
/** TDM SDIN */
184+
#define NRF_FUN_TDM_SDIN 75U
185+
/** TDM SDOUT */
186+
#define NRF_FUN_TDM_SDOUT 76U
187+
/** TDM MCK */
188+
#define NRF_FUN_TDM_MCK 77U
175189

176190
/** @} */
177191

0 commit comments

Comments
 (0)