From c6b70451646d468efc6e943558f72ec1ef6dc5ff Mon Sep 17 00:00:00 2001 From: Kedareswara rao Appana Date: Fri, 21 Aug 2015 11:10:55 +0530 Subject: [PATCH] axicdma: Handle cache flush/invalidate api's properly for a53 In a53 processor the Cache flush api does both fulsh and invalidate of the memory once the dma transfer is done before checking the data we shouldn't invalidate the memory unlike the a9/microblaze case this patch updates the axicdma examples for the same. Signed-off-by: Kedareswara rao Appana Acked-by: Kinjal Pravinbhai Patel --- .../examples/xaxicdma_example_simple_intr.c | 18 +++++++++++++++--- .../examples/xaxicdma_example_simple_poll.c | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_intr.c b/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_intr.c index d2b719a8..3e05721d 100644 --- a/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_intr.c +++ b/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_intr.c @@ -79,11 +79,18 @@ #include "xscugic.h" #endif -#ifndef __MICROBLAZE__ +#ifdef __MICROBLAZE__ #include "xpseudo_asm_gcc.h" +#endif + +#ifdef __arm__ #include "xreg_cortexa9.h" #endif +#ifdef __aarch64__ +#include "xreg_cortexa53.h" +#endif + /******************** Constant Definitions **********************************/ @@ -320,7 +327,10 @@ static int DoSimpleTransfer(XAxiCdma *InstancePtr, int Length, int Retries) /* Flush the SrcBuffer before the DMA transfer, in case the Data Cache * is enabled */ - Xil_DCacheFlushRange((u32)&SrcBuffer, Length); + Xil_DCacheFlushRange((UINTPTR)&SrcBuffer, Length); +#ifdef __aarch64__ + Xil_DCacheFlushRange((UINTPTR)&DestBuffer, Length); +#endif /* Try to start the DMA transfer */ @@ -353,7 +363,9 @@ static int DoSimpleTransfer(XAxiCdma *InstancePtr, int Length, int Retries) /* Invalidate the DestBuffer before receiving the data, in case the * Data Cache is enabled */ - Xil_DCacheInvalidateRange((u32)&DestBuffer, Length); +#ifndef __aarch64__ + Xil_DCacheInvalidateRange((UINTPTR)&DestBuffer,, Length); +#endif /* Transfer completes successfully, check data * diff --git a/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_poll.c b/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_poll.c index 9ad998e7..37511cbf 100644 --- a/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_poll.c +++ b/XilinxProcessorIPLib/drivers/axicdma/examples/xaxicdma_example_simple_poll.c @@ -259,6 +259,9 @@ static int DoSimplePollTransfer(XAxiCdma *InstancePtr, int Length, int Retries) * is enabled */ Xil_DCacheFlushRange((UINTPTR)&SrcBuffer, Length); +#ifdef __aarch64__ + Xil_DCacheFlushRange((UINTPTR)&DestBuffer, Length); +#endif /* Try to start the DMA transfer */