Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1005323imm; Wed, 4 Jul 2018 09:40:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcu2wtOQ50pkpPwKHWP5R5YRGbpR+PyEY4vhE39ExIpLMoD4X/nb2DBKv1ymmW1Th51VH7Y X-Received: by 2002:a63:5b51:: with SMTP id l17-v6mr2503318pgm.165.1530722457311; Wed, 04 Jul 2018 09:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530722457; cv=none; d=google.com; s=arc-20160816; b=bYHvzwsBUz3he83fZM5D65w6OKCR7u6xbdamESNIzGti5QRrMqV3RCqcRpYNXdLX10 FH94ykMKvZY1Ia22sBrdSsoxstVnUw5nY20RfeqBnJNGDKwzFzbt1dYFPptb7uJ2N/1A QtwQc3kR9gnmRoZSXLvcZ52TQDrK4AkkDWdumJlTgbL3k357UQ4MO2JNdxPevHbfw3xp a5dztPQ9Cu/TY6vO+8GzLhmKFfQiEqwm9yICyeVx/tTsCP+EZ0gORK8WHmcPenBPAXYZ PlDz1gIfccDKaYXTbDm1RAAB1xzOo/ZprBLB/KPy6mrPDwQKAvtL8gTeLEfCObpCDT9Z W8/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=j+upXkgERpePvjNZspRqtBidgvJTrSCYmZ5cK1m5E0Y=; b=iKz/+SuEVjdVlrLasXEx7ymY+zxw0PTeJXPZxOqeoSz3inefFhYyWWfyNZ0owNGDY1 7lL07vOav/ITSl/afZmk5wy2CDb78MEfLAND62CHkZEHbCghavIAeZHhnab8M1dvPpN5 i4hSOQWJM7fEc1c1cWlMsDmIJXExRtcOMrALuRC3uSFCTPBRHdNtxADj9JRk3h0bqXf4 O/EuLChqH4pJN6yZX3fEZdG+MNEulFrHRkv6V0z7OBfnHwOsKo51tYiWlBcThITeH29+ LqSr2dvUQTpFvEQ+t8K4jZr0mqzu491kH8uHrn+SH3eWV2wE2hl7iy8ufayzhnqTJ271 76nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="LFXhV8q/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f35-v6si3814931plh.193.2018.07.04.09.40.42; Wed, 04 Jul 2018 09:40:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="LFXhV8q/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752635AbeGDQkD (ORCPT + 99 others); Wed, 4 Jul 2018 12:40:03 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34993 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbeGDQkB (ORCPT ); Wed, 4 Jul 2018 12:40:01 -0400 Received: by mail-pf0-f195.google.com with SMTP id q7-v6so1964025pff.2; Wed, 04 Jul 2018 09:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=j+upXkgERpePvjNZspRqtBidgvJTrSCYmZ5cK1m5E0Y=; b=LFXhV8q/fmEJlGrTISMSQlzSDI3D/0oW5C9yUfObTx8GqU9IwaCT/kYpgRtSAptKmm xtTN6SAs8ppV/ENK8nGh0EEEPbXvuO2bvdSwj6qugQ86wKgIPiZgn1rIFYQfFQiAxDn6 nWksup5/xVSN9yrnWzdwOfIp79/PPWX744jas75wkYekWEO+7rPR9giJzuhEqdBmhe62 qoVpUEIqbF1C1VNBYtTkfYXS2AdCETqfUMraI5ZXSQh18OfjkPicm1rIUnpQISX84J3e od1x4FhRbQMTSbX4FouyRdPcAWXsZ3sxsYqXZPvnmy1PqDLPjl9FoVIQ9SV5psnp8prc MOSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=j+upXkgERpePvjNZspRqtBidgvJTrSCYmZ5cK1m5E0Y=; b=BxMQntW//bWC1MkKT0EaGp4ZqwbZOIqGF5m/FATzKvb0vEUKiNgFZk07j1UqZ/Xmo7 okJsXY4a7PgPsxZx3c86RnksTKz0ras0+6lBVMlAgsv21/ErN5sbnnCbEgSE2b6KPwv/ UYW2LVHH7egWJkNA6AbhyicNCv2wMFAM+8v+++HWSjjzK3gDaKn7WFh0W3HI0GsKwZeX L1Wm8i6Rwf5mYY2wtRE4TMqSR7pdytFLJSmPlJXp5gYTmXTt2ZmAEmWPciZN+sZRevHa 2WKQq5u3HYK5UjQC20kPOIrn9tEA6c3A370/4kqyEIkRXMMxt/V1QDu0wU1W+4O6/HJH jNSA== X-Gm-Message-State: APt69E0YTfcDiPTDIXMXDonu73l2SwOHKR2s4x6PK2YXb64/WYZXnGlu wzGz/yQ4/pMGjX5ekpgv8vtT+XtcRThOGkJTHlQ= X-Received: by 2002:a63:a1a:: with SMTP id 26-v6mr2560270pgk.221.1530722400963; Wed, 04 Jul 2018 09:40:00 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:2604:0:0:0:0 with HTTP; Wed, 4 Jul 2018 09:40:00 -0700 (PDT) In-Reply-To: <20180703123214.23090-4-paul@crapouillou.net> References: <20180703123214.23090-1-paul@crapouillou.net> <20180703123214.23090-4-paul@crapouillou.net> From: PrasannaKumar Muralidharan Date: Wed, 4 Jul 2018 22:10:00 +0530 Message-ID: Subject: Re: [PATCH 03/14] dmaengine: dma-jz4780: Use 4-word descriptors To: Paul Cercueil Cc: Vinod Koul , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Zubair Lutfullah Kakakhel , Mathieu Malaterre , Daniel Silsby , dmaengine@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , Linux-MIPS Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On 3 July 2018 at 18:02, Paul Cercueil wrote: > The only information we use in the 8-word version of the hardware DMA > descriptor that is not present in the 4-word version is the transfer > type, aka. the ID of the source or recipient device. > > Since the transfer type will never change for a DMA channel in use, > we can just set it once for all in the corresponding DMA register > before starting any transfer. > > This has several benefits: > > * the driver will handle twice as many hardware DMA descriptors; > > * the driver is closer to support the JZ4740, which only supports 4-word > hardware DMA descriptors; > > * the JZ4770 SoC needs the transfer type to be set in the corresponding > DMA register anyway, even if 8-word descriptors are in use. > > Signed-off-by: Paul Cercueil > --- > drivers/dma/dma-jz4780.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c > index 4d234caf5d62..cd2cd70fd843 100644 > --- a/drivers/dma/dma-jz4780.c > +++ b/drivers/dma/dma-jz4780.c > @@ -93,17 +93,12 @@ > * @dtc: transfer count (number of blocks of the transfer size specified in DCM > * to transfer) in the low 24 bits, offset of the next descriptor from the > * descriptor base address in the upper 8 bits. > - * @sd: target/source stride difference (in stride transfer mode). > - * @drt: request type > */ > struct jz4780_dma_hwdesc { > uint32_t dcm; > uint32_t dsa; > uint32_t dta; > uint32_t dtc; > - uint32_t sd; > - uint32_t drt; > - uint32_t reserved[2]; > }; > > /* Size of allocations for hardware descriptor blocks. */ > @@ -280,7 +275,6 @@ static int jz4780_dma_setup_hwdesc(struct jz4780_dma_chan *jzchan, > desc->dcm = JZ_DMA_DCM_SAI; > desc->dsa = addr; > desc->dta = config->dst_addr; > - desc->drt = jzchan->transfer_type; > > width = config->dst_addr_width; > maxburst = config->dst_maxburst; > @@ -288,7 +282,6 @@ static int jz4780_dma_setup_hwdesc(struct jz4780_dma_chan *jzchan, > desc->dcm = JZ_DMA_DCM_DAI; > desc->dsa = config->src_addr; > desc->dta = addr; > - desc->drt = jzchan->transfer_type; > > width = config->src_addr_width; > maxburst = config->src_maxburst; > @@ -433,9 +426,10 @@ static struct dma_async_tx_descriptor *jz4780_dma_prep_dma_memcpy( > tsz = jz4780_dma_transfer_size(dest | src | len, > &jzchan->transfer_shift); > > + jzchan->transfer_type = JZ_DMA_DRT_AUTO; > + > desc->desc[0].dsa = src; > desc->desc[0].dta = dest; > - desc->desc[0].drt = JZ_DMA_DRT_AUTO; > desc->desc[0].dcm = JZ_DMA_DCM_TIE | JZ_DMA_DCM_SAI | JZ_DMA_DCM_DAI | > tsz << JZ_DMA_DCM_TSZ_SHIFT | > JZ_DMA_WIDTH_32_BIT << JZ_DMA_DCM_SP_SHIFT | > @@ -490,9 +484,12 @@ static void jz4780_dma_begin(struct jz4780_dma_chan *jzchan) > (jzchan->curr_hwdesc + 1) % jzchan->desc->count; > } > > - /* Use 8-word descriptors. */ > - jz4780_dma_chn_writel(jzdma, jzchan->id, > - JZ_DMA_REG_DCS, JZ_DMA_DCS_DES8); > + /* Use 4-word descriptors. */ > + jz4780_dma_chn_writel(jzdma, jzchan->id, JZ_DMA_REG_DCS, 0); > + > + /* Set transfer type. */ > + jz4780_dma_chn_writel(jzdma, jzchan->id, JZ_DMA_REG_DRT, > + jzchan->transfer_type); > > /* Write descriptor address and initiate descriptor fetch. */ > desc_phys = jzchan->desc->desc_phys + > @@ -502,7 +499,7 @@ static void jz4780_dma_begin(struct jz4780_dma_chan *jzchan) > > /* Enable the channel. */ > jz4780_dma_chn_writel(jzdma, jzchan->id, JZ_DMA_REG_DCS, > - JZ_DMA_DCS_DES8 | JZ_DMA_DCS_CTE); > + JZ_DMA_DCS_CTE); > } > > static void jz4780_dma_issue_pending(struct dma_chan *chan) > -- > 2.18.0 > > Patch looks good to me. Reviewed-by: PrasannaKumar Muralidharan Regards, PrasannaKumar