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 | |
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')
-rw-r--r-- | drivers/net/myri_sbus.c | 27 | ||||
-rw-r--r-- | drivers/net/sunbmac.c | 28 | ||||
-rw-r--r-- | drivers/net/sunhme.c | 36 | ||||
-rw-r--r-- | drivers/net/sunhme.h | 1 | ||||
-rw-r--r-- | drivers/net/sunlance.c | 5 | ||||
-rw-r--r-- | drivers/net/sunqe.c | 12 |
6 files changed, 61 insertions, 48 deletions
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index 656a260fc956..c17462159d9d 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -243,7 +243,8 @@ static void myri_clean_rings(struct myri_eth *mp) | |||
243 | u32 dma_addr; | 243 | u32 dma_addr; |
244 | 244 | ||
245 | dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); | 245 | dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); |
246 | sbus_unmap_single(mp->myri_sdev, dma_addr, RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | 246 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, |
247 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | ||
247 | dev_kfree_skb(mp->rx_skbs[i]); | 248 | dev_kfree_skb(mp->rx_skbs[i]); |
248 | mp->rx_skbs[i] = NULL; | 249 | mp->rx_skbs[i] = NULL; |
249 | } | 250 | } |
@@ -259,7 +260,9 @@ static void myri_clean_rings(struct myri_eth *mp) | |||
259 | u32 dma_addr; | 260 | u32 dma_addr; |
260 | 261 | ||
261 | dma_addr = sbus_readl(&txd->myri_gathers[0].addr); | 262 | dma_addr = sbus_readl(&txd->myri_gathers[0].addr); |
262 | sbus_unmap_single(mp->myri_sdev, dma_addr, (skb->len + 3) & ~3, SBUS_DMA_TODEVICE); | 263 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, |
264 | (skb->len + 3) & ~3, | ||
265 | SBUS_DMA_TODEVICE); | ||
263 | dev_kfree_skb(mp->tx_skbs[i]); | 266 | dev_kfree_skb(mp->tx_skbs[i]); |
264 | mp->tx_skbs[i] = NULL; | 267 | mp->tx_skbs[i] = NULL; |
265 | } | 268 | } |
@@ -288,7 +291,9 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq) | |||
288 | skb->dev = dev; | 291 | skb->dev = dev; |
289 | skb_put(skb, RX_ALLOC_SIZE); | 292 | skb_put(skb, RX_ALLOC_SIZE); |
290 | 293 | ||
291 | dma_addr = sbus_map_single(mp->myri_sdev, skb->data, RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | 294 | dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, |
295 | skb->data, RX_ALLOC_SIZE, | ||
296 | SBUS_DMA_FROMDEVICE); | ||
292 | sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr); | 297 | sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr); |
293 | sbus_writel(RX_ALLOC_SIZE, &rxd[i].myri_scatters[0].len); | 298 | sbus_writel(RX_ALLOC_SIZE, &rxd[i].myri_scatters[0].len); |
294 | sbus_writel(i, &rxd[i].ctx); | 299 | sbus_writel(i, &rxd[i].ctx); |
@@ -344,7 +349,8 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev) | |||
344 | 349 | ||
345 | DTX(("SKB[%d] ", entry)); | 350 | DTX(("SKB[%d] ", entry)); |
346 | dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr); | 351 | dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr); |
347 | sbus_unmap_single(mp->myri_sdev, dma_addr, skb->len, SBUS_DMA_TODEVICE); | 352 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, |
353 | skb->len, SBUS_DMA_TODEVICE); | ||
348 | dev_kfree_skb(skb); | 354 | dev_kfree_skb(skb); |
349 | mp->tx_skbs[entry] = NULL; | 355 | mp->tx_skbs[entry] = NULL; |
350 | dev->stats.tx_packets++; | 356 | dev->stats.tx_packets++; |
@@ -423,7 +429,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
423 | 429 | ||
424 | /* Check for errors. */ | 430 | /* Check for errors. */ |
425 | DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum)); | 431 | DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum)); |
426 | sbus_dma_sync_single_for_cpu(mp->myri_sdev, | 432 | sbus_dma_sync_single_for_cpu(&mp->myri_sdev->ofdev.dev, |
427 | sbus_readl(&rxd->myri_scatters[0].addr), | 433 | sbus_readl(&rxd->myri_scatters[0].addr), |
428 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | 434 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); |
429 | if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { | 435 | if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { |
@@ -442,7 +448,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
442 | drops++; | 448 | drops++; |
443 | DRX(("DROP ")); | 449 | DRX(("DROP ")); |
444 | dev->stats.rx_dropped++; | 450 | dev->stats.rx_dropped++; |
445 | sbus_dma_sync_single_for_device(mp->myri_sdev, | 451 | sbus_dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, |
446 | sbus_readl(&rxd->myri_scatters[0].addr), | 452 | sbus_readl(&rxd->myri_scatters[0].addr), |
447 | RX_ALLOC_SIZE, | 453 | RX_ALLOC_SIZE, |
448 | SBUS_DMA_FROMDEVICE); | 454 | SBUS_DMA_FROMDEVICE); |
@@ -464,14 +470,14 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
464 | DRX(("skb_alloc(FAILED) ")); | 470 | DRX(("skb_alloc(FAILED) ")); |
465 | goto drop_it; | 471 | goto drop_it; |
466 | } | 472 | } |
467 | sbus_unmap_single(mp->myri_sdev, | 473 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, |
468 | sbus_readl(&rxd->myri_scatters[0].addr), | 474 | sbus_readl(&rxd->myri_scatters[0].addr), |
469 | RX_ALLOC_SIZE, | 475 | RX_ALLOC_SIZE, |
470 | SBUS_DMA_FROMDEVICE); | 476 | SBUS_DMA_FROMDEVICE); |
471 | mp->rx_skbs[index] = new_skb; | 477 | mp->rx_skbs[index] = new_skb; |
472 | new_skb->dev = dev; | 478 | new_skb->dev = dev; |
473 | skb_put(new_skb, RX_ALLOC_SIZE); | 479 | skb_put(new_skb, RX_ALLOC_SIZE); |
474 | dma_addr = sbus_map_single(mp->myri_sdev, | 480 | dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, |
475 | new_skb->data, | 481 | new_skb->data, |
476 | RX_ALLOC_SIZE, | 482 | RX_ALLOC_SIZE, |
477 | SBUS_DMA_FROMDEVICE); | 483 | SBUS_DMA_FROMDEVICE); |
@@ -500,7 +506,7 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
500 | 506 | ||
501 | /* Reuse original ring buffer. */ | 507 | /* Reuse original ring buffer. */ |
502 | DRX(("reuse ")); | 508 | DRX(("reuse ")); |
503 | sbus_dma_sync_single_for_device(mp->myri_sdev, | 509 | sbus_dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, |
504 | sbus_readl(&rxd->myri_scatters[0].addr), | 510 | sbus_readl(&rxd->myri_scatters[0].addr), |
505 | RX_ALLOC_SIZE, | 511 | RX_ALLOC_SIZE, |
506 | SBUS_DMA_FROMDEVICE); | 512 | SBUS_DMA_FROMDEVICE); |
@@ -652,7 +658,8 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
652 | sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]); | 658 | sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]); |
653 | } | 659 | } |
654 | 660 | ||
655 | dma_addr = sbus_map_single(mp->myri_sdev, skb->data, len, SBUS_DMA_TODEVICE); | 661 | dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, skb->data, |
662 | len, SBUS_DMA_TODEVICE); | ||
656 | sbus_writel(dma_addr, &txd->myri_gathers[0].addr); | 663 | sbus_writel(dma_addr, &txd->myri_gathers[0].addr); |
657 | sbus_writel(len, &txd->myri_gathers[0].len); | 664 | sbus_writel(len, &txd->myri_gathers[0].len); |
658 | sbus_writel(1, &txd->num_sg); | 665 | sbus_writel(1, &txd->num_sg); |
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); |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index b79d5f018f79..cd93fc5e826a 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
@@ -251,13 +251,13 @@ static u32 pci_hme_read_desc32(hme32 *p) | |||
251 | #define hme_read_desc32(__hp, __p) \ | 251 | #define hme_read_desc32(__hp, __p) \ |
252 | ((__hp)->read_desc32(__p)) | 252 | ((__hp)->read_desc32(__p)) |
253 | #define hme_dma_map(__hp, __ptr, __size, __dir) \ | 253 | #define hme_dma_map(__hp, __ptr, __size, __dir) \ |
254 | ((__hp)->dma_map((__hp)->happy_dev, (__ptr), (__size), (__dir))) | 254 | ((__hp)->dma_map((__hp)->dma_dev, (__ptr), (__size), (__dir))) |
255 | #define hme_dma_unmap(__hp, __addr, __size, __dir) \ | 255 | #define hme_dma_unmap(__hp, __addr, __size, __dir) \ |
256 | ((__hp)->dma_unmap((__hp)->happy_dev, (__addr), (__size), (__dir))) | 256 | ((__hp)->dma_unmap((__hp)->dma_dev, (__addr), (__size), (__dir))) |
257 | #define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ | 257 | #define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ |
258 | ((__hp)->dma_sync_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir))) | 258 | ((__hp)->dma_sync_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir))) |
259 | #define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ | 259 | #define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ |
260 | ((__hp)->dma_sync_for_device((__hp)->happy_dev, (__addr), (__size), (__dir))) | 260 | ((__hp)->dma_sync_for_device((__hp)->dma_dev, (__addr), (__size), (__dir))) |
261 | #else | 261 | #else |
262 | #ifdef CONFIG_SBUS | 262 | #ifdef CONFIG_SBUS |
263 | /* SBUS only compilation */ | 263 | /* SBUS only compilation */ |
@@ -277,13 +277,13 @@ do { (__txd)->tx_addr = (__force hme32)(u32)(__addr); \ | |||
277 | } while(0) | 277 | } while(0) |
278 | #define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p)) | 278 | #define hme_read_desc32(__hp, __p) ((__force u32)(hme32)*(__p)) |
279 | #define hme_dma_map(__hp, __ptr, __size, __dir) \ | 279 | #define hme_dma_map(__hp, __ptr, __size, __dir) \ |
280 | sbus_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) | 280 | sbus_map_single((__hp)->dma_dev, (__ptr), (__size), (__dir)) |
281 | #define hme_dma_unmap(__hp, __addr, __size, __dir) \ | 281 | #define hme_dma_unmap(__hp, __addr, __size, __dir) \ |
282 | sbus_unmap_single((__hp)->happy_dev, (__addr), (__size), (__dir)) | 282 | sbus_unmap_single((__hp)->dma_dev, (__addr), (__size), (__dir)) |
283 | #define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ | 283 | #define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ |
284 | sbus_dma_sync_single_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir)) | 284 | sbus_dma_sync_single_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir)) |
285 | #define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ | 285 | #define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ |
286 | sbus_dma_sync_single_for_device((__hp)->happy_dev, (__addr), (__size), (__dir)) | 286 | sbus_dma_sync_single_for_device((__hp)->dma_dev, (__addr), (__size), (__dir)) |
287 | #else | 287 | #else |
288 | /* PCI only compilation */ | 288 | /* PCI only compilation */ |
289 | #define hme_write32(__hp, __reg, __val) \ | 289 | #define hme_write32(__hp, __reg, __val) \ |
@@ -305,13 +305,13 @@ static inline u32 hme_read_desc32(struct happy_meal *hp, hme32 *p) | |||
305 | return le32_to_cpup((__le32 *)p); | 305 | return le32_to_cpup((__le32 *)p); |
306 | } | 306 | } |
307 | #define hme_dma_map(__hp, __ptr, __size, __dir) \ | 307 | #define hme_dma_map(__hp, __ptr, __size, __dir) \ |
308 | pci_map_single((__hp)->happy_dev, (__ptr), (__size), (__dir)) | 308 | pci_map_single((__hp)->dma_dev, (__ptr), (__size), (__dir)) |
309 | #define hme_dma_unmap(__hp, __addr, __size, __dir) \ | 309 | #define hme_dma_unmap(__hp, __addr, __size, __dir) \ |
310 | pci_unmap_single((__hp)->happy_dev, (__addr), (__size), (__dir)) | 310 | pci_unmap_single((__hp)->dma_dev, (__addr), (__size), (__dir)) |
311 | #define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ | 311 | #define hme_dma_sync_for_cpu(__hp, __addr, __size, __dir) \ |
312 | pci_dma_sync_single_for_cpu((__hp)->happy_dev, (__addr), (__size), (__dir)) | 312 | pci_dma_sync_single_for_cpu((__hp)->dma_dev, (__addr), (__size), (__dir)) |
313 | #define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ | 313 | #define hme_dma_sync_for_device(__hp, __addr, __size, __dir) \ |
314 | pci_dma_sync_single_for_device((__hp)->happy_dev, (__addr), (__size), (__dir)) | 314 | pci_dma_sync_single_for_device((__hp)->dma_dev, (__addr), (__size), (__dir)) |
315 | #endif | 315 | #endif |
316 | #endif | 316 | #endif |
317 | 317 | ||
@@ -2716,6 +2716,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe | |||
2716 | hp = dev->priv; | 2716 | hp = dev->priv; |
2717 | 2717 | ||
2718 | hp->happy_dev = sdev; | 2718 | hp->happy_dev = sdev; |
2719 | hp->dma_dev = &sdev->ofdev.dev; | ||
2719 | 2720 | ||
2720 | spin_lock_init(&hp->happy_lock); | 2721 | spin_lock_init(&hp->happy_lock); |
2721 | 2722 | ||
@@ -2785,7 +2786,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe | |||
2785 | hp->happy_bursts = of_getintprop_default(sdev->bus->ofdev.node, | 2786 | hp->happy_bursts = of_getintprop_default(sdev->bus->ofdev.node, |
2786 | "burst-sizes", 0x00); | 2787 | "burst-sizes", 0x00); |
2787 | 2788 | ||
2788 | hp->happy_block = sbus_alloc_consistent(hp->happy_dev, | 2789 | hp->happy_block = sbus_alloc_consistent(hp->dma_dev, |
2789 | PAGE_SIZE, | 2790 | PAGE_SIZE, |
2790 | &hp->hblock_dvma); | 2791 | &hp->hblock_dvma); |
2791 | err = -ENOMEM; | 2792 | err = -ENOMEM; |
@@ -2860,7 +2861,7 @@ static int __devinit happy_meal_sbus_probe_one(struct sbus_dev *sdev, int is_qfe | |||
2860 | return 0; | 2861 | return 0; |
2861 | 2862 | ||
2862 | err_out_free_consistent: | 2863 | err_out_free_consistent: |
2863 | sbus_free_consistent(hp->happy_dev, | 2864 | sbus_free_consistent(hp->dma_dev, |
2864 | PAGE_SIZE, | 2865 | PAGE_SIZE, |
2865 | hp->happy_block, | 2866 | hp->happy_block, |
2866 | hp->hblock_dvma); | 2867 | hp->hblock_dvma); |
@@ -3035,6 +3036,7 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev, | |||
3035 | memset(hp, 0, sizeof(*hp)); | 3036 | memset(hp, 0, sizeof(*hp)); |
3036 | 3037 | ||
3037 | hp->happy_dev = pdev; | 3038 | hp->happy_dev = pdev; |
3039 | hp->dma_dev = pdev; | ||
3038 | 3040 | ||
3039 | spin_lock_init(&hp->happy_lock); | 3041 | spin_lock_init(&hp->happy_lock); |
3040 | 3042 | ||
@@ -3231,12 +3233,12 @@ static void __devexit happy_meal_pci_remove(struct pci_dev *pdev) | |||
3231 | 3233 | ||
3232 | unregister_netdev(net_dev); | 3234 | unregister_netdev(net_dev); |
3233 | 3235 | ||
3234 | pci_free_consistent(hp->happy_dev, | 3236 | pci_free_consistent(hp->dma_dev, |
3235 | PAGE_SIZE, | 3237 | PAGE_SIZE, |
3236 | hp->happy_block, | 3238 | hp->happy_block, |
3237 | hp->hblock_dvma); | 3239 | hp->hblock_dvma); |
3238 | iounmap(hp->gregs); | 3240 | iounmap(hp->gregs); |
3239 | pci_release_regions(hp->happy_dev); | 3241 | pci_release_regions(hp->dma_dev); |
3240 | 3242 | ||
3241 | free_netdev(net_dev); | 3243 | free_netdev(net_dev); |
3242 | 3244 | ||
@@ -3306,7 +3308,7 @@ static int __devexit hme_sbus_remove(struct of_device *dev) | |||
3306 | sbus_iounmap(hp->erxregs, ERX_REG_SIZE); | 3308 | sbus_iounmap(hp->erxregs, ERX_REG_SIZE); |
3307 | sbus_iounmap(hp->bigmacregs, BMAC_REG_SIZE); | 3309 | sbus_iounmap(hp->bigmacregs, BMAC_REG_SIZE); |
3308 | sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE); | 3310 | sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE); |
3309 | sbus_free_consistent(hp->happy_dev, | 3311 | sbus_free_consistent(hp->dma_dev, |
3310 | PAGE_SIZE, | 3312 | PAGE_SIZE, |
3311 | hp->happy_block, | 3313 | hp->happy_block, |
3312 | hp->hblock_dvma); | 3314 | hp->hblock_dvma); |
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h index 4da5539fac7b..756e96e5ef4b 100644 --- a/drivers/net/sunhme.h +++ b/drivers/net/sunhme.h | |||
@@ -413,6 +413,7 @@ struct happy_meal { | |||
413 | 413 | ||
414 | /* This is either a sbus_dev or a pci_dev. */ | 414 | /* This is either a sbus_dev or a pci_dev. */ |
415 | void *happy_dev; | 415 | void *happy_dev; |
416 | void *dma_dev; | ||
416 | 417 | ||
417 | spinlock_t happy_lock; | 418 | spinlock_t happy_lock; |
418 | 419 | ||
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 24ffecb1ce23..4f4baf9f4ec8 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c | |||
@@ -1283,7 +1283,7 @@ static void lance_free_hwresources(struct lance_private *lp) | |||
1283 | sbus_iounmap(lp->init_block_iomem, | 1283 | sbus_iounmap(lp->init_block_iomem, |
1284 | sizeof(struct lance_init_block)); | 1284 | sizeof(struct lance_init_block)); |
1285 | } else if (lp->init_block_mem) { | 1285 | } else if (lp->init_block_mem) { |
1286 | sbus_free_consistent(lp->sdev, | 1286 | sbus_free_consistent(&lp->sdev->ofdev.dev, |
1287 | sizeof(struct lance_init_block), | 1287 | sizeof(struct lance_init_block), |
1288 | lp->init_block_mem, | 1288 | lp->init_block_mem, |
1289 | lp->init_block_dvma); | 1289 | lp->init_block_dvma); |
@@ -1384,7 +1384,8 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev, | |||
1384 | lp->tx = lance_tx_pio; | 1384 | lp->tx = lance_tx_pio; |
1385 | } else { | 1385 | } else { |
1386 | lp->init_block_mem = | 1386 | lp->init_block_mem = |
1387 | sbus_alloc_consistent(sdev, sizeof(struct lance_init_block), | 1387 | sbus_alloc_consistent(&sdev->ofdev.dev, |
1388 | sizeof(struct lance_init_block), | ||
1388 | &lp->init_block_dvma); | 1389 | &lp->init_block_dvma); |
1389 | if (!lp->init_block_mem || lp->init_block_dvma == 0) { | 1390 | if (!lp->init_block_mem || lp->init_block_dvma == 0) { |
1390 | printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n"); | 1391 | printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n"); |
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index e811331d4608..ac8049cab247 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c | |||
@@ -879,10 +879,10 @@ static int __devinit qec_ether_init(struct sbus_dev *sdev) | |||
879 | goto fail; | 879 | goto fail; |
880 | } | 880 | } |
881 | 881 | ||
882 | qe->qe_block = sbus_alloc_consistent(qe->qe_sdev, | 882 | qe->qe_block = sbus_alloc_consistent(&qe->qe_sdev->ofdev.dev, |
883 | PAGE_SIZE, | 883 | PAGE_SIZE, |
884 | &qe->qblock_dvma); | 884 | &qe->qblock_dvma); |
885 | qe->buffers = sbus_alloc_consistent(qe->qe_sdev, | 885 | qe->buffers = sbus_alloc_consistent(&qe->qe_sdev->ofdev.dev, |
886 | sizeof(struct sunqe_buffers), | 886 | sizeof(struct sunqe_buffers), |
887 | &qe->buffers_dvma); | 887 | &qe->buffers_dvma); |
888 | if (qe->qe_block == NULL || qe->qblock_dvma == 0 || | 888 | if (qe->qe_block == NULL || qe->qblock_dvma == 0 || |
@@ -926,12 +926,12 @@ fail: | |||
926 | if (qe->mregs) | 926 | if (qe->mregs) |
927 | sbus_iounmap(qe->mregs, MREGS_REG_SIZE); | 927 | sbus_iounmap(qe->mregs, MREGS_REG_SIZE); |
928 | if (qe->qe_block) | 928 | if (qe->qe_block) |
929 | sbus_free_consistent(qe->qe_sdev, | 929 | sbus_free_consistent(&qe->qe_sdev->ofdev.dev, |
930 | PAGE_SIZE, | 930 | PAGE_SIZE, |
931 | qe->qe_block, | 931 | qe->qe_block, |
932 | qe->qblock_dvma); | 932 | qe->qblock_dvma); |
933 | if (qe->buffers) | 933 | if (qe->buffers) |
934 | sbus_free_consistent(qe->qe_sdev, | 934 | sbus_free_consistent(&qe->qe_sdev->ofdev.dev, |
935 | sizeof(struct sunqe_buffers), | 935 | sizeof(struct sunqe_buffers), |
936 | qe->buffers, | 936 | qe->buffers, |
937 | qe->buffers_dvma); | 937 | qe->buffers_dvma); |
@@ -957,11 +957,11 @@ static int __devexit qec_sbus_remove(struct of_device *dev) | |||
957 | 957 | ||
958 | sbus_iounmap(qp->qcregs, CREG_REG_SIZE); | 958 | sbus_iounmap(qp->qcregs, CREG_REG_SIZE); |
959 | sbus_iounmap(qp->mregs, MREGS_REG_SIZE); | 959 | sbus_iounmap(qp->mregs, MREGS_REG_SIZE); |
960 | sbus_free_consistent(qp->qe_sdev, | 960 | sbus_free_consistent(&qp->qe_sdev->ofdev.dev, |
961 | PAGE_SIZE, | 961 | PAGE_SIZE, |
962 | qp->qe_block, | 962 | qp->qe_block, |
963 | qp->qblock_dvma); | 963 | qp->qblock_dvma); |
964 | sbus_free_consistent(qp->qe_sdev, | 964 | sbus_free_consistent(&qp->qe_sdev->ofdev.dev, |
965 | sizeof(struct sunqe_buffers), | 965 | sizeof(struct sunqe_buffers), |
966 | qp->buffers, | 966 | qp->buffers, |
967 | qp->buffers_dvma); | 967 | qp->buffers_dvma); |