From e26f3a079f539cbdd36e3f8fe232952bc935595f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 19 Apr 2016 19:57:22 +0200 Subject: [PATCH] axidma: use virtual address for access to BD in XAxiDma_UpdateBdRingCDesc() --- .../drivers/axidma/src/xaxidma_bdring.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/axidma/src/xaxidma_bdring.c b/XilinxProcessorIPLib/drivers/axidma/src/xaxidma_bdring.c index e9cf7fa4..5036f4fc 100644 --- a/XilinxProcessorIPLib/drivers/axidma/src/xaxidma_bdring.c +++ b/XilinxProcessorIPLib/drivers/axidma/src/xaxidma_bdring.c @@ -221,31 +221,31 @@ int XAxiDma_UpdateBdRingCDesc(XAxiDma_BdRing* RingPtr) if (!RingIndex) { XAxiDma_WriteReg(RegBase, XAXIDMA_CDESC_OFFSET, - (u32)(BdPtr & XAXIDMA_DESC_LSB_MASK)); + (XAXIDMA_VIRT_TO_PHYS(BdPtr) & XAXIDMA_DESC_LSB_MASK)); if (RingPtr->Addr_ext) XAxiDma_WriteReg(RegBase, XAXIDMA_CDESC_MSB_OFFSET, - UPPER_32_BITS(BdPtr)); + UPPER_32_BITS(XAXIDMA_VIRT_TO_PHYS(BdPtr))); } else { XAxiDma_WriteReg(RegBase, (XAXIDMA_RX_CDESC0_OFFSET + (RingIndex - 1) * XAXIDMA_RX_NDESC_OFFSET), - (u32)(BdPtr & XAXIDMA_DESC_LSB_MASK)); + (XAXIDMA_VIRT_TO_PHYS(BdPtr) & XAXIDMA_DESC_LSB_MASK)); if (RingPtr->Addr_ext) XAxiDma_WriteReg(RegBase, (XAXIDMA_RX_CDESC0_MSB_OFFSET + (RingIndex - 1) * XAXIDMA_RX_NDESC_OFFSET), - UPPER_32_BITS(BdPtr)); + UPPER_32_BITS(XAXIDMA_VIRT_TO_PHYS(BdPtr))); } } else { XAxiDma_WriteReg(RegBase, XAXIDMA_CDESC_OFFSET, - (u32)(BdPtr & XAXIDMA_DESC_LSB_MASK)); + (XAXIDMA_VIRT_TO_PHYS(BdPtr) & XAXIDMA_DESC_LSB_MASK)); if (RingPtr->Addr_ext) XAxiDma_WriteReg(RegBase, XAXIDMA_CDESC_MSB_OFFSET, - UPPER_32_BITS(BdPtr)); + UPPER_32_BITS(XAXIDMA_VIRT_TO_PHYS(BdPtr))); } } else { @@ -265,29 +265,29 @@ int XAxiDma_UpdateBdRingCDesc(XAxiDma_BdRing* RingPtr) if (RingPtr->IsRxChannel) { if (!RingIndex) { XAxiDma_WriteReg(RegBase, - XAXIDMA_CDESC_OFFSET,(u32) (BdPtr & XAXIDMA_DESC_LSB_MASK)); + XAXIDMA_CDESC_OFFSET,(XAXIDMA_VIRT_TO_PHYS(BdPtr) & XAXIDMA_DESC_LSB_MASK)); if (RingPtr->Addr_ext) XAxiDma_WriteReg(RegBase, XAXIDMA_CDESC_MSB_OFFSET, - UPPER_32_BITS(BdPtr)); + UPPER_32_BITS(XAXIDMA_VIRT_TO_PHYS(BdPtr))); } else { XAxiDma_WriteReg(RegBase, (XAXIDMA_RX_CDESC0_OFFSET + (RingIndex - 1) * XAXIDMA_RX_NDESC_OFFSET), - (u32)(BdPtr & XAXIDMA_DESC_LSB_MASK)); + (XAXIDMA_VIRT_TO_PHYS(BdPtr) & XAXIDMA_DESC_LSB_MASK)); if (RingPtr->Addr_ext) XAxiDma_WriteReg(RegBase, (XAXIDMA_RX_CDESC0_MSB_OFFSET + (RingIndex - 1) * XAXIDMA_RX_NDESC_OFFSET), - UPPER_32_BITS(BdPtr)); + UPPER_32_BITS(XAXIDMA_VIRT_TO_PHYS(BdPtr))); } } else { XAxiDma_WriteReg(RegBase, - XAXIDMA_CDESC_OFFSET, (u32)(BdPtr & XAXIDMA_DESC_LSB_MASK)); + XAXIDMA_CDESC_OFFSET, (XAXIDMA_VIRT_TO_PHYS(BdPtr) & XAXIDMA_DESC_LSB_MASK)); if (RingPtr->Addr_ext) XAxiDma_WriteReg(RegBase, XAXIDMA_CDESC_MSB_OFFSET, - UPPER_32_BITS(BdPtr)); + UPPER_32_BITS(XAXIDMA_VIRT_TO_PHYS(BdPtr))); } break; } @@ -471,7 +471,7 @@ u32 XAxiDma_BdRingCreate(XAxiDma_BdRing *RingPtr, UINTPTR PhysAddr, RingPtr->HwHead = (XAxiDma_Bd *) VirtAddr; RingPtr->HwTail = (XAxiDma_Bd *) VirtAddr; RingPtr->PostHead = (XAxiDma_Bd *) VirtAddr; - RingPtr->BdaRestart = (XAxiDma_Bd *) PhysAddr; + RingPtr->BdaRestart = (XAxiDma_Bd *) VirtAddr; return XST_SUCCESS; }