aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-04-14 21:32:23 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-16 05:34:52 -0400
commit009fda83ee2f38e5deb9d62fc54a904a92645fe4 (patch)
treeffc9cfe3d5f9b55a11d6087f63b85b082518161d /drivers
parent3644ee00c43cca08c9baac7eaea22250aaf84182 (diff)
fec: switch to net_device_ops
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fec.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 7b3e331dd442..54ee493768f1 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -210,17 +210,13 @@ struct fec_enet_private {
210 int full_duplex; 210 int full_duplex;
211}; 211};
212 212
213static int fec_enet_open(struct net_device *dev);
214static int fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev);
215static void fec_enet_mii(struct net_device *dev); 213static void fec_enet_mii(struct net_device *dev);
216static irqreturn_t fec_enet_interrupt(int irq, void * dev_id); 214static irqreturn_t fec_enet_interrupt(int irq, void * dev_id);
217static void fec_enet_tx(struct net_device *dev); 215static void fec_enet_tx(struct net_device *dev);
218static void fec_enet_rx(struct net_device *dev); 216static void fec_enet_rx(struct net_device *dev);
219static int fec_enet_close(struct net_device *dev); 217static int fec_enet_close(struct net_device *dev);
220static void set_multicast_list(struct net_device *dev);
221static void fec_restart(struct net_device *dev, int duplex); 218static void fec_restart(struct net_device *dev, int duplex);
222static void fec_stop(struct net_device *dev); 219static void fec_stop(struct net_device *dev);
223static void fec_set_mac_address(struct net_device *dev);
224 220
225 221
226/* MII processing. We keep this as simple as possible. Requests are 222/* MII processing. We keep this as simple as possible. Requests are
@@ -1410,7 +1406,6 @@ fec_enet_open(struct net_device *dev)
1410 /* I should reset the ring buffers here, but I don't yet know 1406 /* I should reset the ring buffers here, but I don't yet know
1411 * a simple way to do that. 1407 * a simple way to do that.
1412 */ 1408 */
1413 fec_set_mac_address(dev);
1414 1409
1415 fep->sequence_done = 0; 1410 fep->sequence_done = 0;
1416 fep->link = 0; 1411 fep->link = 0;
@@ -1543,19 +1538,35 @@ static void set_multicast_list(struct net_device *dev)
1543} 1538}
1544 1539
1545/* Set a MAC change in hardware. */ 1540/* Set a MAC change in hardware. */
1546static void 1541static int
1547fec_set_mac_address(struct net_device *dev) 1542fec_set_mac_address(struct net_device *dev, void *p)
1548{ 1543{
1549 struct fec_enet_private *fep = netdev_priv(dev); 1544 struct fec_enet_private *fep = netdev_priv(dev);
1545 struct sockaddr *addr = p;
1546
1547 if (!is_valid_ether_addr(addr->sa_data))
1548 return -EADDRNOTAVAIL;
1549
1550 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
1550 1551
1551 /* Set station address. */
1552 writel(dev->dev_addr[3] | (dev->dev_addr[2] << 8) | 1552 writel(dev->dev_addr[3] | (dev->dev_addr[2] << 8) |
1553 (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24), 1553 (dev->dev_addr[1] << 16) | (dev->dev_addr[0] << 24),
1554 fep->hwp + FEC_ADDR_LOW); 1554 fep->hwp + FEC_ADDR_LOW);
1555 writel((dev->dev_addr[5] << 16) | (dev->dev_addr[4] << 24), 1555 writel((dev->dev_addr[5] << 16) | (dev->dev_addr[4] << 24),
1556 fep + FEC_ADDR_HIGH); 1556 fep + FEC_ADDR_HIGH);
1557 return 0;
1557} 1558}
1558 1559
1560static const struct net_device_ops fec_netdev_ops = {
1561 .ndo_open = fec_enet_open,
1562 .ndo_stop = fec_enet_close,
1563 .ndo_start_xmit = fec_enet_start_xmit,
1564 .ndo_set_multicast_list = set_multicast_list,
1565 .ndo_validate_addr = eth_validate_addr,
1566 .ndo_tx_timeout = fec_timeout,
1567 .ndo_set_mac_address = fec_set_mac_address,
1568};
1569
1559 /* 1570 /*
1560 * XXX: We need to clean up on failure exits here. 1571 * XXX: We need to clean up on failure exits here.
1561 * 1572 *
@@ -1651,12 +1662,8 @@ int __init fec_enet_init(struct net_device *dev, int index)
1651 fec_request_mii_intr(dev); 1662 fec_request_mii_intr(dev);
1652#endif 1663#endif
1653 /* The FEC Ethernet specific entries in the device structure */ 1664 /* The FEC Ethernet specific entries in the device structure */
1654 dev->open = fec_enet_open;
1655 dev->hard_start_xmit = fec_enet_start_xmit;
1656 dev->tx_timeout = fec_timeout;
1657 dev->watchdog_timeo = TX_TIMEOUT; 1665 dev->watchdog_timeo = TX_TIMEOUT;
1658 dev->stop = fec_enet_close; 1666 dev->netdev_ops = &fec_netdev_ops;
1659 dev->set_multicast_list = set_multicast_list;
1660 1667
1661 for (i=0; i<NMII-1; i++) 1668 for (i=0; i<NMII-1; i++)
1662 mii_cmds[i].mii_next = &mii_cmds[i+1]; 1669 mii_cmds[i].mii_next = &mii_cmds[i+1];
@@ -1695,9 +1702,6 @@ fec_restart(struct net_device *dev, int duplex)
1695 /* Clear any outstanding interrupt. */ 1702 /* Clear any outstanding interrupt. */
1696 writel(0xffc00000, fep->hwp + FEC_IEVENT); 1703 writel(0xffc00000, fep->hwp + FEC_IEVENT);
1697 1704
1698 /* Set station address. */
1699 fec_set_mac_address(dev);
1700
1701 /* Reset all multicast. */ 1705 /* Reset all multicast. */
1702 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); 1706 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
1703 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW); 1707 writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);