soc: arm: nordic_nrf: replace NRF_DT_CHECK_PIN_ASSIGNMENTS
Since PINCTRL and pinctrl-0 is now required, there's no point in doing extra validation at driver level. Modify the macro to just check that sleep state is present when needed, since it was the only remaining assertion that was not covered. Renamed the macro to make it more clear what it does: NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
1efaa94bc6
commit
27b73a116f
13 changed files with 15 additions and 64 deletions
|
@ -539,7 +539,6 @@ static const struct _dmic_ops dmic_ops = {
|
|||
#define PDM_CLK_SRC(idx) DT_STRING_TOKEN(PDM(idx), clock_source)
|
||||
|
||||
#define PDM_NRFX_DEVICE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(PDM(idx), 0); \
|
||||
static void *rx_msgs##idx[DT_PROP(PDM(idx), queue_size)]; \
|
||||
static struct dmic_nrfx_pdm_drv_data dmic_nrfx_pdm_data##idx; \
|
||||
static int pdm_nrfx_init##idx(const struct device *dev) \
|
||||
|
|
|
@ -1411,7 +1411,7 @@ static struct qspi_nor_data qspi_nor_dev_data = {
|
|||
#endif /* CONFIG_MULTITHREADING */
|
||||
};
|
||||
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(QSPI_NODE, 1);
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(QSPI_NODE);
|
||||
|
||||
PINCTRL_DT_DEFINE(QSPI_NODE);
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ static int twi_nrfx_pm_action(const struct device *dev,
|
|||
I2C_NRFX_TWI_FREQUENCY(DT_PROP(I2C(idx), clock_frequency))
|
||||
|
||||
#define I2C_NRFX_TWI_DEVICE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2C(idx), 1); \
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \
|
||||
BUILD_ASSERT(I2C_FREQUENCY(idx) != \
|
||||
I2C_NRFX_TWI_INVALID_FREQUENCY, \
|
||||
"Wrong I2C " #idx " frequency setting in dts"); \
|
||||
|
|
|
@ -394,7 +394,7 @@ static int i2c_nrfx_twim_init(const struct device *dev)
|
|||
#define MSG_BUF_SIZE(idx) MAX(CONCAT_BUF_SIZE(idx), FLASH_BUF_MAX_SIZE(idx))
|
||||
|
||||
#define I2C_NRFX_TWIM_DEVICE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2C(idx), 1); \
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(I2C(idx)); \
|
||||
BUILD_ASSERT(I2C_FREQUENCY(idx) != \
|
||||
I2C_NRFX_TWIM_INVALID_FREQUENCY, \
|
||||
"Wrong I2C " #idx " frequency setting in dts"); \
|
||||
|
|
|
@ -880,7 +880,6 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
|
|||
#define I2S_CLK_SRC(idx) DT_STRING_TOKEN(I2S(idx), clock_source)
|
||||
|
||||
#define I2S_NRFX_DEVICE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2S(idx), 0); \
|
||||
static void *tx_msgs##idx[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
|
||||
static void *rx_msgs##idx[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
|
||||
static struct i2s_nrfx_drv_data i2s_nrfx_data##idx = { \
|
||||
|
|
|
@ -323,7 +323,7 @@ static int pwm_nrfx_pm_action(const struct device *dev,
|
|||
#define PWM_PROP(dev_idx, prop) DT_PROP(PWM(dev_idx), prop)
|
||||
|
||||
#define PWM_NRFX_DEVICE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(PWM(idx), 1); \
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(PWM(idx)); \
|
||||
static struct pwm_nrfx_data pwm_nrfx_##idx##_data; \
|
||||
PINCTRL_DT_DEFINE(PWM(idx)); \
|
||||
static const struct pwm_nrfx_config pwm_nrfx_##idx##_config = { \
|
||||
|
|
|
@ -174,7 +174,7 @@ static void qdec_nrfx_gpio_ctrl(bool enable)
|
|||
#endif
|
||||
}
|
||||
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(DT_DRV_INST(0), 1);
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(0));
|
||||
|
||||
static int qdec_nrfx_init(const struct device *dev)
|
||||
{
|
||||
|
|
|
@ -1110,7 +1110,7 @@ static int uart_nrfx_pm_action(const struct device *dev,
|
|||
|
||||
PINCTRL_DT_INST_DEFINE(0);
|
||||
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(DT_DRV_INST(0), 1);
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(DT_DRV_INST(0));
|
||||
|
||||
static const struct uart_nrfx_config uart_nrfx_uart0_config = {
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
||||
|
|
|
@ -1991,7 +1991,7 @@ static int uarte_nrfx_pm_action(const struct device *dev,
|
|||
.disable_rx = DT_PROP(node_id, disable_rx)
|
||||
|
||||
#define UART_NRF_UARTE_DEVICE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(UARTE(idx), 1); \
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(UARTE(idx)); \
|
||||
UARTE_INT_DRIVEN(idx); \
|
||||
UARTE_ASYNC(idx); \
|
||||
PINCTRL_DT_DEFINE(UARTE(idx)); \
|
||||
|
|
|
@ -386,7 +386,7 @@ static int spi_nrfx_init(const struct device *dev)
|
|||
#define SPI_PROP(idx, prop) DT_PROP(SPI(idx), prop)
|
||||
|
||||
#define SPI_NRFX_SPI_DEFINE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(SPI(idx), 1); \
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPI(idx)); \
|
||||
static void irq_connect##idx(void) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_IRQN(SPI(idx)), DT_IRQ(SPI(idx), priority), \
|
||||
|
|
|
@ -567,7 +567,7 @@ static int spi_nrfx_init(const struct device *dev)
|
|||
))
|
||||
|
||||
#define SPI_NRFX_SPIM_DEFINE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(SPIM(idx), 1); \
|
||||
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(SPIM(idx)); \
|
||||
static void irq_connect##idx(void) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_IRQN(SPIM(idx)), DT_IRQ(SPIM(idx), priority), \
|
||||
|
|
|
@ -270,7 +270,6 @@ static int spi_nrfx_init(const struct device *dev)
|
|||
#define SPIS_PROP(idx, prop) DT_PROP(SPIS(idx), prop)
|
||||
|
||||
#define SPI_NRFX_SPIS_DEFINE(idx) \
|
||||
NRF_DT_CHECK_PIN_ASSIGNMENTS(SPIS(idx), 0); \
|
||||
static void irq_connect##idx(void) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_IRQN(SPIS(idx)), DT_IRQ(SPIS(idx), priority), \
|
||||
|
|
|
@ -180,61 +180,15 @@
|
|||
/* Note: allow a trailing ";" either way */
|
||||
|
||||
/**
|
||||
* @brief Helper macro for NRF_DT_CHECK_PIN_ASSIGNMENTS
|
||||
*
|
||||
* This macro is needed only because the order of parameters taken by
|
||||
* DT_NODE_HAS_PROP is different than that required for a macro to be
|
||||
* invoked by FOR_EACH_FIXED_ARG.
|
||||
*
|
||||
* @param prop lowercase-and-underscores property name
|
||||
* @param node_id node identifier
|
||||
* @return 1 if the node has the property, 0 otherwise.
|
||||
*/
|
||||
#define NRF_DT_CHECK_NODE_HAS_PROP(prop, node_id) \
|
||||
DT_NODE_HAS_PROP(node_id, prop)
|
||||
|
||||
/**
|
||||
* Error out the build if PINCTRL is enabled and:
|
||||
* - the specified node does not have the required pinctrl properties defined
|
||||
* (pinctrl-0 always, pinctrl-1 when PM_DEVICE is enabled and the caller
|
||||
* supports sleep state)
|
||||
* or
|
||||
* - it has any of the specified legacy pin properties defined (which would
|
||||
* be ignored in this case, so presumably the resulting configuration would
|
||||
* not be as expected)
|
||||
* or if PINCTRL is not enabled and:
|
||||
* - the specified node does not have at least one of the specified legacy
|
||||
* pin properties defined
|
||||
* or
|
||||
* - it has any pinctrl states defined (which would be ignored in this case).
|
||||
* Error out the build if CONFIG_PM_DEVICE=y and pinctrl-1 state (sleep) is not
|
||||
* defined.
|
||||
*
|
||||
* @param node_id node identifier
|
||||
* @param sleep_supported indicates whether the caller supports sleep state
|
||||
* (so pinctrl-1 should be checked)
|
||||
* @param ... list of lowercase-and-underscores legacy pin properties to be
|
||||
* checked
|
||||
*/
|
||||
#define NRF_DT_CHECK_PIN_ASSIGNMENTS(node_id, sleep_supported, ...) \
|
||||
BUILD_ASSERT((IS_ENABLED(CONFIG_PINCTRL) && \
|
||||
DT_PINCTRL_HAS_IDX(node_id, 0) && \
|
||||
(DT_PINCTRL_HAS_IDX(node_id, 1) || \
|
||||
!sleep_supported || \
|
||||
!IS_ENABLED(CONFIG_PM_DEVICE))) \
|
||||
|| \
|
||||
(!IS_ENABLED(CONFIG_PINCTRL) && \
|
||||
(FOR_EACH_FIXED_ARG(NRF_DT_CHECK_NODE_HAS_PROP, \
|
||||
(||), node_id, __VA_ARGS__))),\
|
||||
DT_NODE_PATH(node_id) \
|
||||
" defined without required pin configuration"); \
|
||||
BUILD_ASSERT(!IS_ENABLED(CONFIG_PINCTRL) || \
|
||||
!(FOR_EACH_FIXED_ARG(NRF_DT_CHECK_NODE_HAS_PROP, \
|
||||
(||), node_id, __VA_ARGS__)), \
|
||||
DT_NODE_PATH(node_id) " has legacy *-pin properties" \
|
||||
" defined although PINCTRL is enabled"); \
|
||||
BUILD_ASSERT(IS_ENABLED(CONFIG_PINCTRL) || \
|
||||
!DT_NUM_PINCTRL_STATES(node_id), \
|
||||
DT_NODE_PATH(node_id) " has pinctrl states defined" \
|
||||
" although PINCTRL is not enabled")
|
||||
#define NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(node_id) \
|
||||
BUILD_ASSERT(!IS_ENABLED(CONFIG_PM_DEVICE) || \
|
||||
DT_PINCTRL_HAS_NAME(node_id, sleep), \
|
||||
DT_NODE_PATH(node_id) " defined without sleep state")
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue