Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286124
b: refs/heads/master
c: ab59a51
h: refs/heads/master
v: v3
  • Loading branch information
Huang Shijie authored and Vinod Koul committed Dec 5, 2011
1 parent b277faf commit 0f218e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d0709d2000ae7dbead759715f57ba381b7057bb
refs/heads/master: ab59a510c6ad6b3add5125df64843be754782de6
11 changes: 9 additions & 2 deletions trunk/drivers/dma/imx-sdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ struct sdma_channel {
struct dma_async_tx_descriptor desc;
dma_cookie_t last_completed;
enum dma_status status;
unsigned int chn_count;
unsigned int chn_real_count;
};

#define IMX_DMA_SG_LOOP (1 << 0)
Expand Down Expand Up @@ -503,6 +505,7 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)
struct sdma_buffer_descriptor *bd;
int i, error = 0;

sdmac->chn_real_count = 0;
/*
* non loop mode. Iterate over all descriptors, collect
* errors and call callback function
Expand All @@ -512,16 +515,17 @@ static void mxc_sdma_handle_channel_normal(struct sdma_channel *sdmac)

if (bd->mode.status & (BD_DONE | BD_RROR))
error = -EIO;
sdmac->chn_real_count += bd->mode.count;
}

if (error)
sdmac->status = DMA_ERROR;
else
sdmac->status = DMA_SUCCESS;

sdmac->last_completed = sdmac->desc.cookie;
if (sdmac->desc.callback)
sdmac->desc.callback(sdmac->desc.callback_param);
sdmac->last_completed = sdmac->desc.cookie;
}

static void mxc_sdma_handle_channel(struct sdma_channel *sdmac)
Expand Down Expand Up @@ -941,6 +945,7 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
goto err_out;
}

sdmac->chn_count = 0;
for_each_sg(sgl, sg, sg_len, i) {
struct sdma_buffer_descriptor *bd = &sdmac->bd[i];
int param;
Expand All @@ -957,6 +962,7 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
}

bd->mode.count = count;
sdmac->chn_count += count;

if (sdmac->word_size > DMA_SLAVE_BUSWIDTH_4_BYTES) {
ret = -EINVAL;
Expand Down Expand Up @@ -1120,7 +1126,8 @@ static enum dma_status sdma_tx_status(struct dma_chan *chan,

last_used = chan->cookie;

dma_set_tx_state(txstate, sdmac->last_completed, last_used, 0);
dma_set_tx_state(txstate, sdmac->last_completed, last_used,
sdmac->chn_count - sdmac->chn_real_count);

return sdmac->status;
}
Expand Down

0 comments on commit 0f218e7

Please sign in to comment.