summaryrefslogtreecommitdiffstats
path: root/drivers/net/designware.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-03-09 08:32:21 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-09 08:32:21 +0100
commit4680b375b9dd32e6558ae2ee8a15b27819c70e73 (patch)
tree945cd90ff3557de600e6e208596c7ef846fb603e /drivers/net/designware.c
parent5544581e98d09c7c9008f9cac8cd25dbb6a14d6e (diff)
parent0e06a77f5b93d4479ff1b88bc32003ceaa37d152 (diff)
downloadbarebox-4680b375b9dd32e6558ae2ee8a15b27819c70e73.tar.gz
barebox-4680b375b9dd32e6558ae2ee8a15b27819c70e73.tar.xz
Merge branch 'for-next/streaming-dma'
Conflicts: drivers/mci/dw_mmc.c
Diffstat (limited to 'drivers/net/designware.c')
-rw-r--r--drivers/net/designware.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 29a6047c7f..1b16db5806 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -22,11 +22,11 @@
*/
#include <common.h>
+#include <dma.h>
#include <init.h>
#include <io.h>
#include <net.h>
#include <of_net.h>
-#include <asm/mmu.h>
#include <net/designware.h>
#include <linux/phy.h>
#include <linux/err.h>
@@ -196,8 +196,8 @@ static void rx_descs_init(struct eth_device *dev)
else
desc_p->dmamac_cntl |= DESC_RXCTRL_RXCHAIN;
- dma_inv_range((unsigned long)desc_p->dmamac_addr,
- (unsigned long)desc_p->dmamac_addr + CONFIG_ETH_BUFSIZE);
+ dma_sync_single_for_cpu((unsigned long)desc_p->dmamac_addr,
+ CONFIG_ETH_BUFSIZE, DMA_FROM_DEVICE);
desc_p->txrx_status = DESC_RXSTS_OWNBYDMA;
}
@@ -301,8 +301,8 @@ static int dwc_ether_send(struct eth_device *dev, void *packet, int length)
}
memcpy((void *)desc_p->dmamac_addr, packet, length);
- dma_flush_range((unsigned long)desc_p->dmamac_addr,
- (unsigned long)desc_p->dmamac_addr + length);
+ dma_sync_single_for_device((unsigned long)desc_p->dmamac_addr, length,
+ DMA_TO_DEVICE);
if (priv->enh_desc) {
desc_p->txrx_status |= DESC_ENH_TXSTS_TXFIRST | DESC_ENH_TXSTS_TXLAST;
@@ -327,6 +327,9 @@ static int dwc_ether_send(struct eth_device *dev, void *packet, int length)
/* Start the transmission */
writel(POLL_DATA, &dma_p->txpolldemand);
+ dma_sync_single_for_cpu((unsigned long)desc_p->dmamac_addr, length,
+ DMA_TO_DEVICE);
+
return 0;
}
@@ -350,10 +353,11 @@ static int dwc_ether_rx(struct eth_device *dev)
* Make the current descriptor valid again and go to
* the next one
*/
- dma_inv_range((unsigned long)desc_p->dmamac_addr,
- (unsigned long)desc_p->dmamac_addr + length);
-
+ dma_sync_single_for_cpu((unsigned long)desc_p->dmamac_addr, length,
+ DMA_FROM_DEVICE);
net_receive(dev, desc_p->dmamac_addr, length);
+ dma_sync_single_for_device((unsigned long)desc_p->dmamac_addr, length,
+ DMA_FROM_DEVICE);
desc_p->txrx_status |= DESC_RXSTS_OWNBYDMA;
@@ -451,9 +455,11 @@ static int dwc_ether_probe(struct device_d *dev)
dwc_version(dev, readl(&priv->mac_regs_p->version));
priv->dma_regs_p = base + DW_DMA_BASE_OFFSET;
priv->tx_mac_descrtable = dma_alloc_coherent(
- CONFIG_TX_DESCR_NUM * sizeof(struct dmamacdescr));
+ CONFIG_TX_DESCR_NUM * sizeof(struct dmamacdescr),
+ DMA_ADDRESS_BROKEN);
priv->rx_mac_descrtable = dma_alloc_coherent(
- CONFIG_RX_DESCR_NUM * sizeof(struct dmamacdescr));
+ CONFIG_RX_DESCR_NUM * sizeof(struct dmamacdescr),
+ DMA_ADDRESS_BROKEN);
priv->txbuffs = dma_alloc(TX_TOTAL_BUFSIZE);
priv->rxbuffs = dma_alloc(RX_TOTAL_BUFSIZE);