Skip to content

Commit 901a8f7

Browse files
joerchannashif
authored andcommitted
drivers: pinctrl_nrf: : Allow applying pins of disabled peripherals
According to the nrfx peripheral resource sharing example in samples/boards/nrf/nrfx_prs it should be possible to share a resource and apply the pins on peripheral that share resource ID. However the sample only works since it only demonstrates UART and SPIM, and by enabling both another SPIM driver, and UART is enabled for the console. It would not be possible to enable a TWIM driver in addition. Instead allow the PSELs if the configuration for NRFX has been enabled. Signed-off-by: Joakim Andersson <joerchan@gmail.com>
1 parent 99366dd commit 901a8f7

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

drivers/pinctrl/pinctrl_nrf.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,57 +37,57 @@ static const nrf_gpio_pin_drive_t drive_modes[NRF_DRIVE_COUNT] = {
3737

3838
#define PSEL_DISCONNECTED 0xFFFFFFFFUL
3939

40-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uart)
40+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uart) || defined(CONFIG_NRFX_UART)
4141
#define NRF_PSEL_UART(reg, line) ((NRF_UART_Type *)reg)->PSEL##line
42-
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uarte)
42+
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_uarte) || defined(CONFIG_NRFX_UARTE)
4343
#include <hal/nrf_uarte.h>
4444
#define NRF_PSEL_UART(reg, line) ((NRF_UARTE_Type *)reg)->PSEL.line
4545
#endif
4646

47-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spi)
47+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spi) || defined(CONFIG_NRFX_SPI)
4848
#define NRF_PSEL_SPIM(reg, line) ((NRF_SPI_Type *)reg)->PSEL##line
49-
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spim)
49+
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spim) || defined(CONFIG_NRFX_SPIM)
5050
#include <hal/nrf_spim.h>
5151
#define NRF_PSEL_SPIM(reg, line) ((NRF_SPIM_Type *)reg)->PSEL.line
5252
#endif
5353

54-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis)
54+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis) || defined(CONFIG_NRFX_SPIS)
5555
#include <hal/nrf_spis.h>
5656
#if defined(NRF51)
5757
#define NRF_PSEL_SPIS(reg, line) ((NRF_SPIS_Type *)reg)->PSEL##line
5858
#else
5959
#define NRF_PSEL_SPIS(reg, line) ((NRF_SPIS_Type *)reg)->PSEL.line
6060
#endif
61-
#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis) */
61+
#endif
6262

63-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twi)
63+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twi) || defined(CONFIG_NRFX_TWI)
6464
#if !defined(TWI_PSEL_SCL_CONNECT_Pos)
6565
#define NRF_PSEL_TWIM(reg, line) ((NRF_TWI_Type *)reg)->PSEL##line
6666
#else
6767
#define NRF_PSEL_TWIM(reg, line) ((NRF_TWI_Type *)reg)->PSEL.line
6868
#endif
69-
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twim)
69+
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twim) || defined(CONFIG_NRFX_TWIM)
7070
#include <hal/nrf_twim.h>
7171
#define NRF_PSEL_TWIM(reg, line) ((NRF_TWIM_Type *)reg)->PSEL.line
7272
#endif
7373

74-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_i2s)
74+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_i2s) || defined(CONFIG_NRFX_I2S)
7575
#define NRF_PSEL_I2S(reg, line) ((NRF_I2S_Type *)reg)->PSEL.line
7676
#endif
7777

78-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pdm)
78+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pdm) || defined(CONFIG_NRFX_PDM)
7979
#define NRF_PSEL_PDM(reg, line) ((NRF_PDM_Type *)reg)->PSEL.line
8080
#endif
8181

82-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwm)
82+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_pwm) || defined(CONFIG_NRFX_PWM)
8383
#define NRF_PSEL_PWM(reg, line) ((NRF_PWM_Type *)reg)->PSEL.line
8484
#endif
8585

86-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qdec)
86+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qdec) || defined(CONFIG_NRFX_QDEC)
8787
#define NRF_PSEL_QDEC(reg, line) ((NRF_QDEC_Type *)reg)->PSEL.line
8888
#endif
8989

90-
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qspi)
90+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_qspi) || defined(CONFIG_NRFX_QSPI)
9191
#define NRF_PSEL_QSPI(reg, line) ((NRF_QSPI_Type *)reg)->PSEL.line
9292
#endif
9393

0 commit comments

Comments
 (0)