From patchwork Tue Oct 9 05:47:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10631945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 06368933 for ; Tue, 9 Oct 2018 05:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC1A328A41 for ; Tue, 9 Oct 2018 05:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFE1728A46; Tue, 9 Oct 2018 05:49:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 832A228A41 for ; Tue, 9 Oct 2018 05:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ykYdiQaAlXE0QFMmFS4bR7BQYENglY1UE5PZYJqQ8Hs=; b=rSytrwMQ51TFg7 GJHCuPZwZeE7/l6Pr+A5eFuVPfAh50Iqybvg/4g4D3+WMxFGYR1UcH0F3tJ0fQZXQx98NdLj3HyJV mZMqZZNDn9OrReznLSOYZoJTDsrfpusF4GeFGS66D6VrSdS9n63G7KPRelppiD9dYlBeLU27cwJI4 3eAR9AKoiMsF2/3ay9yanJbfUEfvt9ctodE/hISeOyoBN2MCfe7Fp9BZYHyjwL7R/S2pWkDH+sRnm tkZtNMhdjGhkgZNXw6VDHqXkpD81ojkUH0/PVwi7hQOvuvQEurjz62s2TgaDZxUDtslk4uFJPvGt9 H1mqpOlKnfRwnQ4zUnJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9ktD-00065p-Ul; Tue, 09 Oct 2018 05:49:04 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9ksT-0005jr-HN for linux-arm-kernel@lists.infradead.org; Tue, 09 Oct 2018 05:48:20 +0000 Received: by mail-pf1-x443.google.com with SMTP id l81-v6so262758pfg.3 for ; Mon, 08 Oct 2018 22:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+MWYNVKtdWKD6Kujvr2Aj0Wsqz2uAcNP6f8Ca6gsyhQ=; b=UEGr97XWdDuhrAyW352emJpf61BrkxEUIlSDz9vF42Ii3CFMf5SrrrSmUdi5BlcYxz 4bpFquIee4piojPX22Gzdq61W9axvkWAz3d7U4p7SD2l3qTvyC6TX9/P+gqtNzeeO8io vb4JPkTXqL6Z6MO/fpQ25OS4zUU4tEofF2o7Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+MWYNVKtdWKD6Kujvr2Aj0Wsqz2uAcNP6f8Ca6gsyhQ=; b=Z3yZzJNofwmvK61aoQO5DfDzrUphdhRqp992kryR0Gx8KupdwZC1N/B7jNRsCHFHSP p/2LLyzZnUTMvcyFid0a04/QZM3hynchE0oYa9DHCJL/EujqQOHrWdv3FEUV+lzfqvhR RPl6MZRu8sCn3PvF8fnFNCwIq2Coj100JyBEbHEdv+s9mSU5zvwtyn1GzeBFFS50+VqM YX+FBpvSxy5mYypeI/4Fmz6gMwYdb46f8SBbFlRTLchny6mLgNqDkFXYnS+4meG5nTsf KTSLCof+bFc5FmNZun4FJWK7h6tVmtom869mypoCBtbLUlxg3Toc5/BqZGq+0RzsZUjn JC0w== X-Gm-Message-State: ABuFfogRdCjVdHsewojLc4u+pFTfVJOjwIH1nkJjO2uuthBZOKHNdXRo 9466qBIGU9w1F/DMlrmLNwi7j3k0x9Y= X-Google-Smtp-Source: ACcGV62btTrzmG5Nc+IiadGRrGg+nq0I79KJncpZNOsftccNv1XHh1w4r0UpuBz85dlIkAzpLPthrQ== X-Received: by 2002:a63:9409:: with SMTP id m9-v6mr23420475pge.93.1539064088830; Mon, 08 Oct 2018 22:48:08 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1601:3aef:314f:b9ea:889f]) by smtp.gmail.com with ESMTPSA id a15-v6sm16886234pff.8.2018.10.08.22.48.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 22:48:07 -0700 (PDT) From: "Joel Fernandes (Google)" To: stable@vger.kernel.org Subject: [PATCH 2/7] dmaengine: stm32-dma: fix incomplete configuration in cyclic mode Date: Mon, 8 Oct 2018 22:47:47 -0700 Message-Id: <20181009054752.145978-3-joel@joelfernandes.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20181009054752.145978-1-joel@joelfernandes.org> References: <20181009054752.145978-1-joel@joelfernandes.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181008_224817_618411_1D58E2BF X-CRM114-Status: GOOD ( 13.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Torgue , Vinod Koul , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Pierre Yves MORDRET , "Joel Fernandes \(Google\)" , Maxime Coquelin , dmaengine@vger.kernel.org, Hugues Fruchet , Dan Williams , "moderated list:ARM/STM32 ARCHITECTURE" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Pierre Yves MORDRET When in cyclic mode, the configuration is updated after having started the DMA hardware (STM32_DMA_SCR_EN) leading to incomplete configuration of SMxAR registers. Signed-off-by: Pierre-Yves MORDRET Signed-off-by: Hugues Fruchet Signed-off-by: Vinod Koul --- drivers/dma/stm32-dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c index 4099948b6914..fae7de54f00a 100644 --- a/drivers/dma/stm32-dma.c +++ b/drivers/dma/stm32-dma.c @@ -441,6 +441,8 @@ static void stm32_dma_dump_reg(struct stm32_dma_chan *chan) dev_dbg(chan2dev(chan), "SFCR: 0x%08x\n", sfcr); } +static void stm32_dma_configure_next_sg(struct stm32_dma_chan *chan); + static void stm32_dma_start_transfer(struct stm32_dma_chan *chan) { struct stm32_dma_device *dmadev = stm32_dma_get_dev(chan); @@ -483,6 +485,9 @@ static void stm32_dma_start_transfer(struct stm32_dma_chan *chan) if (status) stm32_dma_irq_clear(chan, status); + if (chan->desc->cyclic) + stm32_dma_configure_next_sg(chan); + stm32_dma_dump_reg(chan); /* Start DMA */ @@ -576,8 +581,7 @@ static void stm32_dma_issue_pending(struct dma_chan *c) if (vchan_issue_pending(&chan->vchan) && !chan->desc && !chan->busy) { dev_dbg(chan2dev(chan), "vchan %p: issued\n", &chan->vchan); stm32_dma_start_transfer(chan); - if (chan->desc->cyclic) - stm32_dma_configure_next_sg(chan); + } spin_unlock_irqrestore(&chan->vchan.lock, flags); }