From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 07 Aug 2018 13:44:56 +0200 (CEST) Received: from outils.crapouillou.net ([89.234.176.41]:39432 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23994697AbeHGLmje95EB (ORCPT ); Tue, 7 Aug 2018 13:42:39 +0200 From: Paul Cercueil To: Vinod Koul , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Zubair Lutfullah Kakakhel Cc: Paul Cercueil , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Daniel Silsby Subject: [PATCH v4 11/18] dmaengine: dma-jz4780: Add missing residue DTC mask Date: Tue, 7 Aug 2018 13:42:11 +0200 Message-Id: <20180807114218.20091-12-paul@crapouillou.net> In-Reply-To: <20180807114218.20091-1-paul@crapouillou.net> References: <20180807114218.20091-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1533642158; bh=jLJCZIVKkbYCDXkjcROiuVNNYMWcaF4OaXaOBxMOq88=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=MvxuFage/pZOhdO37DpGq22x5jgXrWQ+NNoR5O7aaVJxBOCl+XdLQ5U8Bo5U6imR28p6jprkIuyBMG/De/l1GG3GEuO6Da5+S590kYRQO3HiAawMPmsjf6LqjL8qpF0aZ6EHd/08Is0tjlI/puYpCO0437x94c2AjSUL7twcXFc= Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 65458 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: paul@crapouillou.net Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips From: Daniel Silsby The 'dtc' word in jz DMA descriptors contains two fields: The lowest 24 bits are the transfer count, and upper 8 bits are the DOA offset to next descriptor. The upper 8 bits are now correctly masked off when computing residue in jz4780_dma_desc_residue(). Note that reads of the DTCn hardware reg are automatically masked this way. Signed-off-by: Daniel Silsby Signed-off-by: Paul Cercueil Tested-by: Mathieu Malaterre --- drivers/dma/dma-jz4780.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) v2: No change v3: No change v4: Add my Signed-off-by diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index 3a4d0a4b550d..a4292ac4c686 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c @@ -616,7 +616,8 @@ static size_t jz4780_dma_desc_residue(struct jz4780_dma_chan *jzchan, residue = 0; for (i = next_sg; i < desc->count; i++) - residue += desc->desc[i].dtc << jzchan->transfer_shift; + residue += (desc->desc[i].dtc & 0xffffff) << + jzchan->transfer_shift; if (next_sg != 0) { count = jz4780_dma_chn_readl(jzdma, jzchan->id, -- 2.11.0