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/myri_sbus.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/myri_sbus.c')
-rw-r--r-- | drivers/net/myri_sbus.c | 27 |
1 files changed, 17 insertions, 10 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); |