diff options
author | David Vrabel <david.vrabel@csr.com> | 2008-11-19 09:48:07 -0500 |
---|---|---|
committer | David Vrabel <david.vrabel@csr.com> | 2008-11-19 09:48:07 -0500 |
commit | dba0a918722ee0f0ba3442575e4448c3ab622be4 (patch) | |
tree | fdb466cf09e7916135098d651b18924b2fe9ba5f /drivers/net/gianfar.c | |
parent | 0996e6382482ce9014787693d3884e9468153a5c (diff) | |
parent | 7f0f598a0069d1ab072375965a4b69137233169c (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-upstream
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r-- | drivers/net/gianfar.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 64b201134fdb..c4af949bf860 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -586,6 +586,18 @@ static void gfar_configure_serdes(struct net_device *dev) | |||
586 | struct gfar_mii __iomem *regs = | 586 | struct gfar_mii __iomem *regs = |
587 | (void __iomem *)&priv->regs->gfar_mii_regs; | 587 | (void __iomem *)&priv->regs->gfar_mii_regs; |
588 | int tbipa = gfar_read(&priv->regs->tbipa); | 588 | int tbipa = gfar_read(&priv->regs->tbipa); |
589 | struct mii_bus *bus = gfar_get_miibus(priv); | ||
590 | |||
591 | if (bus) | ||
592 | mutex_lock(&bus->mdio_lock); | ||
593 | |||
594 | /* If the link is already up, we must already be ok, and don't need to | ||
595 | * configure and reset the TBI<->SerDes link. Maybe U-Boot configured | ||
596 | * everything for us? Resetting it takes the link down and requires | ||
597 | * several seconds for it to come back. | ||
598 | */ | ||
599 | if (gfar_local_mdio_read(regs, tbipa, MII_BMSR) & BMSR_LSTATUS) | ||
600 | goto done; | ||
589 | 601 | ||
590 | /* Single clk mode, mii mode off(for serdes communication) */ | 602 | /* Single clk mode, mii mode off(for serdes communication) */ |
591 | gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); | 603 | gfar_local_mdio_write(regs, tbipa, MII_TBICON, TBICON_CLK_SELECT); |
@@ -596,6 +608,10 @@ static void gfar_configure_serdes(struct net_device *dev) | |||
596 | 608 | ||
597 | gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | | 609 | gfar_local_mdio_write(regs, tbipa, MII_BMCR, BMCR_ANENABLE | |
598 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); | 610 | BMCR_ANRESTART | BMCR_FULLDPLX | BMCR_SPEED1000); |
611 | |||
612 | done: | ||
613 | if (bus) | ||
614 | mutex_unlock(&bus->mdio_lock); | ||
599 | } | 615 | } |
600 | 616 | ||
601 | static void init_registers(struct net_device *dev) | 617 | static void init_registers(struct net_device *dev) |
@@ -1391,6 +1407,10 @@ static int gfar_clean_tx_ring(struct net_device *dev) | |||
1391 | if (bdp->status & TXBD_DEF) | 1407 | if (bdp->status & TXBD_DEF) |
1392 | dev->stats.collisions++; | 1408 | dev->stats.collisions++; |
1393 | 1409 | ||
1410 | /* Unmap the DMA memory */ | ||
1411 | dma_unmap_single(&priv->dev->dev, bdp->bufPtr, | ||
1412 | bdp->length, DMA_TO_DEVICE); | ||
1413 | |||
1394 | /* Free the sk buffer associated with this TxBD */ | 1414 | /* Free the sk buffer associated with this TxBD */ |
1395 | dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]); | 1415 | dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]); |
1396 | 1416 | ||
@@ -1650,6 +1670,9 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) | |||
1650 | 1670 | ||
1651 | skb = priv->rx_skbuff[priv->skb_currx]; | 1671 | skb = priv->rx_skbuff[priv->skb_currx]; |
1652 | 1672 | ||
1673 | dma_unmap_single(&priv->dev->dev, bdp->bufPtr, | ||
1674 | priv->rx_buffer_size, DMA_FROM_DEVICE); | ||
1675 | |||
1653 | /* We drop the frame if we failed to allocate a new buffer */ | 1676 | /* We drop the frame if we failed to allocate a new buffer */ |
1654 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || | 1677 | if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || |
1655 | bdp->status & RXBD_ERR)) { | 1678 | bdp->status & RXBD_ERR)) { |
@@ -1658,14 +1681,8 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit) | |||
1658 | if (unlikely(!newskb)) | 1681 | if (unlikely(!newskb)) |
1659 | newskb = skb; | 1682 | newskb = skb; |
1660 | 1683 | ||
1661 | if (skb) { | 1684 | if (skb) |
1662 | dma_unmap_single(&priv->dev->dev, | ||
1663 | bdp->bufPtr, | ||
1664 | priv->rx_buffer_size, | ||
1665 | DMA_FROM_DEVICE); | ||
1666 | |||
1667 | dev_kfree_skb_any(skb); | 1685 | dev_kfree_skb_any(skb); |
1668 | } | ||
1669 | } else { | 1686 | } else { |
1670 | /* Increment the number of packets */ | 1687 | /* Increment the number of packets */ |
1671 | dev->stats.rx_packets++; | 1688 | dev->stats.rx_packets++; |