[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZS0aREGECQ7G+fry@matsya>
Date: Mon, 16 Oct 2023 16:41:00 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Amelie Delaunay <amelie.delaunay@...s.st.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
M'boumba Cedric Madianga <cedric.madianga@...il.com>,
Pierre-Yves MORDRET <pierre-yves.mordret@...com>,
stable@...r.kernel.org, dmaengine@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: stm32-mdma: correct desc prep when channel
running
On 09-10-23, 11:02, Alain Volmat wrote:
> Hi Amélie,
>
> thanks a lot.
>
> Tested-by: Alain Volmat <alain.volmat@...s.st.com>
Please **do ** not ** top post!
>
> Regards,
> Alain
>
> On Mon, Oct 09, 2023 at 10:24:50AM +0200, Amelie Delaunay wrote:
> > From: Alain Volmat <alain.volmat@...s.st.com>
> >
> > In case of the prep descriptor while the channel is already running, the
> > CCR register value stored into the channel could already have its EN bit
> > set. This would lead to a bad transfer since, at start transfer time,
> > enabling the channel while other registers aren't yet properly set.
> > To avoid this, ensure to mask the CCR_EN bit when storing the ccr value
> > into the mdma channel structure.
> >
> > Fixes: a4ffb13c8946 ("dmaengine: Add STM32 MDMA driver")
> > Signed-off-by: Alain Volmat <alain.volmat@...s.st.com>
> > Signed-off-by: Amelie Delaunay <amelie.delaunay@...s.st.com>
> > Cc: stable@...r.kernel.org
> > ---
> > drivers/dma/stm32-mdma.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c
> > index bae08b3f55c7..f414efdbd809 100644
> > --- a/drivers/dma/stm32-mdma.c
> > +++ b/drivers/dma/stm32-mdma.c
> > @@ -489,7 +489,7 @@ static int stm32_mdma_set_xfer_param(struct stm32_mdma_chan *chan,
> > src_maxburst = chan->dma_config.src_maxburst;
> > dst_maxburst = chan->dma_config.dst_maxburst;
> >
> > - ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id));
> > + ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & ~STM32_MDMA_CCR_EN;
> > ctcr = stm32_mdma_read(dmadev, STM32_MDMA_CTCR(chan->id));
> > ctbr = stm32_mdma_read(dmadev, STM32_MDMA_CTBR(chan->id));
> >
> > @@ -965,7 +965,7 @@ stm32_mdma_prep_dma_memcpy(struct dma_chan *c, dma_addr_t dest, dma_addr_t src,
> > if (!desc)
> > return NULL;
> >
> > - ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id));
> > + ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & ~STM32_MDMA_CCR_EN;
> > ctcr = stm32_mdma_read(dmadev, STM32_MDMA_CTCR(chan->id));
> > ctbr = stm32_mdma_read(dmadev, STM32_MDMA_CTBR(chan->id));
> > cbndtr = stm32_mdma_read(dmadev, STM32_MDMA_CBNDTR(chan->id));
> > --
> > 2.25.1
> >
--
~Vinod
Powered by blists - more mailing lists