From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752205AbbBKA01 (ORCPT ); Tue, 10 Feb 2015 19:26:27 -0500 Received: from mga14.intel.com ([192.55.52.115]:49118 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751382AbbBKA0Z (ORCPT ); Tue, 10 Feb 2015 19:26:25 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,554,1418112000"; d="scan'208";a="525675108" Date: Tue, 10 Feb 2015 16:24:05 -0800 From: Vinod Koul To: Robert Baldyga Cc: dan.j.williams@intel.com, lars@metafoo.de, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com, k.kozlowski@samsung.com, kyungmin.park@samsung.com, l.czerwinski@samsung.com, padma.kvr@gmail.com Subject: Re: [PATCH v3 2/2] dma: pl330: add DMA_PAUSE feature Message-ID: <20150211002405.GC21387@intel.com> References: <1418208918-28127-1-git-send-email-r.baldyga@samsung.com> <1418208918-28127-3-git-send-email-r.baldyga@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1418208918-28127-3-git-send-email-r.baldyga@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 10, 2014 at 11:55:18AM +0100, Robert Baldyga wrote: > DMA_PAUSE command is used for halting DMA transfer on chosen channel. > It can be useful when we want to safely read residue before terminating > all requests on channel. Otherwise there can be situation when some data > is transferred before channel termination but after reading residue, > which obviously results with data loss. To avoid this situation we can > pause channel, read residue and then terminate all requests. > This scenario is common, for example, in serial port drivers. And where is the resume here? Also this needs rebase -- ~Vinod > > Signed-off-by: Robert Baldyga > --- > drivers/dma/pl330.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c > index 2f4d561..ead4369 100644 > --- a/drivers/dma/pl330.c > +++ b/drivers/dma/pl330.c > @@ -2137,6 +2137,25 @@ static int pl330_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, unsigned > pm_runtime_mark_last_busy(pl330->ddma.dev); > pm_runtime_put_autosuspend(pl330->ddma.dev); > break; > + case DMA_PAUSE: > + /* > + * We don't support DMA_RESUME command because of hardware > + * limitations, so after pausing the channel we cannot restore > + * it to active state. We have to terminate channel and setup > + * DMA transfer again. This pause feature was implemented to > + * allow safely read residue before channel termination. > + */ > + pm_runtime_get_sync(pl330->ddma.dev); > + spin_lock_irqsave(&pch->lock, flags); > + > + spin_lock(&pl330->lock); > + _stop(pch->thread); > + spin_unlock(&pl330->lock); > + > + spin_unlock_irqrestore(&pch->lock, flags); > + pm_runtime_mark_last_busy(pl330->ddma.dev); > + pm_runtime_put_autosuspend(pl330->ddma.dev); > + break; > case DMA_SLAVE_CONFIG: > slave_config = (struct dma_slave_config *)arg; > > -- > 1.9.1 > --