mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 7/8] usb: fsl_udc: Use dma_alloc_coherent() to get DMA address
Date: Mon, 27 May 2019 11:14:59 -0700	[thread overview]
Message-ID: <20190527181500.17456-7-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20190527181500.17456-1-andrew.smirnov@gmail.com>

Instead on relying virt_to_phys() to do virtual-to-physical address
conversion, make use of the fact that dma_alloc_coherent() can already
do that for us.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/usb/gadget/fsl_udc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c
index 705f6c0ba..a47ba20f4 100644
--- a/drivers/usb/gadget/fsl_udc.c
+++ b/drivers/usb/gadget/fsl_udc.c
@@ -1143,11 +1143,10 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
 			(unsigned)EP_MAX_LENGTH_TRANSFER);
 
 	dtd = dma_alloc_coherent(sizeof(struct ep_td_struct),
-				 DMA_ADDRESS_BROKEN);
+				 dma);
 	if (dtd == NULL)
 		return dtd;
 
-	*dma = (dma_addr_t)virt_to_phys(dtd);
 	dtd->td_dma = *dma;
 	/* Clear reserved field */
 	swap_temp = cpu_to_le32(dtd->size_ioc_sts);
@@ -2066,13 +2065,12 @@ static int struct_udc_setup(struct fsl_udc *udc,
 		size &= ~(QH_ALIGNMENT - 1);
 	}
 
-	udc->ep_qh = dma_alloc_coherent(size, DMA_ADDRESS_BROKEN);
+	udc->ep_qh = dma_alloc_coherent(size, &udc->ep_qh_dma);
 	if (!udc->ep_qh) {
 		ERR("malloc QHs for udc failed\n");
 		kfree(udc->eps);
 		return -1;
 	}
-	udc->ep_qh_dma = (dma_addr_t)virt_to_phys(udc->ep_qh);
 
 	udc->ep_qh_size = size;
 
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-05-27 18:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 18:14 [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Andrey Smirnov
2019-05-27 18:14 ` [PATCH 2/8] net: rtl8169: " Andrey Smirnov
2019-05-27 18:14 ` [PATCH 3/8] nand: nand_mxs: " Andrey Smirnov
2019-05-27 18:14 ` [PATCH 4/8] apbh: " Andrey Smirnov
2019-05-27 18:14 ` [PATCH 5/8] ahci: " Andrey Smirnov
2019-05-27 18:14 ` [PATCH 6/8] apbh: Use dma_alloc_coherent() to get DMA address Andrey Smirnov
2019-05-27 18:14 ` Andrey Smirnov [this message]
2019-05-27 18:15 ` [PATCH 8/8] usb: ohci: Add dependency on HAS_DMA Andrey Smirnov
2019-05-28  8:38 ` [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Sascha Hauer

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=20190527181500.17456-7-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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