diff mbox series

[4/7] dmaengine: at_xdmac: adapt perid for mem2mem operations

Message ID 20200914140956.221432-5-eugen.hristev@microchip.com (mailing list archive)
State New, archived
Headers show
Series dmaengine: add support for sama7g5 based at_xdmac | expand

Commit Message

Eugen Hristev Sept. 14, 2020, 2:09 p.m. UTC
The PERID in the CC register for mem2mem operations must match an unused
PERID.
The PERID field is 7 bits, but the selected value is 0x3f.
On later products we can have more reserved PERIDs for actual peripherals,
thus this needs to be increased to maximum size.
Changing the value to 0x7f, which is the maximum for 7 bits field.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 drivers/dma/at_xdmac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Tudor Ambarus Sept. 23, 2020, 5:30 a.m. UTC | #1
On 9/14/20 5:09 PM, Eugen Hristev wrote:
> The PERID in the CC register for mem2mem operations must match an unused
> PERID.
> The PERID field is 7 bits, but the selected value is 0x3f.
> On later products we can have more reserved PERIDs for actual peripherals,
> thus this needs to be increased to maximum size.
> Changing the value to 0x7f, which is the maximum for 7 bits field.
> 

Maybe it is worth to explain that for memory-to-memory transfers, PERID
should be set to an unused peripheral ID, and the maximum value seems the
safest. Anyway with or without this addressed, one can add:

Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>

> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---
>  drivers/dma/at_xdmac.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index fab19e00a7be..81bb90206092 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -726,7 +726,7 @@ at_xdmac_interleaved_queue_desc(struct dma_chan *chan,
>  	 * match the one of another channel. If not, it could lead to spurious
>  	 * flag status.
>  	 */
> -	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
> +	u32			chan_cc = AT_XDMAC_CC_PERID(0x7f)
>  					| AT_XDMAC_CC_DIF(0)
>  					| AT_XDMAC_CC_SIF(0)
>  					| AT_XDMAC_CC_MBSIZE_SIXTEEN
> @@ -908,7 +908,7 @@ at_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
>  	 * match the one of another channel. If not, it could lead to spurious
>  	 * flag status.
>  	 */
> -	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
> +	u32			chan_cc = AT_XDMAC_CC_PERID(0x7f)
>  					| AT_XDMAC_CC_DAM_INCREMENTED_AM
>  					| AT_XDMAC_CC_SAM_INCREMENTED_AM
>  					| AT_XDMAC_CC_DIF(0)
> @@ -1014,7 +1014,7 @@ static struct at_xdmac_desc *at_xdmac_memset_create_desc(struct dma_chan *chan,
>  	 * match the one of another channel. If not, it could lead to spurious
>  	 * flag status.
>  	 */
> -	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
> +	u32			chan_cc = AT_XDMAC_CC_PERID(0x7f)
>  					| AT_XDMAC_CC_DAM_UBS_AM
>  					| AT_XDMAC_CC_SAM_INCREMENTED_AM
>  					| AT_XDMAC_CC_DIF(0)
>
Tudor Ambarus Sept. 23, 2020, 5:35 a.m. UTC | #2
On 9/23/20 8:30 AM, Tudor Ambarus - M18064 wrote:
> On 9/14/20 5:09 PM, Eugen Hristev wrote:
>> The PERID in the CC register for mem2mem operations must match an unused
>> PERID.
>> The PERID field is 7 bits, but the selected value is 0x3f.
>> On later products we can have more reserved PERIDs for actual peripherals,
>> thus this needs to be increased to maximum size.
>> Changing the value to 0x7f, which is the maximum for 7 bits field.
>>
> 
> Maybe it is worth to explain that for memory-to-memory transfers, PERID
> should be set to an unused peripheral ID, and the maximum value seems the
> safest. Anyway with or without this addressed, one can add:
> 

:) I somehow misread your commit message, you already described that, it's fine.

> Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> 
>> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
>> ---
>>  drivers/dma/at_xdmac.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
diff mbox series

Patch

diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
index fab19e00a7be..81bb90206092 100644
--- a/drivers/dma/at_xdmac.c
+++ b/drivers/dma/at_xdmac.c
@@ -726,7 +726,7 @@  at_xdmac_interleaved_queue_desc(struct dma_chan *chan,
 	 * match the one of another channel. If not, it could lead to spurious
 	 * flag status.
 	 */
-	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
+	u32			chan_cc = AT_XDMAC_CC_PERID(0x7f)
 					| AT_XDMAC_CC_DIF(0)
 					| AT_XDMAC_CC_SIF(0)
 					| AT_XDMAC_CC_MBSIZE_SIXTEEN
@@ -908,7 +908,7 @@  at_xdmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
 	 * match the one of another channel. If not, it could lead to spurious
 	 * flag status.
 	 */
-	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
+	u32			chan_cc = AT_XDMAC_CC_PERID(0x7f)
 					| AT_XDMAC_CC_DAM_INCREMENTED_AM
 					| AT_XDMAC_CC_SAM_INCREMENTED_AM
 					| AT_XDMAC_CC_DIF(0)
@@ -1014,7 +1014,7 @@  static struct at_xdmac_desc *at_xdmac_memset_create_desc(struct dma_chan *chan,
 	 * match the one of another channel. If not, it could lead to spurious
 	 * flag status.
 	 */
-	u32			chan_cc = AT_XDMAC_CC_PERID(0x3f)
+	u32			chan_cc = AT_XDMAC_CC_PERID(0x7f)
 					| AT_XDMAC_CC_DAM_UBS_AM
 					| AT_XDMAC_CC_SAM_INCREMENTED_AM
 					| AT_XDMAC_CC_DIF(0)