diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 21:09:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:13:15 -0400 |
commit | 738f2b7b813913e651f39387d007dd961755dee2 (patch) | |
tree | 022ca4d144cba51495e6f26a8f55d3046d16c2e3 /drivers/net/sunbmac.c | |
parent | 944c67dff7a88f0a775e5b604937f9e30d2de555 (diff) |
sparc: Convert all SBUS drivers to dma_*() interfaces.
And all the SBUS dma interfaces are deleted.
A private implementation remains inside of the 32-bit sparc port which
exists only for the sake of the implementation of dma_*().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sunbmac.c')
-rw-r--r-- | drivers/net/sunbmac.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index b92218c2f76c..8fe4c49b0623 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/etherdevice.h> | 23 | #include <linux/etherdevice.h> |
24 | #include <linux/skbuff.h> | 24 | #include <linux/skbuff.h> |
25 | #include <linux/bitops.h> | 25 | #include <linux/bitops.h> |
26 | #include <linux/dma-mapping.h> | ||
26 | 27 | ||
27 | #include <asm/auxio.h> | 28 | #include <asm/auxio.h> |
28 | #include <asm/byteorder.h> | 29 | #include <asm/byteorder.h> |
@@ -239,9 +240,10 @@ static void bigmac_init_rings(struct bigmac *bp, int from_irq) | |||
239 | skb_reserve(skb, 34); | 240 | skb_reserve(skb, 34); |
240 | 241 | ||
241 | bb->be_rxd[i].rx_addr = | 242 | bb->be_rxd[i].rx_addr = |
242 | sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data, | 243 | dma_map_single(&bp->bigmac_sdev->ofdev.dev, |
243 | RX_BUF_ALLOC_SIZE - 34, | 244 | skb->data, |
244 | SBUS_DMA_FROMDEVICE); | 245 | RX_BUF_ALLOC_SIZE - 34, |
246 | DMA_FROM_DEVICE); | ||
245 | bb->be_rxd[i].rx_flags = | 247 | bb->be_rxd[i].rx_flags = |
246 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); | 248 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); |
247 | } | 249 | } |
@@ -776,9 +778,9 @@ static void bigmac_tx(struct bigmac *bp) | |||
776 | skb = bp->tx_skbs[elem]; | 778 | skb = bp->tx_skbs[elem]; |
777 | bp->enet_stats.tx_packets++; | 779 | bp->enet_stats.tx_packets++; |
778 | bp->enet_stats.tx_bytes += skb->len; | 780 | bp->enet_stats.tx_bytes += skb->len; |
779 | sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev, | 781 | dma_unmap_single(&bp->bigmac_sdev->ofdev.dev, |
780 | this->tx_addr, skb->len, | 782 | this->tx_addr, skb->len, |
781 | SBUS_DMA_TODEVICE); | 783 | DMA_TO_DEVICE); |
782 | 784 | ||
783 | DTX(("skb(%p) ", skb)); | 785 | DTX(("skb(%p) ", skb)); |
784 | bp->tx_skbs[elem] = NULL; | 786 | bp->tx_skbs[elem] = NULL; |
@@ -831,19 +833,19 @@ static void bigmac_rx(struct bigmac *bp) | |||
831 | drops++; | 833 | drops++; |
832 | goto drop_it; | 834 | goto drop_it; |
833 | } | 835 | } |
834 | sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev, | 836 | dma_unmap_single(&bp->bigmac_sdev->ofdev.dev, |
835 | this->rx_addr, | 837 | this->rx_addr, |
836 | RX_BUF_ALLOC_SIZE - 34, | 838 | RX_BUF_ALLOC_SIZE - 34, |
837 | SBUS_DMA_FROMDEVICE); | 839 | DMA_FROM_DEVICE); |
838 | bp->rx_skbs[elem] = new_skb; | 840 | bp->rx_skbs[elem] = new_skb; |
839 | new_skb->dev = bp->dev; | 841 | new_skb->dev = bp->dev; |
840 | skb_put(new_skb, ETH_FRAME_LEN); | 842 | skb_put(new_skb, ETH_FRAME_LEN); |
841 | skb_reserve(new_skb, 34); | 843 | skb_reserve(new_skb, 34); |
842 | this->rx_addr = | 844 | this->rx_addr = |
843 | sbus_map_single(&bp->bigmac_sdev->ofdev.dev, | 845 | dma_map_single(&bp->bigmac_sdev->ofdev.dev, |
844 | new_skb->data, | 846 | new_skb->data, |
845 | RX_BUF_ALLOC_SIZE - 34, | 847 | RX_BUF_ALLOC_SIZE - 34, |
846 | SBUS_DMA_FROMDEVICE); | 848 | DMA_FROM_DEVICE); |
847 | this->rx_flags = | 849 | this->rx_flags = |
848 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); | 850 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); |
849 | 851 | ||
@@ -858,13 +860,13 @@ static void bigmac_rx(struct bigmac *bp) | |||
858 | } | 860 | } |
859 | skb_reserve(copy_skb, 2); | 861 | skb_reserve(copy_skb, 2); |
860 | skb_put(copy_skb, len); | 862 | skb_put(copy_skb, len); |
861 | sbus_dma_sync_single_for_cpu(&bp->bigmac_sdev->ofdev.dev, | 863 | dma_sync_single_for_cpu(&bp->bigmac_sdev->ofdev.dev, |
862 | this->rx_addr, len, | 864 | this->rx_addr, len, |
863 | SBUS_DMA_FROMDEVICE); | 865 | DMA_FROM_DEVICE); |
864 | skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len); | 866 | skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len); |
865 | sbus_dma_sync_single_for_device(&bp->bigmac_sdev->ofdev.dev, | 867 | dma_sync_single_for_device(&bp->bigmac_sdev->ofdev.dev, |
866 | this->rx_addr, len, | 868 | this->rx_addr, len, |
867 | SBUS_DMA_FROMDEVICE); | 869 | DMA_FROM_DEVICE); |
868 | 870 | ||
869 | /* Reuse original ring buffer. */ | 871 | /* Reuse original ring buffer. */ |
870 | this->rx_flags = | 872 | this->rx_flags = |
@@ -960,8 +962,8 @@ static int bigmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
960 | u32 mapping; | 962 | u32 mapping; |
961 | 963 | ||
962 | len = skb->len; | 964 | len = skb->len; |
963 | mapping = sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data, | 965 | mapping = dma_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data, |
964 | len, SBUS_DMA_TODEVICE); | 966 | len, DMA_TO_DEVICE); |
965 | 967 | ||
966 | /* Avoid a race... */ | 968 | /* Avoid a race... */ |
967 | spin_lock_irq(&bp->lock); | 969 | spin_lock_irq(&bp->lock); |
@@ -1185,9 +1187,9 @@ static int __devinit bigmac_ether_init(struct sbus_dev *qec_sdev) | |||
1185 | bigmac_stop(bp); | 1187 | bigmac_stop(bp); |
1186 | 1188 | ||
1187 | /* Allocate transmit/receive descriptor DVMA block. */ | 1189 | /* Allocate transmit/receive descriptor DVMA block. */ |
1188 | bp->bmac_block = sbus_alloc_consistent(&bp->bigmac_sdev->ofdev.dev, | 1190 | bp->bmac_block = dma_alloc_coherent(&bp->bigmac_sdev->ofdev.dev, |
1189 | PAGE_SIZE, | 1191 | PAGE_SIZE, |
1190 | &bp->bblock_dvma); | 1192 | &bp->bblock_dvma, GFP_ATOMIC); |
1191 | if (bp->bmac_block == NULL || bp->bblock_dvma == 0) { | 1193 | if (bp->bmac_block == NULL || bp->bblock_dvma == 0) { |
1192 | printk(KERN_ERR "BIGMAC: Cannot allocate consistent DMA.\n"); | 1194 | printk(KERN_ERR "BIGMAC: Cannot allocate consistent DMA.\n"); |
1193 | goto fail_and_cleanup; | 1195 | goto fail_and_cleanup; |
@@ -1247,10 +1249,10 @@ fail_and_cleanup: | |||
1247 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); | 1249 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); |
1248 | 1250 | ||
1249 | if (bp->bmac_block) | 1251 | if (bp->bmac_block) |
1250 | sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev, | 1252 | dma_free_coherent(&bp->bigmac_sdev->ofdev.dev, |
1251 | PAGE_SIZE, | 1253 | PAGE_SIZE, |
1252 | bp->bmac_block, | 1254 | bp->bmac_block, |
1253 | bp->bblock_dvma); | 1255 | bp->bblock_dvma); |
1254 | 1256 | ||
1255 | /* This also frees the co-located 'dev->priv' */ | 1257 | /* This also frees the co-located 'dev->priv' */ |
1256 | free_netdev(dev); | 1258 | free_netdev(dev); |
@@ -1282,10 +1284,10 @@ static int __devexit bigmac_sbus_remove(struct of_device *dev) | |||
1282 | sbus_iounmap(bp->creg, CREG_REG_SIZE); | 1284 | sbus_iounmap(bp->creg, CREG_REG_SIZE); |
1283 | sbus_iounmap(bp->bregs, BMAC_REG_SIZE); | 1285 | sbus_iounmap(bp->bregs, BMAC_REG_SIZE); |
1284 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); | 1286 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); |
1285 | sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev, | 1287 | dma_free_coherent(&bp->bigmac_sdev->ofdev.dev, |
1286 | PAGE_SIZE, | 1288 | PAGE_SIZE, |
1287 | bp->bmac_block, | 1289 | bp->bmac_block, |
1288 | bp->bblock_dvma); | 1290 | bp->bblock_dvma); |
1289 | 1291 | ||
1290 | free_netdev(net_dev); | 1292 | free_netdev(net_dev); |
1291 | 1293 | ||