* [PATCH 2/8] net: rtl8169: Do not zero out DMA coherent memory
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 ` Andrey Smirnov
2019-05-27 18:14 ` [PATCH 3/8] nand: nand_mxs: " Andrey Smirnov
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:14 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Memory returned by dma_alloc_coherent() should already be zeroed
out, so there's no need to do this explicitly.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/net/rtl8169.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 4e9823d42..80997dc89 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -227,9 +227,6 @@ static void rtl8169_init_ring(struct rtl8169_priv *priv)
dma_sync_single_for_device((unsigned long)priv->rx_buf,
NUM_RX_DESC * PKT_BUF_SIZE, DMA_FROM_DEVICE);
- memset((void *)priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
- memset((void *)priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
-
for (i = 0; i < NUM_RX_DESC; i++) {
if (i == (NUM_RX_DESC - 1))
priv->rx_desc[i].status =
--
2.21.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/8] nand: nand_mxs: Do not zero out DMA coherent memory
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 ` Andrey Smirnov
2019-05-27 18:14 ` [PATCH 4/8] apbh: " Andrey Smirnov
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:14 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Memory returned by dma_alloc_coherent() should already be zeroed
out, so there's no need to do this explicitly.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/mtd/nand/nand_mxs.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 28a07d4cb..c3b07aa3f 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -1271,8 +1271,6 @@ static int mxs_nand_alloc_buffers(struct mxs_nand_info *nand_info)
return -ENOMEM;
}
- memset(buf, 0, size);
-
nand_info->data_buf = buf;
nand_info->oob_buf = buf + NAND_MAX_PAGESIZE;
@@ -1284,7 +1282,6 @@ static int mxs_nand_alloc_buffers(struct mxs_nand_info *nand_info)
printf("MXS NAND: Error allocating command buffers\n");
return -ENOMEM;
}
- memset(nand_info->cmd_buf, 0, MXS_NAND_COMMAND_BUFFER_SIZE);
nand_info->cmd_queue_len = 0;
return 0;
--
2.21.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] apbh: Do not zero out DMA coherent memory
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 ` Andrey Smirnov
2019-05-27 18:14 ` [PATCH 5/8] ahci: " Andrey Smirnov
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:14 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Memory returned by dma_alloc_coherent() should already be zeroed
out, so there's no need to do this explicitly.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/dma/apbh_dma.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index 72c2f364c..15a523ac8 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -388,7 +388,6 @@ struct mxs_dma_desc *mxs_dma_desc_alloc(void)
if (pdesc == NULL)
return NULL;
- memset(pdesc, 0, sizeof(*pdesc));
pdesc->address = (dma_addr_t)pdesc;
return pdesc;
--
2.21.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/8] ahci: Do not zero out DMA coherent memory
2019-05-27 18:14 [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Andrey Smirnov
` (2 preceding siblings ...)
2019-05-27 18:14 ` [PATCH 4/8] apbh: " Andrey Smirnov
@ 2019-05-27 18:14 ` Andrey Smirnov
2019-05-27 18:14 ` [PATCH 6/8] apbh: Use dma_alloc_coherent() to get DMA address Andrey Smirnov
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:14 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Memory returned by dma_alloc_coherent() should already be zeroed
out, so there's no need to do this explicitly.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/ata/ahci.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e6723a337..7dc09d00c 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -342,10 +342,6 @@ static int ahci_init_port(struct ahci_port *ahci_port)
goto err_alloc2;
}
- memset(ahci_port->cmd_slot, 0, AHCI_CMD_SLOT_SZ * 32);
- memset((void *)ahci_port->rx_fis, 0, AHCI_RX_FIS_SZ);
- memset(ahci_port->cmd_tbl, 0, AHCI_CMD_TBL_SZ);
-
ahci_port_debug(ahci_port, "cmd_tbl_dma = 0x%p\n", ahci_port->cmd_tbl);
ahci_port->cmd_tbl_sg = ahci_port->cmd_tbl + AHCI_CMD_TBL_HDR_SZ;
--
2.21.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6/8] apbh: Use dma_alloc_coherent() to get DMA address
2019-05-27 18:14 [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Andrey Smirnov
` (3 preceding siblings ...)
2019-05-27 18:14 ` [PATCH 5/8] ahci: " Andrey Smirnov
@ 2019-05-27 18:14 ` Andrey Smirnov
2019-05-27 18:14 ` [PATCH 7/8] usb: fsl_udc: " Andrey Smirnov
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:14 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Avoid converting virtual address to physical by simple casting by
making use of the fact that dma_alloc_coherent() can already return
that information to us.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/dma/apbh_dma.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index 15a523ac8..3bee89f78 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -381,14 +381,15 @@ static int mxs_dma_release(int channel)
struct mxs_dma_desc *mxs_dma_desc_alloc(void)
{
struct mxs_dma_desc *pdesc;
+ dma_addr_t dma_address;
pdesc = dma_alloc_coherent(sizeof(struct mxs_dma_desc),
- DMA_ADDRESS_BROKEN);
+ &dma_address);
if (pdesc == NULL)
return NULL;
- pdesc->address = (dma_addr_t)pdesc;
+ pdesc->address = dma_address;
return pdesc;
};
--
2.21.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 7/8] usb: fsl_udc: Use dma_alloc_coherent() to get DMA address
2019-05-27 18:14 [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Andrey Smirnov
` (4 preceding siblings ...)
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
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
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:14 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 8/8] usb: ohci: Add dependency on HAS_DMA
2019-05-27 18:14 [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Andrey Smirnov
` (5 preceding siblings ...)
2019-05-27 18:14 ` [PATCH 7/8] usb: fsl_udc: " Andrey Smirnov
@ 2019-05-27 18:15 ` Andrey Smirnov
2019-05-28 8:38 ` [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Sascha Hauer
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Smirnov @ 2019-05-27 18:15 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
OHCI driver uses varios DMA API functions (dma_alloc_coherent()
et. al), so add dependency on HAS_DMA to indicate that.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
drivers/usb/host/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index db4405252..d2029bc7d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -15,7 +15,7 @@ config USB_EHCI_ATMEL
config USB_OHCI
bool "OHCI driver"
- depends on !MMU
+ depends on !MMU && HAS_DMA
config USB_OHCI_AT91
depends on ARCH_AT91
--
2.21.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory
2019-05-27 18:14 [PATCH 1/8] usb: ohci-hcd: Do not zero out DMA coherent memory Andrey Smirnov
` (6 preceding siblings ...)
2019-05-27 18:15 ` [PATCH 8/8] usb: ohci: Add dependency on HAS_DMA Andrey Smirnov
@ 2019-05-28 8:38 ` Sascha Hauer
7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2019-05-28 8:38 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Mon, May 27, 2019 at 11:14:53AM -0700, Andrey Smirnov wrote:
> Memory returned by dma_alloc_coherent() should already be zeroed
> out, so there's no need to do this explicitly.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> drivers/usb/host/ohci-hcd.c | 2 --
> 1 file changed, 2 deletions(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 9+ messages in thread