Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp358952ybt; Wed, 24 Jun 2020 00:43:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqmxLO5QfxRx23+PSVZp9QkkveuATU2em0zzWZDXeREqfuR6RrblryTOEy61AamPKFo2yO X-Received: by 2002:aa7:da4f:: with SMTP id w15mr24856879eds.384.1592984632827; Wed, 24 Jun 2020 00:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592984632; cv=none; d=google.com; s=arc-20160816; b=QdHmnOElqVS4q8XNnET4768/c1tsxC2CNCGOW9vrI7Lpra1G0ohwn7Vi56nruMjlDo bV5MTQ3Uyvk7REH/BiWXjjiqWQfjekZ+iBsNmsTbgWAesAP2BHToZIauQpYH5xwBg6DE u86vHd4cK0Hz8Vr8dNMamMb0tmqJMxW9C/9c/FMMlFWeJtipfMj6OZUQb842srnTQKis +WR2VTriZ4/XaBFmYzLE7T0Q6zVPvgHB5MTNM8g14GGt8MLU3ZZU/dPpklIhiJAHha9b 8yE2Vnq/HnjqgjCrvssCb8Omt8xBTQ2xN+Arr86iihTEKlISV0JivpzuIQJUbkBmxZoI ObKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=lzV7gKU3pdGxW7z/7aAvgl+epS0Q3pq+E8lNemPRCEc=; b=CdLUzwCcXkQlgl5CzWb68RHWsyfiWv5Tm4e5aVZsgUkyI2A3crUXgvSwuZaOu+KqX9 TlsK71w5SXA9i2tj6VmKTi8DXp18BOuhtvVzhf7+OGE0JPMXilMU/Z+13P66QjcCG8g2 VCxBGZOa/rEgz8XCA55vSjvV1NMr/7aFffLVqoqaAzn7xralIHotepemdDh4jHQSSnKL zT9JsWECmKCqP3ySR4YuY/Z43IC2hPmMokGIz1nEmyu0kT4nfKanO0erfRjH+Ch9pllD S2MqRhY6Ry99oKfwEFto6HesAd6qAoRMK+ErbgXPU0Qfm7on4DfosoUMBk+WVwcUf1+w bNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pFWOwSx2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u7si12235250edx.125.2020.06.24.00.43.29; Wed, 24 Jun 2020 00:43:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pFWOwSx2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389913AbgFXHlq (ORCPT + 99 others); Wed, 24 Jun 2020 03:41:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:42996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388375AbgFXHlp (ORCPT ); Wed, 24 Jun 2020 03:41:45 -0400 Received: from localhost (unknown [171.61.66.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 436732073E; Wed, 24 Jun 2020 07:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592984505; bh=rFvb/C1vB4fTHTydMAiUGBkFrnes0labacSjWz6B2Ro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pFWOwSx2QuRAnC+dU59V66k7oE7mFQ9SqeTpJOszccIJVV1nfUcRw+2Vxen2N2mof 5BrcG59EnL6JgPy+zVEumdQk0LwApIvQD6TcojckfQUxq/7IBhO0sC9uOh1w6PRGYF blHJ+y/CxitjKLKVq6UZn9ojTTYgOaD6J3lYFXXQ= Date: Wed, 24 Jun 2020 13:11:41 +0530 From: Vinod Koul To: Sugar Zhang Cc: Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] dmaengine: pl330: Make sure the debug is idle before doing DMAGO Message-ID: <20200624074141.GQ2324254@vkoul-mobl> References: <1591234598-78919-1-git-send-email-sugar.zhang@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1591234598-78919-1-git-send-email-sugar.zhang@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04-06-20, 09:36, Sugar Zhang wrote: > According to the datasheet of pl330: > > Example 2-1 Using DMAGO with the debug instruction registers > > 1. Create a program for the DMA channel > 2. Store the program in a region of system memory > 3. Poll the DBGSTATUS Register to ensure that the debug is idle > 4. Write to the DBGINST0 Register > 5. Write to the DBGINST1 Register > 6. Write zero to the DBGCMD Register > > so, we should make sure the debug is idle before step 4/5/6, not > only step 6. if not, there maybe a risk that fail to write DBGINST0/1. Applied, thanks > > Signed-off-by: Sugar Zhang > --- > > drivers/dma/pl330.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c > index 88b884c..6a158ee 100644 > --- a/drivers/dma/pl330.c > +++ b/drivers/dma/pl330.c > @@ -885,6 +885,12 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd, > void __iomem *regs = thrd->dmac->base; > u32 val; > > + /* If timed out due to halted state-machine */ > + if (_until_dmac_idle(thrd)) { > + dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); > + return; > + } > + > val = (insn[0] << 16) | (insn[1] << 24); > if (!as_manager) { > val |= (1 << 0); > @@ -895,12 +901,6 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd, > val = le32_to_cpu(*((__le32 *)&insn[2])); > writel(val, regs + DBGINST1); > > - /* If timed out due to halted state-machine */ > - if (_until_dmac_idle(thrd)) { > - dev_err(thrd->dmac->ddma.dev, "DMAC halted!\n"); > - return; > - } > - > /* Get going */ > writel(0, regs + DBGCMD); > } > -- > 2.7.4 > > -- ~Vinod