diff options
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r-- | drivers/net/fec.c | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 16a1d58419d..d9d14c83f51 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -1128,6 +1128,26 @@ static phy_info_t phy_info_dp83848= { | |||
1128 | }, | 1128 | }, |
1129 | }; | 1129 | }; |
1130 | 1130 | ||
1131 | static phy_info_t phy_info_lan8700 = { | ||
1132 | 0x0007C0C, | ||
1133 | "LAN8700", | ||
1134 | (const phy_cmd_t []) { /* config */ | ||
1135 | { mk_mii_read(MII_REG_CR), mii_parse_cr }, | ||
1136 | { mk_mii_read(MII_REG_ANAR), mii_parse_anar }, | ||
1137 | { mk_mii_end, } | ||
1138 | }, | ||
1139 | (const phy_cmd_t []) { /* startup */ | ||
1140 | { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */ | ||
1141 | { mk_mii_read(MII_REG_SR), mii_parse_sr }, | ||
1142 | { mk_mii_end, } | ||
1143 | }, | ||
1144 | (const phy_cmd_t []) { /* act_int */ | ||
1145 | { mk_mii_end, } | ||
1146 | }, | ||
1147 | (const phy_cmd_t []) { /* shutdown */ | ||
1148 | { mk_mii_end, } | ||
1149 | }, | ||
1150 | }; | ||
1131 | /* ------------------------------------------------------------------------- */ | 1151 | /* ------------------------------------------------------------------------- */ |
1132 | 1152 | ||
1133 | static phy_info_t const * const phy_info[] = { | 1153 | static phy_info_t const * const phy_info[] = { |
@@ -1137,6 +1157,7 @@ static phy_info_t const * const phy_info[] = { | |||
1137 | &phy_info_am79c874, | 1157 | &phy_info_am79c874, |
1138 | &phy_info_ks8721bl, | 1158 | &phy_info_ks8721bl, |
1139 | &phy_info_dp83848, | 1159 | &phy_info_dp83848, |
1160 | &phy_info_lan8700, | ||
1140 | NULL | 1161 | NULL |
1141 | }; | 1162 | }; |
1142 | 1163 | ||
@@ -1585,7 +1606,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1585 | 1606 | ||
1586 | dmi = dev->mc_list; | 1607 | dmi = dev->mc_list; |
1587 | 1608 | ||
1588 | for (j = 0; j < dev->mc_count; j++, dmi = dmi->next) { | 1609 | for (j = 0; j < netdev_mc_count(dev); j++, dmi = dmi->next) { |
1589 | /* Only support group multicast for now */ | 1610 | /* Only support group multicast for now */ |
1590 | if (!(dmi->dmi_addr[0] & 1)) | 1611 | if (!(dmi->dmi_addr[0] & 1)) |
1591 | continue; | 1612 | continue; |
@@ -1658,6 +1679,7 @@ static int fec_enet_init(struct net_device *dev, int index) | |||
1658 | { | 1679 | { |
1659 | struct fec_enet_private *fep = netdev_priv(dev); | 1680 | struct fec_enet_private *fep = netdev_priv(dev); |
1660 | struct bufdesc *cbd_base; | 1681 | struct bufdesc *cbd_base; |
1682 | struct bufdesc *bdp; | ||
1661 | int i; | 1683 | int i; |
1662 | 1684 | ||
1663 | /* Allocate memory for buffer descriptors. */ | 1685 | /* Allocate memory for buffer descriptors. */ |
@@ -1710,6 +1732,34 @@ static int fec_enet_init(struct net_device *dev, int index) | |||
1710 | /* Set MII speed to 2.5 MHz */ | 1732 | /* Set MII speed to 2.5 MHz */ |
1711 | fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999) | 1733 | fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999) |
1712 | / 2500000) / 2) & 0x3F) << 1; | 1734 | / 2500000) / 2) & 0x3F) << 1; |
1735 | |||
1736 | /* Initialize the receive buffer descriptors. */ | ||
1737 | bdp = fep->rx_bd_base; | ||
1738 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
1739 | |||
1740 | /* Initialize the BD for every fragment in the page. */ | ||
1741 | bdp->cbd_sc = 0; | ||
1742 | bdp++; | ||
1743 | } | ||
1744 | |||
1745 | /* Set the last buffer to wrap */ | ||
1746 | bdp--; | ||
1747 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1748 | |||
1749 | /* ...and the same for transmit */ | ||
1750 | bdp = fep->tx_bd_base; | ||
1751 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1752 | |||
1753 | /* Initialize the BD for every fragment in the page. */ | ||
1754 | bdp->cbd_sc = 0; | ||
1755 | bdp->cbd_bufaddr = 0; | ||
1756 | bdp++; | ||
1757 | } | ||
1758 | |||
1759 | /* Set the last buffer to wrap */ | ||
1760 | bdp--; | ||
1761 | bdp->cbd_sc |= BD_SC_WRAP; | ||
1762 | |||
1713 | fec_restart(dev, 0); | 1763 | fec_restart(dev, 0); |
1714 | 1764 | ||
1715 | /* Queue up command to detect the PHY and initialize the | 1765 | /* Queue up command to detect the PHY and initialize the |
@@ -1730,7 +1780,6 @@ static void | |||
1730 | fec_restart(struct net_device *dev, int duplex) | 1780 | fec_restart(struct net_device *dev, int duplex) |
1731 | { | 1781 | { |
1732 | struct fec_enet_private *fep = netdev_priv(dev); | 1782 | struct fec_enet_private *fep = netdev_priv(dev); |
1733 | struct bufdesc *bdp; | ||
1734 | int i; | 1783 | int i; |
1735 | 1784 | ||
1736 | /* Whack a reset. We should wait for this. */ | 1785 | /* Whack a reset. We should wait for this. */ |
@@ -1768,33 +1817,6 @@ fec_restart(struct net_device *dev, int duplex) | |||
1768 | } | 1817 | } |
1769 | } | 1818 | } |
1770 | 1819 | ||
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 */ | 1820 | /* Enable MII mode */ |
1799 | if (duplex) { | 1821 | if (duplex) { |
1800 | /* MII enable / FD enable */ | 1822 | /* MII enable / FD enable */ |