Signed-off-by: Robin Gong <yibin.gong@xxxxxxx> > -----Original Message----- > From: Vinod Koul <vkoul@xxxxxxxxxx> > Sent: 2018年11月11日 23:47 > To: dmaengine@xxxxxxxxxxxxxxx > Cc: Vinod Koul <vkoul@xxxxxxxxxx>; Robin Gong <yibin.gong@xxxxxxx> > Subject: [PATCH 3/5] dmaengine: imx-sdma: remove dma_slave_config > direction usage > > dma_slave_config direction was marked as deprecated quite some time back, > remove the usage from this driver so that the field can be removed > > Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx> > --- > drivers/dma/imx-sdma.c | 31 ++++++++++++++++++++++++++----- > 1 file changed, 26 insertions(+), 5 deletions(-) > > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index > b4ec2d20e661..49ac851bb352 100644 > --- a/drivers/dma/imx-sdma.c > +++ b/drivers/dma/imx-sdma.c > @@ -335,6 +335,7 @@ struct sdma_desc { > * @sdma: pointer to the SDMA engine for this channel > * @channel: the channel number, matches dmaengine chan_id + 1 > * @direction: transfer type. Needed for setting SDMA script > + * @slave_config Slave configuration > * @peripheral_type: Peripheral type. Needed for setting SDMA script > * @event_id0: aka dma request line > * @event_id1: for channels that use 2 events > @@ -362,6 +363,7 @@ struct sdma_channel { > struct sdma_engine *sdma; > unsigned int channel; > enum dma_transfer_direction direction; > + struct dma_slave_config slave_config; > enum sdma_peripheral_type peripheral_type; > unsigned int event_id0; > unsigned int event_id1; > @@ -440,6 +442,10 @@ struct sdma_engine { > struct sdma_buffer_descriptor *bd0; > }; > > +static int sdma_config_write(struct dma_chan *chan, > + struct dma_slave_config *dmaengine_cfg, > + enum dma_transfer_direction direction); > + > static struct sdma_driver_data sdma_imx31 = { > .chnenbl0 = SDMA_CHNENBL0_IMX31, > .num_events = 32, > @@ -1415,6 +1421,8 @@ static struct dma_async_tx_descriptor > *sdma_prep_slave_sg( > struct scatterlist *sg; > struct sdma_desc *desc; > > + sdma_config_write(chan, &sdmac->slave_config, direction); > + > desc = sdma_transfer_init(sdmac, direction, sg_len); > if (!desc) > goto err_out; > @@ -1499,6 +1507,8 @@ static struct dma_async_tx_descriptor > *sdma_prep_dma_cyclic( > > dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel); > > + sdma_config_write(chan, &sdmac->slave_config, direction); > + > desc = sdma_transfer_init(sdmac, direction, num_periods); > if (!desc) > goto err_out; > @@ -1554,17 +1564,18 @@ static struct dma_async_tx_descriptor > *sdma_prep_dma_cyclic( > return NULL; > } > > -static int sdma_config(struct dma_chan *chan, > - struct dma_slave_config *dmaengine_cfg) > +static int sdma_config_write(struct dma_chan *chan, > + struct dma_slave_config *dmaengine_cfg, > + enum dma_transfer_direction direction) > { > struct sdma_channel *sdmac = to_sdma_chan(chan); > > - if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) { > + if (direction == DMA_DEV_TO_MEM) { > sdmac->per_address = dmaengine_cfg->src_addr; > sdmac->watermark_level = dmaengine_cfg->src_maxburst * > dmaengine_cfg->src_addr_width; > sdmac->word_size = dmaengine_cfg->src_addr_width; > - } else if (dmaengine_cfg->direction == DMA_DEV_TO_DEV) { > + } else if (direction == DMA_DEV_TO_DEV) { > sdmac->per_address2 = dmaengine_cfg->src_addr; > sdmac->per_address = dmaengine_cfg->dst_addr; > sdmac->watermark_level = dmaengine_cfg->src_maxburst & @@ > -1578,10 +1589,20 @@ static int sdma_config(struct dma_chan *chan, > dmaengine_cfg->dst_addr_width; > sdmac->word_size = dmaengine_cfg->dst_addr_width; > } > - sdmac->direction = dmaengine_cfg->direction; > + sdmac->direction = direction; > return sdma_config_channel(chan); > } > > +static int sdma_config(struct dma_chan *chan, > + struct dma_slave_config *dmaengine_cfg) { > + struct sdma_channel *sdmac = to_sdma_chan(chan); > + > + memcpy(&sdmac->slave_config, dmaengine_cfg, > sizeof(*dmaengine_cfg)); > + > + return 0; > +} > + > static enum dma_status sdma_tx_status(struct dma_chan *chan, > dma_cookie_t cookie, > struct dma_tx_state *txstate) > -- > 2.14.4