Commit 00718b23 authored by Christoph Hellwig's avatar Christoph Hellwig

lib82596: convert to dma_alloc_noncoherent

Use the new non-coherent DMA API including proper ownership transfers.
This includes moving the DMA helpers to lib82596 based of an ifdef to
avoid include order problems.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> (SNI part)
parent ed4bc189
...@@ -96,21 +96,14 @@ ...@@ -96,21 +96,14 @@
#define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */ #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */
#define DMA_WBACK(ndev, addr, len) \
do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0)
#define DMA_INV(ndev, addr, len) \
do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_FROM_DEVICE); } while (0)
#define DMA_WBACK_INV(ndev, addr, len) \
do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_BIDIRECTIONAL); } while (0)
#define SYSBUS 0x0000006c #define SYSBUS 0x0000006c
/* big endian CPU, 82596 "big" endian mode */ /* big endian CPU, 82596 "big" endian mode */
#define SWAP32(x) (((u32)(x)<<16) | ((((u32)(x)))>>16)) #define SWAP32(x) (((u32)(x)<<16) | ((((u32)(x)))>>16))
#define SWAP16(x) (x) #define SWAP16(x) (x)
#define NONCOHERENT_DMA 1
#include "lib82596.c" #include "lib82596.c"
MODULE_AUTHOR("Richard Hirst"); MODULE_AUTHOR("Richard Hirst");
...@@ -184,9 +177,9 @@ lan_init_chip(struct parisc_device *dev) ...@@ -184,9 +177,9 @@ lan_init_chip(struct parisc_device *dev)
lp = netdev_priv(netdevice); lp = netdev_priv(netdevice);
lp->options = dev->id.sversion == 0x72 ? OPT_SWAP_PORT : 0; lp->options = dev->id.sversion == 0x72 ? OPT_SWAP_PORT : 0;
lp->dma = dma_alloc_attrs(&dev->dev, sizeof(struct i596_dma), lp->dma = dma_alloc_noncoherent(&dev->dev,
&lp->dma_addr, GFP_KERNEL, sizeof(struct i596_dma), &lp->dma_addr,
DMA_ATTR_NON_CONSISTENT); DMA_BIDIRECTIONAL, GFP_KERNEL);
if (!lp->dma) if (!lp->dma)
goto out_free_netdev; goto out_free_netdev;
...@@ -196,8 +189,8 @@ lan_init_chip(struct parisc_device *dev) ...@@ -196,8 +189,8 @@ lan_init_chip(struct parisc_device *dev)
return 0; return 0;
out_free_dma: out_free_dma:
dma_free_attrs(&dev->dev, sizeof(struct i596_dma), lp->dma, dma_free_noncoherent(&dev->dev, sizeof(struct i596_dma),
lp->dma_addr, DMA_ATTR_NON_CONSISTENT); lp->dma, lp->dma_addr, DMA_BIDIRECTIONAL);
out_free_netdev: out_free_netdev:
free_netdev(netdevice); free_netdev(netdevice);
return retval; return retval;
...@@ -209,8 +202,8 @@ static int __exit lan_remove_chip(struct parisc_device *pdev) ...@@ -209,8 +202,8 @@ static int __exit lan_remove_chip(struct parisc_device *pdev)
struct i596_private *lp = netdev_priv(dev); struct i596_private *lp = netdev_priv(dev);
unregister_netdev (dev); unregister_netdev (dev);
dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma, dma_free_noncoherent(&pdev->dev, sizeof(struct i596_private), lp->dma,
lp->dma_addr, DMA_ATTR_NON_CONSISTENT); lp->dma_addr, DMA_BIDIRECTIONAL);
free_netdev (dev); free_netdev (dev);
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
static const char sni_82596_string[] = "snirm_82596"; static const char sni_82596_string[] = "snirm_82596";
#define DMA_WBACK(priv, addr, len) do { } while (0)
#define DMA_INV(priv, addr, len) do { } while (0)
#define DMA_WBACK_INV(priv, addr, len) do { } while (0)
#define SYSBUS 0x00004400 #define SYSBUS 0x00004400
/* big endian CPU, 82596 little endian */ /* big endian CPU, 82596 little endian */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment