diff options
author | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-12-20 18:02:34 -0500 |
---|---|---|
committer | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-12-21 18:42:55 -0500 |
commit | 490b77224fe66c77ab7cb48d6b77e62cb55591a0 (patch) | |
tree | 3226880ee9dbe449b45cd1cea87a080b77d2009c | |
parent | 4954936e25cb8ce99a96cac9dd9417d7b639867a (diff) |
IXP4xx: Add ethtool support to Ethernet driver.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
-rw-r--r-- | drivers/net/arm/ixp4xx_eth.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c index 1bbb7b8cb0da..3f72eb66e7f1 100644 --- a/drivers/net/arm/ixp4xx_eth.c +++ b/drivers/net/arm/ixp4xx_eth.c | |||
@@ -170,6 +170,7 @@ struct port { | |||
170 | u32 desc_tab_phys; | 170 | u32 desc_tab_phys; |
171 | int id; /* logical port ID */ | 171 | int id; /* logical port ID */ |
172 | int speed, duplex; | 172 | int speed, duplex; |
173 | u8 firmware[4]; | ||
173 | }; | 174 | }; |
174 | 175 | ||
175 | /* NPE message structure */ | 176 | /* NPE message structure */ |
@@ -795,6 +796,45 @@ static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd) | |||
795 | return phy_mii_ioctl(port->phydev, if_mii(req), cmd); | 796 | return phy_mii_ioctl(port->phydev, if_mii(req), cmd); |
796 | } | 797 | } |
797 | 798 | ||
799 | /* ethtool support */ | ||
800 | |||
801 | static void ixp4xx_get_drvinfo(struct net_device *dev, | ||
802 | struct ethtool_drvinfo *info) | ||
803 | { | ||
804 | struct port *port = netdev_priv(dev); | ||
805 | strcpy(info->driver, DRV_NAME); | ||
806 | snprintf(info->fw_version, sizeof(info->fw_version), "%u:%u:%u:%u", | ||
807 | port->firmware[0], port->firmware[1], | ||
808 | port->firmware[2], port->firmware[3]); | ||
809 | strcpy(info->bus_info, "internal"); | ||
810 | } | ||
811 | |||
812 | static int ixp4xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
813 | { | ||
814 | struct port *port = netdev_priv(dev); | ||
815 | return phy_ethtool_gset(port->phydev, cmd); | ||
816 | } | ||
817 | |||
818 | static int ixp4xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
819 | { | ||
820 | struct port *port = netdev_priv(dev); | ||
821 | return phy_ethtool_sset(port->phydev, cmd); | ||
822 | } | ||
823 | |||
824 | static int ixp4xx_nway_reset(struct net_device *dev) | ||
825 | { | ||
826 | struct port *port = netdev_priv(dev); | ||
827 | return phy_start_aneg(port->phydev); | ||
828 | } | ||
829 | |||
830 | static struct ethtool_ops ixp4xx_ethtool_ops = { | ||
831 | .get_drvinfo = ixp4xx_get_drvinfo, | ||
832 | .get_settings = ixp4xx_get_settings, | ||
833 | .set_settings = ixp4xx_set_settings, | ||
834 | .nway_reset = ixp4xx_nway_reset, | ||
835 | .get_link = ethtool_op_get_link, | ||
836 | }; | ||
837 | |||
798 | 838 | ||
799 | static int request_queues(struct port *port) | 839 | static int request_queues(struct port *port) |
800 | { | 840 | { |
@@ -942,6 +982,10 @@ static int eth_open(struct net_device *dev) | |||
942 | npe_name(npe)); | 982 | npe_name(npe)); |
943 | return -EIO; | 983 | return -EIO; |
944 | } | 984 | } |
985 | port->firmware[0] = msg.byte4; | ||
986 | port->firmware[1] = msg.byte5; | ||
987 | port->firmware[2] = msg.byte6; | ||
988 | port->firmware[3] = msg.byte7; | ||
945 | } | 989 | } |
946 | 990 | ||
947 | memset(&msg, 0, sizeof(msg)); | 991 | memset(&msg, 0, sizeof(msg)); |
@@ -1151,6 +1195,7 @@ static int __devinit eth_init_one(struct platform_device *pdev) | |||
1151 | dev->hard_start_xmit = eth_xmit; | 1195 | dev->hard_start_xmit = eth_xmit; |
1152 | dev->stop = eth_close; | 1196 | dev->stop = eth_close; |
1153 | dev->do_ioctl = eth_ioctl; | 1197 | dev->do_ioctl = eth_ioctl; |
1198 | dev->ethtool_ops = &ixp4xx_ethtool_ops; | ||
1154 | dev->set_multicast_list = eth_set_mcast_list; | 1199 | dev->set_multicast_list = eth_set_mcast_list; |
1155 | dev->tx_queue_len = 100; | 1200 | dev->tx_queue_len = 100; |
1156 | 1201 | ||