From: Vignesh Raghavendra <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 08/10] dma: ti: k3-udma: Fix ring push operation for 32 bit cores
Date: Mon, 9 Dec 2019 10:25:38 +0530 [thread overview]
Message-ID: <20191209045540.10702-9-vigneshr@ti.com> (raw)
In-Reply-To: <20191209045540.10702-1-vigneshr@ti.com>
UDMA always expects 64 bit address pointer of the transfer descriptor in
the Ring. But on 32 bit cores like R5, pointer is always 32 bit in size.
Therefore copy over 32 bit pointer value to 64 bit variable before
pushing it over to the ring, so that upper 32 bits are 0s.
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/dma/ti/k3-udma.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index 3c0ff571650a..56789e6eb5cc 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -1379,6 +1379,14 @@ static int udma_probe(struct udevice *dev)
return ret;
}
+static int udma_push_to_ring(struct k3_nav_ring *ring, void *elem)
+{
+ u64 addr = 0;
+
+ memcpy(&addr, &elem, sizeof(elem));
+ return k3_nav_ringacc_ring_push(ring, &addr);
+}
+
static int *udma_prep_dma_memcpy(struct udma_chan *uc, dma_addr_t dest,
dma_addr_t src, size_t len)
{
@@ -1470,7 +1478,7 @@ static int *udma_prep_dma_memcpy(struct udma_chan *uc, dma_addr_t dest,
ALIGN((u64)tr_desc + desc_size,
ARCH_DMA_MINALIGN));
- k3_nav_ringacc_ring_push(uc->tchan->t_ring, &tr_desc);
+ udma_push_to_ring(uc->tchan->t_ring, tr_desc);
return 0;
}
@@ -1640,7 +1648,7 @@ static int udma_send(struct dma *dma, void *src, size_t len, void *metadata)
ALIGN((u64)desc_tx + uc->hdesc_size,
ARCH_DMA_MINALIGN));
- ret = k3_nav_ringacc_ring_push(uc->tchan->t_ring, &uc->desc_tx);
+ ret = udma_push_to_ring(uc->tchan->t_ring, uc->desc_tx);
if (ret) {
dev_err(dma->dev, "TX dma push fail ch_id %lu %d\n",
dma->id, ret);
@@ -1799,7 +1807,7 @@ int udma_prepare_rcv_buf(struct dma *dma, void *dst, size_t size)
ALIGN((u64)desc_rx + uc->hdesc_size,
ARCH_DMA_MINALIGN));
- k3_nav_ringacc_ring_push(uc->rchan->fd_ring, &desc_rx);
+ udma_push_to_ring(uc->rchan->fd_ring, desc_rx);
uc->num_rx_bufs++;
uc->desc_rx_cur++;
--
2.24.0
next prev parent reply other threads:[~2019-12-09 4:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 4:55 [PATCH v4 00/10] dma: ti: k3-udma: Add support for J721e Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 01/10] lib: Import few bitmap functions from Linux Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 02/10] dma: ti: k3-udma: Query DMA channels allocated from Resource Manager Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 03/10] soc: ti: k3-navss-ringacc: Flush/invalidate caches on ring push/pop Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 04/10] soc: ti: k3-navss-ringacc: Get SYSFW reference from DT phandle Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 05/10] dma: ti: k3-udma: Remove coherency check for cache ops Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 06/10] dma: ti: k3-udma: Fix debug prints during enabling MEM_TO_DEV transfers Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 07/10] dma: ti: k3-udma: Switch to exposed ring mode Vignesh Raghavendra
2019-12-09 4:55 ` Vignesh Raghavendra [this message]
2019-12-09 4:55 ` [PATCH v4 09/10] dma: ti: k3-udma: Fix build warnings when building for 32 bit platforms Vignesh Raghavendra
2019-12-09 4:55 ` [PATCH v4 10/10] dma: ti: k3-udma: Add new compatible to J721e Vignesh Raghavendra
2020-01-20 5:58 ` [PATCH v4 00/10] dma: ti: k3-udma: Add support for J721e Lokesh Vutla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191209045540.10702-9-vigneshr@ti.com \
--to=vigneshr@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox