Skip to content

Commit a5234f3

Browse files
ananglcarlescufi
authored andcommitted
soc_nrf_common: Extend and rename the NRF_DT_ENSURE_PINS_ASSIGNED macro
Extend the macro with checks for DT properties related to pin assignments that are defined but would be ignored, depending on whether PINCTRL is enabled or not, what presumably indicates a resulting configuration different from what the user expects. Add also a possibility to indicate that the pinctrl-1 property should not be checked because the caller does not support the sleep state. Rename the macro so that its name better reflects its function. Update accordingly all drivers that use it. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 1e4027a commit a5234f3

File tree

14 files changed

+55
-24
lines changed

14 files changed

+55
-24
lines changed

drivers/audio/dmic_nrfx_pdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static const struct _dmic_ops dmic_ops = {
541541
#define PDM_CLK_SRC(idx) DT_STRING_TOKEN(PDM(idx), clock_source)
542542

543543
#define PDM_NRFX_DEVICE(idx) \
544-
NRF_DT_ENSURE_PINS_ASSIGNED(PDM(idx), clk_pin); \
544+
NRF_DT_CHECK_PIN_ASSIGNMENTS(PDM(idx), 0, clk_pin, din_pin); \
545545
static void *rx_msgs##idx[DT_PROP(PDM(idx), queue_size)]; \
546546
static struct dmic_nrfx_pdm_drv_data dmic_nrfx_pdm_data##idx; \
547547
static int pdm_nrfx_init##idx(const struct device *dev) \

drivers/flash/nrf_qspi_nor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ static struct qspi_nor_data qspi_nor_dev_data = {
13071307
#endif /* CONFIG_MULTITHREADING */
13081308
};
13091309

1310-
NRF_DT_ENSURE_PINS_ASSIGNED(QSPI_NODE, sck_pin);
1310+
NRF_DT_CHECK_PIN_ASSIGNMENTS(QSPI_NODE, 1, sck_pin, csn_pins, io_pins);
13111311

13121312
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(QSPI_NODE)));
13131313

drivers/i2c/i2c_nrfx_twi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int twi_nrfx_pm_action(const struct device *dev,
284284
.sda = DT_PROP(I2C(idx), sda_pin),))
285285

286286
#define I2C_NRFX_TWI_DEVICE(idx) \
287-
NRF_DT_ENSURE_PINS_ASSIGNED(I2C(idx), scl_pin); \
287+
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2C(idx), 1, scl_pin, sda_pin); \
288288
BUILD_ASSERT(I2C_FREQUENCY(idx) != \
289289
I2C_NRFX_TWI_INVALID_FREQUENCY, \
290290
"Wrong I2C " #idx " frequency setting in dts"); \

drivers/i2c/i2c_nrfx_twim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static int twim_nrfx_pm_action(const struct device *dev,
393393
.sda = DT_PROP(I2C(idx), sda_pin),))
394394

395395
#define I2C_NRFX_TWIM_DEVICE(idx) \
396-
NRF_DT_ENSURE_PINS_ASSIGNED(I2C(idx), scl_pin); \
396+
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2C(idx), 1, scl_pin, sda_pin); \
397397
BUILD_ASSERT(I2C_FREQUENCY(idx) != \
398398
I2C_NRFX_TWIM_INVALID_FREQUENCY, \
399399
"Wrong I2C " #idx " frequency setting in dts"); \

drivers/i2s/i2s_nrfx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,8 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
883883
#define I2S_CLK_SRC(idx) DT_STRING_TOKEN(I2S(idx), clock_source)
884884

885885
#define I2S_NRFX_DEVICE(idx) \
886-
NRF_DT_ENSURE_PINS_ASSIGNED(I2S(idx), sck_pin); \
886+
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2S(idx), 0, sck_pin, lrck_pin, \
887+
mck_pin, sdout_pin, sdin_pin); \
887888
static void *tx_msgs##idx[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
888889
static void *rx_msgs##idx[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
889890
static struct i2s_nrfx_drv_data i2s_nrfx_data##idx = { \

drivers/pwm/pwm_nrfx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ static int pwm_nrfx_pm_action(const struct device *dev,
384384
(NRFX_PWM_PIN_NOT_USED))
385385

386386
#define PWM_NRFX_DEVICE(idx) \
387-
NRF_DT_ENSURE_PINS_ASSIGNED(PWM(idx), \
388-
ch0_pin, ch1_pin, ch2_pin, ch3_pin); \
387+
NRF_DT_CHECK_PIN_ASSIGNMENTS(PWM(idx), 1, \
388+
ch0_pin, ch1_pin, ch2_pin, ch3_pin); \
389389
static struct pwm_nrfx_data pwm_nrfx_##idx##_data = { \
390390
COND_CODE_1(CONFIG_PINCTRL, (), \
391391
(.inverted_channels = \

drivers/sensor/qdec_nrfx/qdec_nrfx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void qdec_nrfx_gpio_ctrl(bool enable)
173173
#endif
174174
}
175175

176-
NRF_DT_ENSURE_PINS_ASSIGNED(DT_DRV_INST(0), a_pin);
176+
NRF_DT_CHECK_PIN_ASSIGNMENTS(DT_DRV_INST(0), 1, a_pin, b_pin, led_pin);
177177

178178
static int qdec_nrfx_init(const struct device *dev)
179179
{

drivers/serial/uart_nrfx_uart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,8 @@ static int uart_nrfx_pm_action(const struct device *dev,
11931193
PINCTRL_DT_INST_DEFINE(0);
11941194
#endif /* CONFIG_PINCTRL */
11951195

1196-
NRF_DT_ENSURE_PINS_ASSIGNED(DT_DRV_INST(0), tx_pin, rx_pin);
1196+
NRF_DT_CHECK_PIN_ASSIGNMENTS(DT_DRV_INST(0), 1,
1197+
tx_pin, rx_pin, rts_pin, cts_pin);
11971198

11981199
static const struct uart_nrfx_config uart_nrfx_uart0_config = {
11991200
#ifdef CONFIG_PINCTRL

drivers/serial/uart_nrfx_uarte.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,8 @@ static int uarte_nrfx_pm_action(const struct device *dev,
20492049
#endif /* CONFIG_PINCTRL */
20502050

20512051
#define UART_NRF_UARTE_DEVICE(idx) \
2052-
NRF_DT_ENSURE_PINS_ASSIGNED(UARTE(idx), tx_pin, rx_pin); \
2052+
NRF_DT_CHECK_PIN_ASSIGNMENTS(UARTE(idx), 1, \
2053+
tx_pin, rx_pin, rts_pin, cts_pin); \
20532054
UARTE_INT_DRIVEN(idx); \
20542055
UARTE_ASYNC(idx); \
20552056
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(UARTE(idx));)) \

drivers/spi/spi_nrfx_spi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ static int spi_nrfx_pm_action(const struct device *dev,
348348
.miso_pull = SPI_NRFX_MISO_PULL(idx),))
349349

350350
#define SPI_NRFX_SPI_DEVICE(idx) \
351-
NRF_DT_ENSURE_PINS_ASSIGNED(SPI(idx), sck_pin); \
351+
NRF_DT_CHECK_PIN_ASSIGNMENTS(SPI(idx), 1, \
352+
sck_pin, mosi_pin, miso_pin); \
352353
BUILD_ASSERT(IS_ENABLED(CONFIG_PINCTRL) || \
353354
!(SPI_PROP(idx, miso_pull_up) && \
354355
SPI_PROP(idx, miso_pull_down)), \

0 commit comments

Comments
 (0)