diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 21:37:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:13:12 -0400 |
commit | 7a715f46012f3552294154978aed59cba9804928 (patch) | |
tree | 9e7079ae4ad370b63ac6c8a4face573d6cf60533 /drivers/net/sunbmac.c | |
parent | 5778002874de0fb7e3d8c4a0a4afb6b1a6297069 (diff) |
sparc: Make SBUS DMA interfaces take struct device.
This is the first step in converting all the SBUS drivers
over to generic dma_*().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sunbmac.c')
-rw-r--r-- | drivers/net/sunbmac.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index 0e4a88d16327..b92218c2f76c 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c | |||
@@ -239,7 +239,7 @@ static void bigmac_init_rings(struct bigmac *bp, int from_irq) | |||
239 | skb_reserve(skb, 34); | 239 | skb_reserve(skb, 34); |
240 | 240 | ||
241 | bb->be_rxd[i].rx_addr = | 241 | bb->be_rxd[i].rx_addr = |
242 | sbus_map_single(bp->bigmac_sdev, skb->data, | 242 | sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data, |
243 | RX_BUF_ALLOC_SIZE - 34, | 243 | RX_BUF_ALLOC_SIZE - 34, |
244 | SBUS_DMA_FROMDEVICE); | 244 | SBUS_DMA_FROMDEVICE); |
245 | bb->be_rxd[i].rx_flags = | 245 | bb->be_rxd[i].rx_flags = |
@@ -776,7 +776,7 @@ static void bigmac_tx(struct bigmac *bp) | |||
776 | skb = bp->tx_skbs[elem]; | 776 | skb = bp->tx_skbs[elem]; |
777 | bp->enet_stats.tx_packets++; | 777 | bp->enet_stats.tx_packets++; |
778 | bp->enet_stats.tx_bytes += skb->len; | 778 | bp->enet_stats.tx_bytes += skb->len; |
779 | sbus_unmap_single(bp->bigmac_sdev, | 779 | sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev, |
780 | this->tx_addr, skb->len, | 780 | this->tx_addr, skb->len, |
781 | SBUS_DMA_TODEVICE); | 781 | SBUS_DMA_TODEVICE); |
782 | 782 | ||
@@ -831,7 +831,7 @@ static void bigmac_rx(struct bigmac *bp) | |||
831 | drops++; | 831 | drops++; |
832 | goto drop_it; | 832 | goto drop_it; |
833 | } | 833 | } |
834 | sbus_unmap_single(bp->bigmac_sdev, | 834 | sbus_unmap_single(&bp->bigmac_sdev->ofdev.dev, |
835 | this->rx_addr, | 835 | this->rx_addr, |
836 | RX_BUF_ALLOC_SIZE - 34, | 836 | RX_BUF_ALLOC_SIZE - 34, |
837 | SBUS_DMA_FROMDEVICE); | 837 | SBUS_DMA_FROMDEVICE); |
@@ -839,10 +839,11 @@ static void bigmac_rx(struct bigmac *bp) | |||
839 | new_skb->dev = bp->dev; | 839 | new_skb->dev = bp->dev; |
840 | skb_put(new_skb, ETH_FRAME_LEN); | 840 | skb_put(new_skb, ETH_FRAME_LEN); |
841 | skb_reserve(new_skb, 34); | 841 | skb_reserve(new_skb, 34); |
842 | this->rx_addr = sbus_map_single(bp->bigmac_sdev, | 842 | this->rx_addr = |
843 | new_skb->data, | 843 | sbus_map_single(&bp->bigmac_sdev->ofdev.dev, |
844 | RX_BUF_ALLOC_SIZE - 34, | 844 | new_skb->data, |
845 | SBUS_DMA_FROMDEVICE); | 845 | RX_BUF_ALLOC_SIZE - 34, |
846 | SBUS_DMA_FROMDEVICE); | ||
846 | this->rx_flags = | 847 | this->rx_flags = |
847 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); | 848 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); |
848 | 849 | ||
@@ -857,11 +858,11 @@ static void bigmac_rx(struct bigmac *bp) | |||
857 | } | 858 | } |
858 | skb_reserve(copy_skb, 2); | 859 | skb_reserve(copy_skb, 2); |
859 | skb_put(copy_skb, len); | 860 | skb_put(copy_skb, len); |
860 | sbus_dma_sync_single_for_cpu(bp->bigmac_sdev, | 861 | sbus_dma_sync_single_for_cpu(&bp->bigmac_sdev->ofdev.dev, |
861 | this->rx_addr, len, | 862 | this->rx_addr, len, |
862 | SBUS_DMA_FROMDEVICE); | 863 | SBUS_DMA_FROMDEVICE); |
863 | skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len); | 864 | skb_copy_to_linear_data(copy_skb, (unsigned char *)skb->data, len); |
864 | sbus_dma_sync_single_for_device(bp->bigmac_sdev, | 865 | sbus_dma_sync_single_for_device(&bp->bigmac_sdev->ofdev.dev, |
865 | this->rx_addr, len, | 866 | this->rx_addr, len, |
866 | SBUS_DMA_FROMDEVICE); | 867 | SBUS_DMA_FROMDEVICE); |
867 | 868 | ||
@@ -959,7 +960,8 @@ static int bigmac_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
959 | u32 mapping; | 960 | u32 mapping; |
960 | 961 | ||
961 | len = skb->len; | 962 | len = skb->len; |
962 | mapping = sbus_map_single(bp->bigmac_sdev, skb->data, len, SBUS_DMA_TODEVICE); | 963 | mapping = sbus_map_single(&bp->bigmac_sdev->ofdev.dev, skb->data, |
964 | len, SBUS_DMA_TODEVICE); | ||
963 | 965 | ||
964 | /* Avoid a race... */ | 966 | /* Avoid a race... */ |
965 | spin_lock_irq(&bp->lock); | 967 | spin_lock_irq(&bp->lock); |
@@ -1183,7 +1185,7 @@ static int __devinit bigmac_ether_init(struct sbus_dev *qec_sdev) | |||
1183 | bigmac_stop(bp); | 1185 | bigmac_stop(bp); |
1184 | 1186 | ||
1185 | /* Allocate transmit/receive descriptor DVMA block. */ | 1187 | /* Allocate transmit/receive descriptor DVMA block. */ |
1186 | bp->bmac_block = sbus_alloc_consistent(bp->bigmac_sdev, | 1188 | bp->bmac_block = sbus_alloc_consistent(&bp->bigmac_sdev->ofdev.dev, |
1187 | PAGE_SIZE, | 1189 | PAGE_SIZE, |
1188 | &bp->bblock_dvma); | 1190 | &bp->bblock_dvma); |
1189 | if (bp->bmac_block == NULL || bp->bblock_dvma == 0) { | 1191 | if (bp->bmac_block == NULL || bp->bblock_dvma == 0) { |
@@ -1245,7 +1247,7 @@ fail_and_cleanup: | |||
1245 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); | 1247 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); |
1246 | 1248 | ||
1247 | if (bp->bmac_block) | 1249 | if (bp->bmac_block) |
1248 | sbus_free_consistent(bp->bigmac_sdev, | 1250 | sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev, |
1249 | PAGE_SIZE, | 1251 | PAGE_SIZE, |
1250 | bp->bmac_block, | 1252 | bp->bmac_block, |
1251 | bp->bblock_dvma); | 1253 | bp->bblock_dvma); |
@@ -1280,7 +1282,7 @@ static int __devexit bigmac_sbus_remove(struct of_device *dev) | |||
1280 | sbus_iounmap(bp->creg, CREG_REG_SIZE); | 1282 | sbus_iounmap(bp->creg, CREG_REG_SIZE); |
1281 | sbus_iounmap(bp->bregs, BMAC_REG_SIZE); | 1283 | sbus_iounmap(bp->bregs, BMAC_REG_SIZE); |
1282 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); | 1284 | sbus_iounmap(bp->tregs, TCVR_REG_SIZE); |
1283 | sbus_free_consistent(bp->bigmac_sdev, | 1285 | sbus_free_consistent(&bp->bigmac_sdev->ofdev.dev, |
1284 | PAGE_SIZE, | 1286 | PAGE_SIZE, |
1285 | bp->bmac_block, | 1287 | bp->bmac_block, |
1286 | bp->bblock_dvma); | 1288 | bp->bblock_dvma); |