drivers: spi: Fix device instance const qualifier loss
Some needed to wrap the device pointer into device's data, where others needed only device's data to be passed to HAL callback function. Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
45832ac1d6
commit
898f914df5
8 changed files with 70 additions and 49 deletions
|
@ -29,6 +29,7 @@ struct spi_mcux_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spi_mcux_data {
|
struct spi_mcux_data {
|
||||||
|
const struct device *dev;
|
||||||
dspi_master_handle_t handle;
|
dspi_master_handle_t handle;
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
size_t transfer_len;
|
size_t transfer_len;
|
||||||
|
@ -116,13 +117,12 @@ static void spi_mcux_isr(void *arg)
|
||||||
static void spi_mcux_master_transfer_callback(SPI_Type *base,
|
static void spi_mcux_master_transfer_callback(SPI_Type *base,
|
||||||
dspi_master_handle_t *handle, status_t status, void *userData)
|
dspi_master_handle_t *handle, status_t status, void *userData)
|
||||||
{
|
{
|
||||||
const struct device *dev = userData;
|
struct spi_mcux_data *data = userData;
|
||||||
struct spi_mcux_data *data = dev->data;
|
|
||||||
|
|
||||||
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
||||||
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
||||||
|
|
||||||
spi_mcux_transfer_next_packet(dev);
|
spi_mcux_transfer_next_packet(data->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spi_mcux_configure(const struct device *dev,
|
static int spi_mcux_configure(const struct device *dev,
|
||||||
|
@ -194,7 +194,8 @@ static int spi_mcux_configure(const struct device *dev,
|
||||||
DSPI_MasterInit(base, &master_config, clock_freq);
|
DSPI_MasterInit(base, &master_config, clock_freq);
|
||||||
|
|
||||||
DSPI_MasterTransferCreateHandle(base, &data->handle,
|
DSPI_MasterTransferCreateHandle(base, &data->handle,
|
||||||
spi_mcux_master_transfer_callback, dev);
|
spi_mcux_master_transfer_callback,
|
||||||
|
data);
|
||||||
|
|
||||||
DSPI_SetDummyData(base, 0);
|
DSPI_SetDummyData(base, 0);
|
||||||
|
|
||||||
|
@ -271,6 +272,8 @@ static int spi_mcux_init(const struct device *dev)
|
||||||
const struct spi_mcux_config *config = dev->config;
|
const struct spi_mcux_config *config = dev->config;
|
||||||
struct spi_mcux_data *data = dev->data;
|
struct spi_mcux_data *data = dev->data;
|
||||||
|
|
||||||
|
data->dev = dev;
|
||||||
|
|
||||||
config->irq_config_func(dev);
|
config->irq_config_func(dev);
|
||||||
|
|
||||||
spi_context_unlock_unconditionally(&data->ctx);
|
spi_context_unlock_unconditionally(&data->ctx);
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct spi_mcux_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spi_mcux_data {
|
struct spi_mcux_data {
|
||||||
|
const struct device *dev;
|
||||||
spi_master_handle_t handle;
|
spi_master_handle_t handle;
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
size_t transfer_len;
|
size_t transfer_len;
|
||||||
|
@ -105,13 +106,12 @@ static void spi_mcux_isr(void *arg)
|
||||||
static void spi_mcux_transfer_callback(SPI_Type *base,
|
static void spi_mcux_transfer_callback(SPI_Type *base,
|
||||||
spi_master_handle_t *handle, status_t status, void *userData)
|
spi_master_handle_t *handle, status_t status, void *userData)
|
||||||
{
|
{
|
||||||
const struct device *dev = userData;
|
struct spi_mcux_data *data = userData;
|
||||||
struct spi_mcux_data *data = dev->data;
|
|
||||||
|
|
||||||
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
||||||
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
||||||
|
|
||||||
spi_mcux_transfer_next_packet(dev);
|
spi_mcux_transfer_next_packet(data->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spi_mcux_configure(const struct device *dev,
|
static int spi_mcux_configure(const struct device *dev,
|
||||||
|
@ -180,7 +180,7 @@ static int spi_mcux_configure(const struct device *dev,
|
||||||
SPI_MasterInit(base, &master_config, clock_freq);
|
SPI_MasterInit(base, &master_config, clock_freq);
|
||||||
|
|
||||||
SPI_MasterTransferCreateHandle(base, &data->handle,
|
SPI_MasterTransferCreateHandle(base, &data->handle,
|
||||||
spi_mcux_transfer_callback, dev);
|
spi_mcux_transfer_callback, data);
|
||||||
|
|
||||||
SPI_SetDummyData(base, 0);
|
SPI_SetDummyData(base, 0);
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ static int spi_mcux_configure(const struct device *dev,
|
||||||
SPI_SlaveInit(base, &slave_config);
|
SPI_SlaveInit(base, &slave_config);
|
||||||
|
|
||||||
SPI_SlaveTransferCreateHandle(base, &data->handle,
|
SPI_SlaveTransferCreateHandle(base, &data->handle,
|
||||||
spi_mcux_transfer_callback, dev);
|
spi_mcux_transfer_callback, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
data->ctx.config = spi_cfg;
|
data->ctx.config = spi_cfg;
|
||||||
|
@ -286,6 +286,8 @@ static int spi_mcux_init(const struct device *dev)
|
||||||
|
|
||||||
config->irq_config_func(dev);
|
config->irq_config_func(dev);
|
||||||
|
|
||||||
|
data->dev = dev;
|
||||||
|
|
||||||
spi_context_unlock_unconditionally(&data->ctx);
|
spi_context_unlock_unconditionally(&data->ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -31,6 +31,7 @@ struct spi_mcux_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spi_mcux_data {
|
struct spi_mcux_data {
|
||||||
|
const struct device *dev;
|
||||||
lpspi_master_handle_t handle;
|
lpspi_master_handle_t handle;
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
size_t transfer_len;
|
size_t transfer_len;
|
||||||
|
@ -116,13 +117,12 @@ static void spi_mcux_isr(void *arg)
|
||||||
static void spi_mcux_master_transfer_callback(LPSPI_Type *base,
|
static void spi_mcux_master_transfer_callback(LPSPI_Type *base,
|
||||||
lpspi_master_handle_t *handle, status_t status, void *userData)
|
lpspi_master_handle_t *handle, status_t status, void *userData)
|
||||||
{
|
{
|
||||||
const struct device *dev = userData;
|
struct spi_mcux_data *data = userData;
|
||||||
struct spi_mcux_data *data = dev->data;
|
|
||||||
|
|
||||||
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
||||||
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
||||||
|
|
||||||
spi_mcux_transfer_next_packet(dev);
|
spi_mcux_transfer_next_packet(data->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spi_mcux_configure(const struct device *dev,
|
static int spi_mcux_configure(const struct device *dev,
|
||||||
|
@ -193,7 +193,8 @@ static int spi_mcux_configure(const struct device *dev,
|
||||||
LPSPI_MasterInit(base, &master_config, clock_freq);
|
LPSPI_MasterInit(base, &master_config, clock_freq);
|
||||||
|
|
||||||
LPSPI_MasterTransferCreateHandle(base, &data->handle,
|
LPSPI_MasterTransferCreateHandle(base, &data->handle,
|
||||||
spi_mcux_master_transfer_callback, dev);
|
spi_mcux_master_transfer_callback,
|
||||||
|
data);
|
||||||
|
|
||||||
LPSPI_SetDummyData(base, 0);
|
LPSPI_SetDummyData(base, 0);
|
||||||
|
|
||||||
|
@ -271,6 +272,8 @@ static int spi_mcux_init(const struct device *dev)
|
||||||
|
|
||||||
spi_context_unlock_unconditionally(&data->ctx);
|
spi_context_unlock_unconditionally(&data->ctx);
|
||||||
|
|
||||||
|
data->dev = dev;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spi);
|
||||||
|
|
||||||
struct spi_nrfx_data {
|
struct spi_nrfx_data {
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
|
const struct device *dev;
|
||||||
size_t chunk_len;
|
size_t chunk_len;
|
||||||
bool busy;
|
bool busy;
|
||||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||||
|
@ -246,36 +247,39 @@ static const struct spi_driver_api spi_nrfx_driver_api = {
|
||||||
|
|
||||||
static void event_handler(const nrfx_spi_evt_t *p_event, void *p_context)
|
static void event_handler(const nrfx_spi_evt_t *p_event, void *p_context)
|
||||||
{
|
{
|
||||||
const struct device *dev = p_context;
|
struct spi_nrfx_data *dev_data = p_context;
|
||||||
struct spi_nrfx_data *dev_data = get_dev_data(dev);
|
|
||||||
|
|
||||||
if (p_event->type == NRFX_SPI_EVENT_DONE) {
|
if (p_event->type == NRFX_SPI_EVENT_DONE) {
|
||||||
spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len);
|
spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len);
|
||||||
spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len);
|
spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len);
|
||||||
|
|
||||||
transfer_next_chunk(dev);
|
transfer_next_chunk(dev_data->dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_spi(const struct device *dev)
|
static int init_spi(const struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct spi_nrfx_data *dev_data = get_dev_data(dev);
|
||||||
|
nrfx_err_t result;
|
||||||
|
|
||||||
|
dev_data->dev = dev;
|
||||||
|
|
||||||
/* This sets only default values of frequency, mode and bit order.
|
/* This sets only default values of frequency, mode and bit order.
|
||||||
* The proper ones are set in configure() when a transfer is started.
|
* The proper ones are set in configure() when a transfer is started.
|
||||||
*/
|
*/
|
||||||
nrfx_err_t result = nrfx_spi_init(&get_dev_config(dev)->spi,
|
result = nrfx_spi_init(&get_dev_config(dev)->spi,
|
||||||
&get_dev_config(dev)->config,
|
&get_dev_config(dev)->config,
|
||||||
event_handler,
|
event_handler,
|
||||||
dev);
|
dev_data);
|
||||||
if (result != NRFX_SUCCESS) {
|
if (result != NRFX_SUCCESS) {
|
||||||
LOG_ERR("Failed to initialize device: %s",
|
LOG_ERR("Failed to initialize device: %s", dev->name);
|
||||||
dev->name);
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||||
get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE;
|
dev_data->pm_state = DEVICE_PM_ACTIVE_STATE;
|
||||||
#endif
|
#endif
|
||||||
spi_context_unlock_unconditionally(&get_dev_data(dev)->ctx);
|
spi_context_unlock_unconditionally(&dev_data->ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ LOG_MODULE_REGISTER(spi_nrfx_spim);
|
||||||
|
|
||||||
struct spi_nrfx_data {
|
struct spi_nrfx_data {
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
|
const struct device *dev;
|
||||||
size_t chunk_len;
|
size_t chunk_len;
|
||||||
bool busy;
|
bool busy;
|
||||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||||
|
@ -288,36 +289,39 @@ static const struct spi_driver_api spi_nrfx_driver_api = {
|
||||||
|
|
||||||
static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context)
|
static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context)
|
||||||
{
|
{
|
||||||
const struct device *dev = p_context;
|
struct spi_nrfx_data *dev_data = p_context;
|
||||||
struct spi_nrfx_data *dev_data = get_dev_data(dev);
|
|
||||||
|
|
||||||
if (p_event->type == NRFX_SPIM_EVENT_DONE) {
|
if (p_event->type == NRFX_SPIM_EVENT_DONE) {
|
||||||
spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len);
|
spi_context_update_tx(&dev_data->ctx, 1, dev_data->chunk_len);
|
||||||
spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len);
|
spi_context_update_rx(&dev_data->ctx, 1, dev_data->chunk_len);
|
||||||
|
|
||||||
transfer_next_chunk(dev);
|
transfer_next_chunk(dev_data->dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_spim(const struct device *dev)
|
static int init_spim(const struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct spi_nrfx_data *data = get_dev_data(dev);
|
||||||
|
nrfx_err_t result;
|
||||||
|
|
||||||
|
data->dev = dev;
|
||||||
|
|
||||||
/* This sets only default values of frequency, mode and bit order.
|
/* This sets only default values of frequency, mode and bit order.
|
||||||
* The proper ones are set in configure() when a transfer is started.
|
* The proper ones are set in configure() when a transfer is started.
|
||||||
*/
|
*/
|
||||||
nrfx_err_t result = nrfx_spim_init(&get_dev_config(dev)->spim,
|
result = nrfx_spim_init(&get_dev_config(dev)->spim,
|
||||||
&get_dev_config(dev)->config,
|
&get_dev_config(dev)->config,
|
||||||
event_handler,
|
event_handler,
|
||||||
dev);
|
data);
|
||||||
if (result != NRFX_SUCCESS) {
|
if (result != NRFX_SUCCESS) {
|
||||||
LOG_ERR("Failed to initialize device: %s",
|
LOG_ERR("Failed to initialize device: %s", dev->name);
|
||||||
dev->name);
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||||
get_dev_data(dev)->pm_state = DEVICE_PM_ACTIVE_STATE;
|
data->pm_state = DEVICE_PM_ACTIVE_STATE;
|
||||||
#endif
|
#endif
|
||||||
spi_context_unlock_unconditionally(&get_dev_data(dev)->ctx);
|
spi_context_unlock_unconditionally(&data->ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,8 +221,7 @@ static const struct spi_driver_api spi_nrfx_driver_api = {
|
||||||
|
|
||||||
static void event_handler(const nrfx_spis_evt_t *p_event, void *p_context)
|
static void event_handler(const nrfx_spis_evt_t *p_event, void *p_context)
|
||||||
{
|
{
|
||||||
const struct device *dev = p_context;
|
struct spi_nrfx_data *dev_data = p_context;
|
||||||
struct spi_nrfx_data *dev_data = get_dev_data(dev);
|
|
||||||
|
|
||||||
if (p_event->evt_type == NRFX_SPIS_XFER_DONE) {
|
if (p_event->evt_type == NRFX_SPIS_XFER_DONE) {
|
||||||
spi_context_complete(&dev_data->ctx, p_event->rx_amount);
|
spi_context_complete(&dev_data->ctx, p_event->rx_amount);
|
||||||
|
@ -232,20 +231,20 @@ static void event_handler(const nrfx_spis_evt_t *p_event, void *p_context)
|
||||||
static int init_spis(const struct device *dev,
|
static int init_spis(const struct device *dev,
|
||||||
const nrfx_spis_config_t *config)
|
const nrfx_spis_config_t *config)
|
||||||
{
|
{
|
||||||
|
struct spi_nrfx_data *dev_data = get_dev_data(dev);
|
||||||
/* This sets only default values of frequency, mode and bit order.
|
/* This sets only default values of frequency, mode and bit order.
|
||||||
* The proper ones are set in configure() when a transfer is started.
|
* The proper ones are set in configure() when a transfer is started.
|
||||||
*/
|
*/
|
||||||
nrfx_err_t result = nrfx_spis_init(&get_dev_config(dev)->spis,
|
nrfx_err_t result = nrfx_spis_init(&get_dev_config(dev)->spis,
|
||||||
config,
|
config,
|
||||||
event_handler,
|
event_handler,
|
||||||
dev);
|
dev_data);
|
||||||
if (result != NRFX_SUCCESS) {
|
if (result != NRFX_SUCCESS) {
|
||||||
LOG_ERR("Failed to initialize device: %s",
|
LOG_ERR("Failed to initialize device: %s", dev->name);
|
||||||
dev->name);
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
spi_context_unlock_unconditionally(&get_dev_data(dev)->ctx);
|
spi_context_unlock_unconditionally(&dev_data->ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct spi_mcux_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spi_mcux_data {
|
struct spi_mcux_data {
|
||||||
|
const struct device *dev;
|
||||||
lpspi_master_handle_t handle;
|
lpspi_master_handle_t handle;
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
size_t transfer_len;
|
size_t transfer_len;
|
||||||
|
@ -114,15 +115,15 @@ static void spi_mcux_isr(void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spi_mcux_master_transfer_callback(LPSPI_Type *base,
|
static void spi_mcux_master_transfer_callback(LPSPI_Type *base,
|
||||||
lpspi_master_handle_t *handle, status_t status, void *userData)
|
lpspi_master_handle_t *handle,
|
||||||
|
status_t status, void *userData)
|
||||||
{
|
{
|
||||||
const struct device *dev = userData;
|
struct spi_mcux_data *data = userData;
|
||||||
struct spi_mcux_data *data = dev->data;
|
|
||||||
|
|
||||||
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
||||||
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
||||||
|
|
||||||
spi_mcux_transfer_next_packet(dev);
|
spi_mcux_transfer_next_packet(data->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spi_mcux_configure(const struct device *dev,
|
static int spi_mcux_configure(const struct device *dev,
|
||||||
|
@ -189,7 +190,8 @@ static int spi_mcux_configure(const struct device *dev,
|
||||||
LPSPI_MasterInit(base, &master_config, clock_freq);
|
LPSPI_MasterInit(base, &master_config, clock_freq);
|
||||||
|
|
||||||
LPSPI_MasterTransferCreateHandle(base, &data->handle,
|
LPSPI_MasterTransferCreateHandle(base, &data->handle,
|
||||||
spi_mcux_master_transfer_callback, dev);
|
spi_mcux_master_transfer_callback,
|
||||||
|
data);
|
||||||
|
|
||||||
LPSPI_SetDummyData(base, 0);
|
LPSPI_SetDummyData(base, 0);
|
||||||
|
|
||||||
|
@ -267,6 +269,8 @@ static int spi_mcux_init(const struct device *dev)
|
||||||
|
|
||||||
config->irq_config_func(dev);
|
config->irq_config_func(dev);
|
||||||
|
|
||||||
|
data->dev = dev;
|
||||||
|
|
||||||
spi_context_unlock_unconditionally(&data->ctx);
|
spi_context_unlock_unconditionally(&data->ctx);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -45,6 +45,7 @@ struct spi_sam0_config {
|
||||||
struct spi_sam0_data {
|
struct spi_sam0_data {
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
#ifdef CONFIG_SPI_ASYNC
|
#ifdef CONFIG_SPI_ASYNC
|
||||||
|
const struct device *dev;
|
||||||
const struct device *dma;
|
const struct device *dma;
|
||||||
uint32_t dma_segment_len;
|
uint32_t dma_segment_len;
|
||||||
#endif
|
#endif
|
||||||
|
@ -452,7 +453,7 @@ static int spi_sam0_dma_rx_load(const struct device *dev, uint8_t *buf,
|
||||||
dma_cfg.channel_direction = PERIPHERAL_TO_MEMORY;
|
dma_cfg.channel_direction = PERIPHERAL_TO_MEMORY;
|
||||||
dma_cfg.source_data_size = 1;
|
dma_cfg.source_data_size = 1;
|
||||||
dma_cfg.dest_data_size = 1;
|
dma_cfg.dest_data_size = 1;
|
||||||
dma_cfg.user_data = dev;
|
dma_cfg.user_data = data;
|
||||||
dma_cfg.dma_callback = spi_sam0_dma_rx_done;
|
dma_cfg.dma_callback = spi_sam0_dma_rx_done;
|
||||||
dma_cfg.block_count = 1;
|
dma_cfg.block_count = 1;
|
||||||
dma_cfg.head_block = &dma_blk;
|
dma_cfg.head_block = &dma_blk;
|
||||||
|
@ -586,9 +587,9 @@ static int spi_sam0_dma_advance_buffers(const struct device *dev)
|
||||||
static void spi_sam0_dma_rx_done(const struct device *dma_dev, void *arg,
|
static void spi_sam0_dma_rx_done(const struct device *dma_dev, void *arg,
|
||||||
uint32_t id, int error_code)
|
uint32_t id, int error_code)
|
||||||
{
|
{
|
||||||
const struct device *dev = arg;
|
struct spi_sam0_data *data = arg;
|
||||||
|
const struct device *dev = data->dev;
|
||||||
const struct spi_sam0_config *cfg = dev->config;
|
const struct spi_sam0_config *cfg = dev->config;
|
||||||
struct spi_sam0_data *data = dev->data;
|
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
ARG_UNUSED(id);
|
ARG_UNUSED(id);
|
||||||
|
@ -707,6 +708,7 @@ static int spi_sam0_init(const struct device *dev)
|
||||||
#ifdef CONFIG_SPI_ASYNC
|
#ifdef CONFIG_SPI_ASYNC
|
||||||
|
|
||||||
data->dma = device_get_binding(cfg->dma_dev);
|
data->dma = device_get_binding(cfg->dma_dev);
|
||||||
|
data->dev = dev;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue