Message ID | 20181111154710.26904-4-vkoul@kernel.org |
---|---|
State | New |
Headers | show |
Series | dmaengine: emove dma_slave_config direction usage 2nd installment | expand |
Signed-off-by: Robin Gong <yibin.gong@nxp.com> > -----Original Message----- > From: Vinod Koul <vkoul@kernel.org> > Sent: 2018年11月11日 23:47 > To: dmaengine@vger.kernel.org > Cc: Vinod Koul <vkoul@kernel.org>; Robin Gong <yibin.gong@nxp.com> > 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@kernel.org> > --- > 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
On 12-11-18, 07:18, Robin Gong wrote:
> Signed-off-by: Robin Gong <yibin.gong@nxp.com>
You cannot sign off, but you may test this patch and provide
Tested-by:.. or you may review the patch and provide Reviewed-by:... or
if you agree you may also provide Acked-by: ...
For more details, please see
Documentation/process/submitting-patches.rst Section 13.
Also, please do not top post you reply
Thanks
--
~Vinod
Hi Vinod, Thanks for your kind reminding. I have test your patch these days and unfortunately, found it breaks uart/spi on i.mx6 boards. I identified the issue finally, could you please merge attached patch into your patch set to ensure no any regression? > -----Original Message----- > From: Vinod Koul <vkoul@kernel.org> > Sent: 2018年11月13日 2:10 > To: Robin Gong <yibin.gong@nxp.com> > Cc: dmaengine@vger.kernel.org > Subject: Re: [PATCH 3/5] dmaengine: imx-sdma: remove dma_slave_config > direction usage > > On 12-11-18, 07:18, Robin Gong wrote: > > Signed-off-by: Robin Gong <yibin.gong@nxp.com> > > You cannot sign off, but you may test this patch and provide Tested-by:.. or you > may review the patch and provide Reviewed-by:... or if you agree you may also > provide Acked-by: ... > > For more details, please see > Documentation/process/submitting-patches.rst Section 13. > > Also, please do not top post you reply > > Thanks > > -- > ~Vinod
On 20-11-18, 09:01, Robin Gong wrote: > Hi Vinod, > Thanks for your kind reminding. > I have test your patch these days and unfortunately, found it breaks uart/spi > on i.mx6 boards. I identified the issue finally, could you please merge attached > patch into your patch set to ensure no any regression? Thanks for testing and I have squashed this to single commit -- ~Vinod
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)
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@kernel.org> --- drivers/dma/imx-sdma.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) -- 2.14.4