From: Ondrej Zary <linux@rainbow-software.org>
To: Samuel Chessman <chessman@tux.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/9] tlan: Add ethtool support
Date: Tue, 27 May 2014 23:38:41 +0200 [thread overview]
Message-ID: <1401226727-5508-4-git-send-email-linux@rainbow-software.org> (raw)
In-Reply-To: <1401226727-5508-1-git-send-email-linux@rainbow-software.org>
Add basic ethtool support to tlan driver:
- driver info - link detect (this allows NetworkManager to detect carrier)
- EEPROM read
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
drivers/net/ethernet/ti/tlan.c | 37 +++++++++++++++++++++++++++++++++++++
drivers/net/ethernet/ti/tlan.h | 1 +
2 files changed, 38 insertions(+)
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index c75ad6b..ae9fece 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -779,7 +779,43 @@ static const struct net_device_ops tlan_netdev_ops = {
#endif
};
+static void tlan_get_drvinfo(struct net_device *dev,
+ struct ethtool_drvinfo *info)
+{
+ struct tlan_priv *priv = netdev_priv(dev);
+
+ strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
+ if (priv->pci_dev)
+ strlcpy(info->bus_info, pci_name(priv->pci_dev),
+ sizeof(info->bus_info));
+ else
+ strlcpy(info->bus_info, "EISA", sizeof(info->bus_info));
+ info->eedump_len = TLAN_EEPROM_SIZE;
+}
+
+static int tlan_get_eeprom_len(struct net_device *dev)
+{
+ return TLAN_EEPROM_SIZE;
+}
+static int tlan_get_eeprom(struct net_device *dev,
+ struct ethtool_eeprom *eeprom, u8 *data)
+{
+ int i;
+
+ for (i = 0; i < TLAN_EEPROM_SIZE; i++)
+ if (tlan_ee_read_byte(dev, i, &data[i]))
+ return -EIO;
+
+ return 0;
+}
+
+static const struct ethtool_ops tlan_ethtool_ops = {
+ .get_drvinfo = tlan_get_drvinfo,
+ .get_link = ethtool_op_get_link,
+ .get_eeprom_len = tlan_get_eeprom_len,
+ .get_eeprom = tlan_get_eeprom,
+};
/***************************************************************
* tlan_init
@@ -842,6 +878,7 @@ static int tlan_init(struct net_device *dev)
/* Device methods */
dev->netdev_ops = &tlan_netdev_ops;
+ dev->ethtool_ops = &tlan_ethtool_ops;
dev->watchdog_timeo = TX_TIMEOUT;
return 0;
diff --git a/drivers/net/ethernet/ti/tlan.h b/drivers/net/ethernet/ti/tlan.h
index 4ced905..b6ceeba 100644
--- a/drivers/net/ethernet/ti/tlan.h
+++ b/drivers/net/ethernet/ti/tlan.h
@@ -240,6 +240,7 @@ struct tlan_priv {
#define TLAN_EEPROM_ACK 0
#define TLAN_EEPROM_STOP 1
+#define TLAN_EEPROM_SIZE 256
--
Ondrej Zary
next prev parent reply other threads:[~2014-05-27 21:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 21:38 [PATCH 0/9] tlan: Link handling improvements and Olicom fixes Ondrej Zary
2014-05-27 21:38 ` [PATCH 1/9] tlan: Enable activity LED on Olicom OC-2325 and OC-2326 Ondrej Zary
2014-05-27 21:38 ` [PATCH 2/9] tlan: Enable link monitoring Ondrej Zary
2014-05-27 21:38 ` Ondrej Zary [this message]
2014-05-27 21:38 ` [PATCH 4/9] tlan: Fix MAC address byte order on OC-2325/OC-2326 Ondrej Zary
2014-05-27 21:38 ` [PATCH 5/9] tlan: Restart autonegotiation on link loss Ondrej Zary
2014-05-27 22:29 ` Florian Fainelli
2014-05-28 6:39 ` Ondrej Zary
2014-05-28 17:26 ` Florian Fainelli
2014-05-28 14:08 ` Sergei Shtylyov
2014-05-27 21:38 ` [PATCH 6/9] tlan: Don't scream if no link Ondrej Zary
2014-05-27 21:38 ` [PATCH 7/9] tlan: Make autonegotiation faster Ondrej Zary
2014-05-28 14:11 ` Sergei Shtylyov
2014-05-27 21:38 ` [PATCH 8/9] tlan: Add PHY reset timeout Ondrej Zary
2014-05-27 21:38 ` [PATCH 9/9] tlan: Don't disable internal PHY on cards that use it in 10 Mbps mode Ondrej Zary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401226727-5508-4-git-send-email-linux@rainbow-software.org \
--to=linux@rainbow-software.org \
--cc=chessman@tux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).