diff options
author | Emeric Vigier <emeric.vigier@savoirfairelinux.com> | 2012-07-09 17:44:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-09 17:47:52 -0400 |
commit | 9fa32e94dc4f08505934b9b015e2dfea9ae18555 (patch) | |
tree | ca84da3f6ce59d28c7e2465922ffef909e2199f9 /drivers | |
parent | 36efc94b1d09e75fc18b400b0fba8220f967fb44 (diff) |
smsc95xx: support ethtool get_regs
Inspired by implementation in smsc911x.c and smsc9420.c
Tested on ARM/pandaboard running android
Signed-off-by: Emeric Vigier <emeric.vigier@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index b1112e753859..05ecf14d6597 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -578,6 +578,35 @@ static int smsc95xx_ethtool_set_eeprom(struct net_device *netdev, | |||
578 | return smsc95xx_write_eeprom(dev, ee->offset, ee->len, data); | 578 | return smsc95xx_write_eeprom(dev, ee->offset, ee->len, data); |
579 | } | 579 | } |
580 | 580 | ||
581 | static int smsc95xx_ethtool_getregslen(struct net_device *netdev) | ||
582 | { | ||
583 | /* all smsc95xx registers */ | ||
584 | return COE_CR - ID_REV + 1; | ||
585 | } | ||
586 | |||
587 | static void | ||
588 | smsc95xx_ethtool_getregs(struct net_device *netdev, struct ethtool_regs *regs, | ||
589 | void *buf) | ||
590 | { | ||
591 | struct usbnet *dev = netdev_priv(netdev); | ||
592 | unsigned int i, j, retval; | ||
593 | u32 *data = buf; | ||
594 | |||
595 | retval = smsc95xx_read_reg(dev, ID_REV, ®s->version); | ||
596 | if (retval < 0) { | ||
597 | netdev_warn(netdev, "REGS: cannot read ID_REV\n"); | ||
598 | return; | ||
599 | } | ||
600 | |||
601 | for (i = ID_REV, j = 0; i <= COE_CR; i += (sizeof(u32)), j++) { | ||
602 | retval = smsc95xx_read_reg(dev, i, &data[j]); | ||
603 | if (retval < 0) { | ||
604 | netdev_warn(netdev, "REGS: cannot read reg[%x]\n", i); | ||
605 | return; | ||
606 | } | ||
607 | } | ||
608 | } | ||
609 | |||
581 | static const struct ethtool_ops smsc95xx_ethtool_ops = { | 610 | static const struct ethtool_ops smsc95xx_ethtool_ops = { |
582 | .get_link = usbnet_get_link, | 611 | .get_link = usbnet_get_link, |
583 | .nway_reset = usbnet_nway_reset, | 612 | .nway_reset = usbnet_nway_reset, |
@@ -589,6 +618,8 @@ static const struct ethtool_ops smsc95xx_ethtool_ops = { | |||
589 | .get_eeprom_len = smsc95xx_ethtool_get_eeprom_len, | 618 | .get_eeprom_len = smsc95xx_ethtool_get_eeprom_len, |
590 | .get_eeprom = smsc95xx_ethtool_get_eeprom, | 619 | .get_eeprom = smsc95xx_ethtool_get_eeprom, |
591 | .set_eeprom = smsc95xx_ethtool_set_eeprom, | 620 | .set_eeprom = smsc95xx_ethtool_set_eeprom, |
621 | .get_regs_len = smsc95xx_ethtool_getregslen, | ||
622 | .get_regs = smsc95xx_ethtool_getregs, | ||
592 | }; | 623 | }; |
593 | 624 | ||
594 | static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) | 625 | static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) |