Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b0e2f55 authored by Javier Martin's avatar Javier Martin Committed by Vinod Koul
Browse files

dmaengine: imx-dma: remove 'resbytes' field of 'internal' structure.



Use per-descriptor 'len' field to keep track of the remaining bytes
instead. This goes on the direction of eventually removing the
'internal' structure.

Signed-off-by: default avatarJavier Martin <javier.martin@vista-silicon.com>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
parent e4756b5e
Loading
Loading
Loading
Loading
+3 −8
Original line number Original line Diff line number Diff line
@@ -129,8 +129,6 @@ enum imxdma_prep_type {
 */
 */


struct imxdma_channel_internal {
struct imxdma_channel_internal {
	unsigned int resbytes;

	struct timer_list watchdog;
	struct timer_list watchdog;


	int hw_chaining;
	int hw_chaining;
@@ -233,12 +231,11 @@ static int imxdma_hw_chain(struct imxdma_channel_internal *imxdma)
static inline int imxdma_sg_next(struct imxdma_desc *d, struct scatterlist *sg)
static inline int imxdma_sg_next(struct imxdma_desc *d, struct scatterlist *sg)
{
{
	struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan);
	struct imxdma_channel *imxdmac = to_imxdma_chan(d->desc.chan);
	struct imxdma_channel_internal *imxdma = &imxdmac->internal;
	unsigned long now;
	unsigned long now;


	now = min(imxdma->resbytes, sg->length);
	now = min(d->len, sg->length);
	if (imxdma->resbytes != IMX_DMA_LENGTH_LOOP)
	if (d->len != IMX_DMA_LENGTH_LOOP)
		imxdma->resbytes -= now;
		d->len -= now;


	if (d->direction == DMA_DEV_TO_MEM)
	if (d->direction == DMA_DEV_TO_MEM)
		imx_dmav1_writel(sg->dma_address, DMA_DAR(imxdmac->channel));
		imx_dmav1_writel(sg->dma_address, DMA_DAR(imxdmac->channel));
@@ -480,8 +477,6 @@ static int imxdma_xfer_desc(struct imxdma_desc *d)
	/* Cyclic transfer is the same as slave_sg with special sg configuration. */
	/* Cyclic transfer is the same as slave_sg with special sg configuration. */
	case IMXDMA_DESC_CYCLIC:
	case IMXDMA_DESC_CYCLIC:
	case IMXDMA_DESC_SLAVE_SG:
	case IMXDMA_DESC_SLAVE_SG:
		imxdmac->internal.resbytes = d->len;

		if (d->direction == DMA_DEV_TO_MEM) {
		if (d->direction == DMA_DEV_TO_MEM) {
			imx_dmav1_writel(imxdmac->per_address,
			imx_dmav1_writel(imxdmac->per_address,
					 DMA_SAR(imxdmac->channel));
					 DMA_SAR(imxdmac->channel));