aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/fec.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 16a1d58419d9..9a8743daa3e5 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1658,6 +1658,7 @@ static int fec_enet_init(struct net_device *dev, int index)
1658{ 1658{
1659 struct fec_enet_private *fep = netdev_priv(dev); 1659 struct fec_enet_private *fep = netdev_priv(dev);
1660 struct bufdesc *cbd_base; 1660 struct bufdesc *cbd_base;
1661 struct bufdesc *bdp;
1661 int i; 1662 int i;
1662 1663
1663 /* Allocate memory for buffer descriptors. */ 1664 /* Allocate memory for buffer descriptors. */
@@ -1710,6 +1711,34 @@ static int fec_enet_init(struct net_device *dev, int index)
1710 /* Set MII speed to 2.5 MHz */ 1711 /* Set MII speed to 2.5 MHz */
1711 fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999) 1712 fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999)
1712 / 2500000) / 2) & 0x3F) << 1; 1713 / 2500000) / 2) & 0x3F) << 1;
1714
1715 /* Initialize the receive buffer descriptors. */
1716 bdp = fep->rx_bd_base;
1717 for (i = 0; i < RX_RING_SIZE; i++) {
1718
1719 /* Initialize the BD for every fragment in the page. */
1720 bdp->cbd_sc = 0;
1721 bdp++;
1722 }
1723
1724 /* Set the last buffer to wrap */
1725 bdp--;
1726 bdp->cbd_sc |= BD_SC_WRAP;
1727
1728 /* ...and the same for transmit */
1729 bdp = fep->tx_bd_base;
1730 for (i = 0; i < TX_RING_SIZE; i++) {
1731
1732 /* Initialize the BD for every fragment in the page. */
1733 bdp->cbd_sc = 0;
1734 bdp->cbd_bufaddr = 0;
1735 bdp++;
1736 }
1737
1738 /* Set the last buffer to wrap */
1739 bdp--;
1740 bdp->cbd_sc |= BD_SC_WRAP;
1741
1713 fec_restart(dev, 0); 1742 fec_restart(dev, 0);
1714 1743
1715 /* Queue up command to detect the PHY and initialize the 1744 /* Queue up command to detect the PHY and initialize the
@@ -1730,7 +1759,6 @@ static void
1730fec_restart(struct net_device *dev, int duplex) 1759fec_restart(struct net_device *dev, int duplex)
1731{ 1760{
1732 struct fec_enet_private *fep = netdev_priv(dev); 1761 struct fec_enet_private *fep = netdev_priv(dev);
1733 struct bufdesc *bdp;
1734 int i; 1762 int i;
1735 1763
1736 /* Whack a reset. We should wait for this. */ 1764 /* Whack a reset. We should wait for this. */
@@ -1768,33 +1796,6 @@ fec_restart(struct net_device *dev, int duplex)
1768 } 1796 }
1769 } 1797 }
1770 1798
1771 /* Initialize the receive buffer descriptors. */
1772 bdp = fep->rx_bd_base;
1773 for (i = 0; i < RX_RING_SIZE; i++) {
1774
1775 /* Initialize the BD for every fragment in the page. */
1776 bdp->cbd_sc = BD_ENET_RX_EMPTY;
1777 bdp++;
1778 }
1779
1780 /* Set the last buffer to wrap */
1781 bdp--;
1782 bdp->cbd_sc |= BD_SC_WRAP;
1783
1784 /* ...and the same for transmit */
1785 bdp = fep->tx_bd_base;
1786 for (i = 0; i < TX_RING_SIZE; i++) {
1787
1788 /* Initialize the BD for every fragment in the page. */
1789 bdp->cbd_sc = 0;
1790 bdp->cbd_bufaddr = 0;
1791 bdp++;
1792 }
1793
1794 /* Set the last buffer to wrap */
1795 bdp--;
1796 bdp->cbd_sc |= BD_SC_WRAP;
1797
1798 /* Enable MII mode */ 1799 /* Enable MII mode */
1799 if (duplex) { 1800 if (duplex) {
1800 /* MII enable / FD enable */ 1801 /* MII enable / FD enable */