stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH backport 4.4.y-4.8.z] dmaengine: at_xdmac: fix spurious flag status for mem2mem transfers
@ 2016-11-15 15:30 Nicolas Ferre
  2016-11-15 19:27 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Ferre @ 2016-11-15 15:30 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Ludovic Desroches; +Cc: Nicolas Ferre

From: Ludovic Desroches <ludovic.desroches@atmel.com>

commit 95da0c19d164f6df0b71a5187950f47d4b746e91 upstream.

When setting the channel configuration register, the perid field is not
set to 0 since it is useless for mem2mem transfers. Unfortunately, a
device has 0 as perid. It could cause spurious flags status because
the controller could mix some events from the two channels.
For that reason, use the highest perid value for mem2mem transfers since it
doesn't match the perid of other devices.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
[nicolas.ferre@atmel.com: backport to 4.4.y stable kernel]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/dma/at_xdmac.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index 9d05d7dbcfa9..66c073fc8afc 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -864,8 +864,12 @@ at_xdmac_interleaved_queue_desc(struct dma_chan *chan,
 	 * access. Hopefully we can access DDR through both ports (at least on
 	 * SAMA5D4x), so we can use the same interface for source and dest,
 	 * that solves the fact we don't know the direction.
+	 * ERRATA: Even if useless for memory transfers, the PERID has to not
+	 * match the one of another channel. If not, it could lead to spurious
+	 * flag status.
 	 */
-	u32			chan_cc = AT_XDMAC_CC_DIF(0)
+	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
+					| AT_XDMAC_CC_DIF(0)
 					| AT_XDMAC_CC_SIF(0)
 					| AT_XDMAC_CC_MBSIZE_SIXTEEN
 					| AT_XDMAC_CC_TYPE_MEM_TRAN;
@@ -1042,8 +1046,12 @@ at_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 	 * access DDR through both ports (at least on SAMA5D4x), so we can use
 	 * the same interface for source and dest, that solves the fact we
 	 * don't know the direction.
+	 * ERRATA: Even if useless for memory transfers, the PERID has to not
+	 * match the one of another channel. If not, it could lead to spurious
+	 * flag status.
 	 */
-	u32			chan_cc = AT_XDMAC_CC_DAM_INCREMENTED_AM
+	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
+					| AT_XDMAC_CC_DAM_INCREMENTED_AM
 					| AT_XDMAC_CC_SAM_INCREMENTED_AM
 					| AT_XDMAC_CC_DIF(0)
 					| AT_XDMAC_CC_SIF(0)
@@ -1144,8 +1152,12 @@ static struct at_xdmac_desc *at_xdmac_memset_create_desc(struct dma_chan *chan,
 	 * access. Hopefully we can access DDR through both ports (at least on
 	 * SAMA5D4x), so we can use the same interface for source and dest,
 	 * that solves the fact we don't know the direction.
+	 * ERRATA: Even if useless for memory transfers, the PERID has to not
+	 * match the one of another channel. If not, it could lead to spurious
+	 * flag status.
 	 */
-	u32			chan_cc = AT_XDMAC_CC_DAM_UBS_AM
+	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
+					| AT_XDMAC_CC_DAM_UBS_AM
 					| AT_XDMAC_CC_SAM_INCREMENTED_AM
 					| AT_XDMAC_CC_DIF(0)
 					| AT_XDMAC_CC_SIF(0)
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH backport 4.4.y-4.8.z] dmaengine: at_xdmac: fix spurious flag status for mem2mem transfers
  2016-11-15 15:30 [PATCH backport 4.4.y-4.8.z] dmaengine: at_xdmac: fix spurious flag status for mem2mem transfers Nicolas Ferre
@ 2016-11-15 19:27 ` Greg Kroah-Hartman
  2016-11-16  8:44   ` Nicolas Ferre
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2016-11-15 19:27 UTC (permalink / raw)
  To: Nicolas Ferre; +Cc: stable, Ludovic Desroches

On Tue, Nov 15, 2016 at 04:30:48PM +0100, Nicolas Ferre wrote:
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> commit 95da0c19d164f6df0b71a5187950f47d4b746e91 upstream.
> 
> When setting the channel configuration register, the perid field is not
> set to 0 since it is useless for mem2mem transfers. Unfortunately, a
> device has 0 as perid. It could cause spurious flags status because
> the controller could mix some events from the two channels.
> For that reason, use the highest perid value for mem2mem transfers since it
> doesn't match the perid of other devices.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> [nicolas.ferre@atmel.com: backport to 4.4.y stable kernel]

Why does your subject say 4.4.y-4.8.y when this patch showed up in
4.5-rc1?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH backport 4.4.y-4.8.z] dmaengine: at_xdmac: fix spurious flag status for mem2mem transfers
  2016-11-15 19:27 ` Greg Kroah-Hartman
@ 2016-11-16  8:44   ` Nicolas Ferre
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2016-11-16  8:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: stable, Ludovic Desroches

Le 15/11/2016 � 20:27, Greg Kroah-Hartman a �crit :
> On Tue, Nov 15, 2016 at 04:30:48PM +0100, Nicolas Ferre wrote:
>> From: Ludovic Desroches <ludovic.desroches@atmel.com>
>>
>> commit 95da0c19d164f6df0b71a5187950f47d4b746e91 upstream.
>>
>> When setting the channel configuration register, the perid field is not
>> set to 0 since it is useless for mem2mem transfers. Unfortunately, a
>> device has 0 as perid. It could cause spurious flags status because
>> the controller could mix some events from the two channels.
>> For that reason, use the highest perid value for mem2mem transfers since it
>> doesn't match the perid of other devices.
>>
>> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
>> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
>> [nicolas.ferre@atmel.com: backport to 4.4.y stable kernel]
> 
> Why does your subject say 4.4.y-4.8.y when this patch showed up in
> 4.5-rc1?

True. I mixed-up kernel revision numbers while checking where this patch
should apply (4.4.8 vs. 4.8.8) and didn't double check with original
commit ID: wrong!

Sorry for the confusion Gerg.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-16  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-15 15:30 [PATCH backport 4.4.y-4.8.z] dmaengine: at_xdmac: fix spurious flag status for mem2mem transfers Nicolas Ferre
2016-11-15 19:27 ` Greg Kroah-Hartman
2016-11-16  8:44   ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).