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/myri_sbus.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/myri_sbus.c')
-rw-r--r-- | drivers/net/myri_sbus.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index c17462159d9d..858880b619ce 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -22,6 +22,7 @@ static char version[] = | |||
22 | #include <linux/etherdevice.h> | 22 | #include <linux/etherdevice.h> |
23 | #include <linux/skbuff.h> | 23 | #include <linux/skbuff.h> |
24 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
25 | #include <linux/dma-mapping.h> | ||
25 | 26 | ||
26 | #include <net/dst.h> | 27 | #include <net/dst.h> |
27 | #include <net/arp.h> | 28 | #include <net/arp.h> |
@@ -243,8 +244,8 @@ static void myri_clean_rings(struct myri_eth *mp) | |||
243 | u32 dma_addr; | 244 | u32 dma_addr; |
244 | 245 | ||
245 | dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); | 246 | dma_addr = sbus_readl(&rxd->myri_scatters[0].addr); |
246 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, | 247 | dma_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, |
247 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | 248 | RX_ALLOC_SIZE, DMA_FROM_DEVICE); |
248 | dev_kfree_skb(mp->rx_skbs[i]); | 249 | dev_kfree_skb(mp->rx_skbs[i]); |
249 | mp->rx_skbs[i] = NULL; | 250 | mp->rx_skbs[i] = NULL; |
250 | } | 251 | } |
@@ -260,9 +261,9 @@ static void myri_clean_rings(struct myri_eth *mp) | |||
260 | u32 dma_addr; | 261 | u32 dma_addr; |
261 | 262 | ||
262 | dma_addr = sbus_readl(&txd->myri_gathers[0].addr); | 263 | dma_addr = sbus_readl(&txd->myri_gathers[0].addr); |
263 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, | 264 | dma_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, |
264 | (skb->len + 3) & ~3, | 265 | (skb->len + 3) & ~3, |
265 | SBUS_DMA_TODEVICE); | 266 | DMA_TO_DEVICE); |
266 | dev_kfree_skb(mp->tx_skbs[i]); | 267 | dev_kfree_skb(mp->tx_skbs[i]); |
267 | mp->tx_skbs[i] = NULL; | 268 | mp->tx_skbs[i] = NULL; |
268 | } | 269 | } |
@@ -291,9 +292,9 @@ static void myri_init_rings(struct myri_eth *mp, int from_irq) | |||
291 | skb->dev = dev; | 292 | skb->dev = dev; |
292 | skb_put(skb, RX_ALLOC_SIZE); | 293 | skb_put(skb, RX_ALLOC_SIZE); |
293 | 294 | ||
294 | dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, | 295 | dma_addr = dma_map_single(&mp->myri_sdev->ofdev.dev, |
295 | skb->data, RX_ALLOC_SIZE, | 296 | skb->data, RX_ALLOC_SIZE, |
296 | SBUS_DMA_FROMDEVICE); | 297 | DMA_FROM_DEVICE); |
297 | sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr); | 298 | sbus_writel(dma_addr, &rxd[i].myri_scatters[0].addr); |
298 | sbus_writel(RX_ALLOC_SIZE, &rxd[i].myri_scatters[0].len); | 299 | sbus_writel(RX_ALLOC_SIZE, &rxd[i].myri_scatters[0].len); |
299 | sbus_writel(i, &rxd[i].ctx); | 300 | sbus_writel(i, &rxd[i].ctx); |
@@ -349,8 +350,8 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev) | |||
349 | 350 | ||
350 | DTX(("SKB[%d] ", entry)); | 351 | DTX(("SKB[%d] ", entry)); |
351 | dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr); | 352 | dma_addr = sbus_readl(&sq->myri_txd[entry].myri_gathers[0].addr); |
352 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, | 353 | dma_unmap_single(&mp->myri_sdev->ofdev.dev, dma_addr, |
353 | skb->len, SBUS_DMA_TODEVICE); | 354 | skb->len, DMA_TO_DEVICE); |
354 | dev_kfree_skb(skb); | 355 | dev_kfree_skb(skb); |
355 | mp->tx_skbs[entry] = NULL; | 356 | mp->tx_skbs[entry] = NULL; |
356 | dev->stats.tx_packets++; | 357 | dev->stats.tx_packets++; |
@@ -429,9 +430,9 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
429 | 430 | ||
430 | /* Check for errors. */ | 431 | /* Check for errors. */ |
431 | DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum)); | 432 | DRX(("rxd[%d]: %p len[%d] csum[%08x] ", entry, rxd, len, csum)); |
432 | sbus_dma_sync_single_for_cpu(&mp->myri_sdev->ofdev.dev, | 433 | dma_sync_single_for_cpu(&mp->myri_sdev->ofdev.dev, |
433 | sbus_readl(&rxd->myri_scatters[0].addr), | 434 | sbus_readl(&rxd->myri_scatters[0].addr), |
434 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | 435 | RX_ALLOC_SIZE, DMA_FROM_DEVICE); |
435 | if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { | 436 | if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { |
436 | DRX(("ERROR[")); | 437 | DRX(("ERROR[")); |
437 | dev->stats.rx_errors++; | 438 | dev->stats.rx_errors++; |
@@ -448,10 +449,10 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
448 | drops++; | 449 | drops++; |
449 | DRX(("DROP ")); | 450 | DRX(("DROP ")); |
450 | dev->stats.rx_dropped++; | 451 | dev->stats.rx_dropped++; |
451 | sbus_dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, | 452 | dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, |
452 | sbus_readl(&rxd->myri_scatters[0].addr), | 453 | sbus_readl(&rxd->myri_scatters[0].addr), |
453 | RX_ALLOC_SIZE, | 454 | RX_ALLOC_SIZE, |
454 | SBUS_DMA_FROMDEVICE); | 455 | DMA_FROM_DEVICE); |
455 | sbus_writel(RX_ALLOC_SIZE, &rxd->myri_scatters[0].len); | 456 | sbus_writel(RX_ALLOC_SIZE, &rxd->myri_scatters[0].len); |
456 | sbus_writel(index, &rxd->ctx); | 457 | sbus_writel(index, &rxd->ctx); |
457 | sbus_writel(1, &rxd->num_sg); | 458 | sbus_writel(1, &rxd->num_sg); |
@@ -470,17 +471,17 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
470 | DRX(("skb_alloc(FAILED) ")); | 471 | DRX(("skb_alloc(FAILED) ")); |
471 | goto drop_it; | 472 | goto drop_it; |
472 | } | 473 | } |
473 | sbus_unmap_single(&mp->myri_sdev->ofdev.dev, | 474 | dma_unmap_single(&mp->myri_sdev->ofdev.dev, |
474 | sbus_readl(&rxd->myri_scatters[0].addr), | 475 | sbus_readl(&rxd->myri_scatters[0].addr), |
475 | RX_ALLOC_SIZE, | 476 | RX_ALLOC_SIZE, |
476 | SBUS_DMA_FROMDEVICE); | 477 | DMA_FROM_DEVICE); |
477 | mp->rx_skbs[index] = new_skb; | 478 | mp->rx_skbs[index] = new_skb; |
478 | new_skb->dev = dev; | 479 | new_skb->dev = dev; |
479 | skb_put(new_skb, RX_ALLOC_SIZE); | 480 | skb_put(new_skb, RX_ALLOC_SIZE); |
480 | dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, | 481 | dma_addr = dma_map_single(&mp->myri_sdev->ofdev.dev, |
481 | new_skb->data, | 482 | new_skb->data, |
482 | RX_ALLOC_SIZE, | 483 | RX_ALLOC_SIZE, |
483 | SBUS_DMA_FROMDEVICE); | 484 | DMA_FROM_DEVICE); |
484 | sbus_writel(dma_addr, &rxd->myri_scatters[0].addr); | 485 | sbus_writel(dma_addr, &rxd->myri_scatters[0].addr); |
485 | sbus_writel(RX_ALLOC_SIZE, &rxd->myri_scatters[0].len); | 486 | sbus_writel(RX_ALLOC_SIZE, &rxd->myri_scatters[0].len); |
486 | sbus_writel(index, &rxd->ctx); | 487 | sbus_writel(index, &rxd->ctx); |
@@ -506,10 +507,10 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
506 | 507 | ||
507 | /* Reuse original ring buffer. */ | 508 | /* Reuse original ring buffer. */ |
508 | DRX(("reuse ")); | 509 | DRX(("reuse ")); |
509 | sbus_dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, | 510 | dma_sync_single_for_device(&mp->myri_sdev->ofdev.dev, |
510 | sbus_readl(&rxd->myri_scatters[0].addr), | 511 | sbus_readl(&rxd->myri_scatters[0].addr), |
511 | RX_ALLOC_SIZE, | 512 | RX_ALLOC_SIZE, |
512 | SBUS_DMA_FROMDEVICE); | 513 | DMA_FROM_DEVICE); |
513 | sbus_writel(RX_ALLOC_SIZE, &rxd->myri_scatters[0].len); | 514 | sbus_writel(RX_ALLOC_SIZE, &rxd->myri_scatters[0].len); |
514 | sbus_writel(index, &rxd->ctx); | 515 | sbus_writel(index, &rxd->ctx); |
515 | sbus_writel(1, &rxd->num_sg); | 516 | sbus_writel(1, &rxd->num_sg); |
@@ -658,8 +659,8 @@ static int myri_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
658 | sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]); | 659 | sbus_writew((skb->data[4] << 8) | skb->data[5], &txd->addr[3]); |
659 | } | 660 | } |
660 | 661 | ||
661 | dma_addr = sbus_map_single(&mp->myri_sdev->ofdev.dev, skb->data, | 662 | dma_addr = dma_map_single(&mp->myri_sdev->ofdev.dev, skb->data, |
662 | len, SBUS_DMA_TODEVICE); | 663 | len, DMA_TO_DEVICE); |
663 | sbus_writel(dma_addr, &txd->myri_gathers[0].addr); | 664 | sbus_writel(dma_addr, &txd->myri_gathers[0].addr); |
664 | sbus_writel(len, &txd->myri_gathers[0].len); | 665 | sbus_writel(len, &txd->myri_gathers[0].len); |
665 | sbus_writel(1, &txd->num_sg); | 666 | sbus_writel(1, &txd->num_sg); |