drivers: serial: nrfx: Ensure that instances have some pins assigned

Add build assertions that will ensure that every peripheral for
which a driver instance is created has some pins assigned to it.
Neither pinctrl-0 nor *-pin properties can be currently marked as
required in devicetree, so these assertions will help users avoid
invalid configurations where it could be hard to figure out why
the UART is not working.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2022-02-23 13:56:38 +01:00 committed by Carles Cufí
commit 70fb3124db
4 changed files with 47 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <nrfx_timer.h>
#include <sys/util.h>
#include <kernel.h>
#include <soc.h>
#include <logging/log.h>
#include <helpers/nrfx_gppi.h>
LOG_MODULE_REGISTER(uart_nrfx_uarte, LOG_LEVEL_ERR);
@ -2047,6 +2048,7 @@ static int uarte_nrfx_pm_action(const struct device *dev,
#endif /* CONFIG_PINCTRL */
#define UART_NRF_UARTE_DEVICE(idx) \
NRF_DT_ENSURE_PINS_ASSIGNED(UARTE(idx), tx_pin, rx_pin); \
UARTE_INT_DRIVEN(idx); \
UARTE_ASYNC(idx); \
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(UARTE(idx));)) \