From patchwork Wed Oct 17 00:00:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 10644423 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 7B588157A for ; Wed, 17 Oct 2018 00:00:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 686582A58A for ; Wed, 17 Oct 2018 00:00:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C5BA2A5A8; Wed, 17 Oct 2018 00:00:33 +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 E4FD02A5B7 for ; Wed, 17 Oct 2018 00:00:32 +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:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DLN1tTeL9zYF9z/Tb/MkPjFzQu88txjBj6uUM97q3rQ=; b=NdgQRw3Wn46J4f 3DrjZIh90qDOeJgSgVcCDHCwZHLIOjEC+6ZT6qZ3YG/fY0AEYEpyKPmUqJ38f4ZBAA3/Yh3mw51lO kUX30p3pZX15WKpM28Rvfn51ZhPRpOQTSxrfodVN3uspnTj6ZnsMrIaKxCIYpLiXvF9ZGeWTi+oxM 0HGQ75ER03yRzDt8dElWsKzkflNLVu8lmVH6VGWG1kJnHP+Ffjsl013mHQprzVEg8Haj/FWfXdCSv adulwAY/8+pq2GEUCM6domUOFQagYEr3DRicDkwD7VbGrqE1u+yWJgcfqYI/dzxm78LqmJgNJl/L1 d82jQT1DZbIsfav1HuKQ==; 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 1gCZGH-0007we-6P; Wed, 17 Oct 2018 00:00:29 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gCZGE-0007va-IP for linux-arm-kernel@lists.infradead.org; Wed, 17 Oct 2018 00:00:28 +0000 Received: by mail-pf1-x442.google.com with SMTP id 78-v6so9861862pfq.0 for ; Tue, 16 Oct 2018 17:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=u8eFwnEzbMjdPpfi+5GlsSnjxbqm4XcdtlCp30+Z08A=; b=cE/IkhWqaohuuGyQiuB4RoivejobsQrDPbY2UUd4Gh/vzn2liZZ2Qc9FbtaWYzu8WO piv/Mnt9nnLgLO4ls2tigRQ8yDg3VnZHsl/HqGG2WUfPCRjxsYkL5o3XTn2koQCyy85X yLbR5G+p2sfjUu42CxDbVrHJmkZHiDj8pk9eY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=u8eFwnEzbMjdPpfi+5GlsSnjxbqm4XcdtlCp30+Z08A=; b=Xvy7caRm4IPHDfNmtPxCiTw7XTLrmaI4VolKmCK/wy0bQPyNB8TRL7IOi+j3K9fkAE 1e8E7+wawp1aW+BRBC/yd4TNmwTGiFiJSuGcGHc+EPQHbuAmlvmYdzGqVrHjVLOYfc3F UgcVT/xNWyO2j5gxj57NvUX4Pe8AizjWjeOpoWJlsEWFwHbjQvaWWMuCkWHEiueYrgfe G4fKJ/STnnySlnqL9YaWcLjzufyNj8HA5lEJr++hluIMLvZ4OrWkvgYfzJpakSZjr+bA Ot5CFyHkSH2P2UDsoYTBtv61NDH1XR/Z8gqcHkiowdXH4IzQL9Lr3MENyxwRUI2nTBvd oATg== X-Gm-Message-State: ABuFfohlEAxEh8WFQwmFUf1MebaIW1YQujrphcE+HHOhmKM311lISqdU FTbO6kjQktMF0EDUI33wis+HIA== X-Google-Smtp-Source: ACcGV61Hfxv50FJ44RKxFsvSO+4E4i7+YusAc+f53xq2i8edQWUp24y0p4vRXmZ1YXLEzN0NzDpXig== X-Received: by 2002:a63:f64f:: with SMTP id u15-v6mr22481301pgj.258.1539734415469; Tue, 16 Oct 2018 17:00:15 -0700 (PDT) Received: from localhost ([2620:0:1000:1601:3aef:314f:b9ea:889f]) by smtp.gmail.com with ESMTPSA id l2-v6sm16200688pgp.20.2018.10.16.17.00.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Oct 2018 17:00:08 -0700 (PDT) Date: Tue, 16 Oct 2018 17:00:03 -0700 From: "Joel Fernandes (Google)" To: stable@vger.kernel.org Subject: [PATCH for-stable] dmaengine: stm32-dma: fix incomplete configuration in cyclic mode Message-ID: <20181017000003.GC140578@joelaf.mtv.corp.google.com> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181016_170026_608445_E5C41AC1 X-CRM114-Status: GOOD ( 11.89 ) 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 commit e57cb3b3f10d005410f09d4598cc6d62b833f2b0 upstream. 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); }