diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-04-14 21:32:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-16 05:34:52 -0400 |
commit | 009fda83ee2f38e5deb9d62fc54a904a92645fe4 (patch) | |
tree | ffc9cfe3d5f9b55a11d6087f63b85b082518161d /drivers | |
parent | 3644ee00c43cca08c9baac7eaea22250aaf84182 (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.c | 36 |
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 | ||
213 | static int fec_enet_open(struct net_device *dev); | ||
214 | static int fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev); | ||
215 | static void fec_enet_mii(struct net_device *dev); | 213 | static void fec_enet_mii(struct net_device *dev); |
216 | static irqreturn_t fec_enet_interrupt(int irq, void * dev_id); | 214 | static irqreturn_t fec_enet_interrupt(int irq, void * dev_id); |
217 | static void fec_enet_tx(struct net_device *dev); | 215 | static void fec_enet_tx(struct net_device *dev); |
218 | static void fec_enet_rx(struct net_device *dev); | 216 | static void fec_enet_rx(struct net_device *dev); |
219 | static int fec_enet_close(struct net_device *dev); | 217 | static int fec_enet_close(struct net_device *dev); |
220 | static void set_multicast_list(struct net_device *dev); | ||
221 | static void fec_restart(struct net_device *dev, int duplex); | 218 | static void fec_restart(struct net_device *dev, int duplex); |
222 | static void fec_stop(struct net_device *dev); | 219 | static void fec_stop(struct net_device *dev); |
223 | static 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. */ |
1546 | static void | 1541 | static int |
1547 | fec_set_mac_address(struct net_device *dev) | 1542 | fec_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 | ||
1560 | static 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); |