From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94F9BC433DF for ; Wed, 24 Jun 2020 07:41:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6897A20B80 for ; Wed, 24 Jun 2020 07:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592984506; bh=rFvb/C1vB4fTHTydMAiUGBkFrnes0labacSjWz6B2Ro=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=ABiT+cY//fttpUfG+RMqXdxjihI296f+D15QI0JWzvUL4b1YR/3hJMEE2jpFPK3bZ QvRk5BPsyeroA6VrR30ZzUG5iE1WCS2H6XgL7LbmfMaod2c54rvTZK/9e2gBqzLQLd XAwcPpwB60tzFFkI6wQk1QsvTLgSvEuHIsoojmq4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389882AbgFXHlq (ORCPT ); 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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@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