drivers: memc: memc_mcux_flexspi: make pinctrl support conditional
Make pinctrl support conditional for memc flexspi driver Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
4edf5d7f03
commit
328e0be132
|
@ -8,7 +8,9 @@
|
|||
|
||||
#include <logging/log.h>
|
||||
#include <sys/util.h>
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#include <drivers/pinctrl.h>
|
||||
#endif
|
||||
|
||||
#include "memc_mcux_flexspi.h"
|
||||
|
||||
|
@ -38,7 +40,9 @@ struct memc_flexspi_data {
|
|||
bool combination_mode;
|
||||
bool sck_differential_clock;
|
||||
flexspi_read_sample_clock_t rx_sample_clock;
|
||||
#ifdef CONFIG_PINCTRL
|
||||
const struct pinctrl_dev_config *pincfg;
|
||||
#endif
|
||||
size_t size[kFLEXSPI_PortCount];
|
||||
};
|
||||
|
||||
|
@ -132,7 +136,6 @@ static int memc_flexspi_init(const struct device *dev)
|
|||
{
|
||||
struct memc_flexspi_data *data = dev->data;
|
||||
flexspi_config_t flexspi_config;
|
||||
int ret;
|
||||
|
||||
/* we should not configure the device we are running on */
|
||||
if (memc_flexspi_is_running_xip(dev)) {
|
||||
|
@ -141,10 +144,14 @@ static int memc_flexspi_init(const struct device *dev)
|
|||
}
|
||||
|
||||
/* Apply pinctrl state */
|
||||
#ifdef CONFIG_PINCTRL
|
||||
int ret;
|
||||
|
||||
ret = pinctrl_apply_state(data->pincfg, PINCTRL_STATE_DEFAULT);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
FLEXSPI_GetDefaultConfig(&flexspi_config);
|
||||
|
||||
|
@ -174,8 +181,16 @@ static int memc_flexspi_init(const struct device *dev)
|
|||
#define MEMC_FLEXSPI_CFG_XIP(node_id) false
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PINCTRL
|
||||
#define PINCTRL_DEFINE(n) PINCTRL_DT_INST_DEFINE(n);
|
||||
#define PINCTRL_INIT(n) .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n),
|
||||
#else
|
||||
#define PINCTRL_DEFINE(n)
|
||||
#define PINCTRL_INIT(n)
|
||||
#endif
|
||||
|
||||
#define MEMC_FLEXSPI(n) \
|
||||
PINCTRL_DT_INST_DEFINE(n); \
|
||||
PINCTRL_DEFINE(n) \
|
||||
static struct memc_flexspi_data \
|
||||
memc_flexspi_data_##n = { \
|
||||
.base = (FLEXSPI_Type *) DT_INST_REG_ADDR(n), \
|
||||
|
@ -188,7 +203,7 @@ static int memc_flexspi_init(const struct device *dev)
|
|||
.combination_mode = DT_INST_PROP(n, combination_mode), \
|
||||
.sck_differential_clock = DT_INST_PROP(n, sck_differential_clock), \
|
||||
.rx_sample_clock = DT_INST_PROP(n, rx_clock_source), \
|
||||
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||
PINCTRL_INIT(n) \
|
||||
}; \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(n, \
|
||||
|
|
Loading…
Reference in a new issue