Re: [PATCH V4 3/5] dmaengine/dw_dmac: Divide one sg to many desc,if sg len is greater than DWC_MAX_COUNT

From: Koul, Vinod
Date: Mon May 09 2011 - 01:52:59 EST


On Thu, 2011-05-05 at 17:30 +0530, Viresh Kumar wrote:
> If len passed in sg for slave_sg transfers is greater than DWC_MAX_COUNT, then
> driver programmes controller incorrectly. This patch adds code to handle this
> situation by allocation more than one desc for same sg.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxx>
> ---
> drivers/dma/dw_dmac.c | 65 +++++++++++++++++++++++++++++++++----------------
> 1 files changed, 44 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 75b32e1..1662452 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -695,9 +695,15 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
> reg = dws->tx_reg;
> for_each_sg(sgl, sg, sg_len, i) {
> struct dw_desc *desc;
> - u32 len;
> - u32 mem;
> + u32 len, dlen, mem;
>
> + mem = sg_phys(sg);
> + len = sg_dma_len(sg);
> + mem_width = 2;
hardcoding mem_width doesn't make sense, you should take this from input
params

--
~Vinod

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/