drivers: memc: enable pinctrl for flexspi driver
Enable pinctrl for flexspi driver. Note that when flexspi is being using in XIP mode, pinctrl settings are not required and will not be applied. Pinctrl settings are only required when the flexspi device being used is not the one used for XIP. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
dbb4ad8eb1
commit
459495aa84
2 changed files with 12 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
#include <sys/util.h>
|
#include <sys/util.h>
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
|
|
||||||
#include "memc_mcux_flexspi.h"
|
#include "memc_mcux_flexspi.h"
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ struct memc_flexspi_data {
|
||||||
bool combination_mode;
|
bool combination_mode;
|
||||||
bool sck_differential_clock;
|
bool sck_differential_clock;
|
||||||
flexspi_read_sample_clock_t rx_sample_clock;
|
flexspi_read_sample_clock_t rx_sample_clock;
|
||||||
|
const struct pinctrl_dev_config *pincfg;
|
||||||
size_t size[kFLEXSPI_PortCount];
|
size_t size[kFLEXSPI_PortCount];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +132,7 @@ static int memc_flexspi_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct memc_flexspi_data *data = dev->data;
|
struct memc_flexspi_data *data = dev->data;
|
||||||
flexspi_config_t flexspi_config;
|
flexspi_config_t flexspi_config;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* we should not configure the device we are running on */
|
/* we should not configure the device we are running on */
|
||||||
if (memc_flexspi_is_running_xip(dev)) {
|
if (memc_flexspi_is_running_xip(dev)) {
|
||||||
|
@ -137,6 +140,12 @@ static int memc_flexspi_init(const struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Apply pinctrl state */
|
||||||
|
ret = pinctrl_apply_state(data->pincfg, PINCTRL_STATE_DEFAULT);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
FLEXSPI_GetDefaultConfig(&flexspi_config);
|
FLEXSPI_GetDefaultConfig(&flexspi_config);
|
||||||
|
|
||||||
flexspi_config.ahbConfig.enableAHBBufferable = data->ahb_bufferable;
|
flexspi_config.ahbConfig.enableAHBBufferable = data->ahb_bufferable;
|
||||||
|
@ -166,6 +175,7 @@ static int memc_flexspi_init(const struct device *dev)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MEMC_FLEXSPI(n) \
|
#define MEMC_FLEXSPI(n) \
|
||||||
|
PINCTRL_DT_INST_DEFINE(n); \
|
||||||
static struct memc_flexspi_data \
|
static struct memc_flexspi_data \
|
||||||
memc_flexspi_data_##n = { \
|
memc_flexspi_data_##n = { \
|
||||||
.base = (FLEXSPI_Type *) DT_INST_REG_ADDR(n), \
|
.base = (FLEXSPI_Type *) DT_INST_REG_ADDR(n), \
|
||||||
|
@ -178,6 +188,7 @@ static int memc_flexspi_init(const struct device *dev)
|
||||||
.combination_mode = DT_INST_PROP(n, combination_mode), \
|
.combination_mode = DT_INST_PROP(n, combination_mode), \
|
||||||
.sck_differential_clock = DT_INST_PROP(n, sck_differential_clock), \
|
.sck_differential_clock = DT_INST_PROP(n, sck_differential_clock), \
|
||||||
.rx_sample_clock = DT_INST_PROP(n, rx_clock_source), \
|
.rx_sample_clock = DT_INST_PROP(n, rx_clock_source), \
|
||||||
|
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
DEVICE_DT_INST_DEFINE(n, \
|
DEVICE_DT_INST_DEFINE(n, \
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: NXP FlexSPI controller
|
||||||
|
|
||||||
compatible: "nxp,imx-flexspi"
|
compatible: "nxp,imx-flexspi"
|
||||||
|
|
||||||
include: spi-controller.yaml
|
include: [spi-controller.yaml, pinctrl-device.yaml]
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
reg:
|
reg:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue