From patchwork Wed Oct 19 07:35:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 120570 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B0E0DB71BD for ; Wed, 19 Oct 2011 18:36:04 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753364Ab1JSHfg (ORCPT ); Wed, 19 Oct 2011 03:35:36 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:61252 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751142Ab1JSHfe (ORCPT ); Wed, 19 Oct 2011 03:35:34 -0400 Received: by bkbzt19 with SMTP id zt19so1742491bkb.19 for ; Wed, 19 Oct 2011 00:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=AKp1LkuX6x4E2n3KhhYdfA/lbAhvNvsBLPetSvbbHmk=; b=X5pc+lK90ChH7k7A2noTqmJbgdkgV99lqKIwCJ0ebvlA04TOaCNalZTER4aN55XLUd SdIikJlzIbz55na34xHdMX1+V7EutQgsOtzm3yHaxOQ/u9TTrhiv/5Futo75L81SH7+i vJq5IsbBkkkYGNOg130IDqFxxVp5yBxI/0T1w= Received: by 10.204.156.143 with SMTP id x15mr4137265bkw.28.1319009732679; Wed, 19 Oct 2011 00:35:32 -0700 (PDT) Received: from localhost (0x4dd4aed9.adsl.cybercity.dk. [77.212.174.217]) by mx.google.com with ESMTPS id j9sm4844180bkd.2.2011.10.19.00.35.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Oct 2011 00:35:31 -0700 (PDT) From: Ricardo Ribalda Delgado To: davem@davemloft.net, ian.campbell@citrix.com, jeffrey.t.kirsher@intel.com, grant.likely@secretlab.ca, jpirko@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Delgado Subject: [PATCHv2] ll_temac: Add support for ethtool Date: Wed, 19 Oct 2011 09:35:25 +0200 Message-Id: <1319009725-7869-1-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 1.7.7 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch enables the ethtool interface. The implementation is done using the libphy helper functions. --- v2: Fixed propossed by Ben Hutchings - Rebase to net/next - Code Style v1: Add reviewed by Reviewed-by: Grant Likely Signed-off-by: Ricardo Ribalda Delgado --- drivers/net/ethernet/xilinx/ll_temac_main.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 66e3c36..2e90c01 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c @@ -955,6 +955,32 @@ static const struct attribute_group temac_attr_group = { .attrs = temac_device_attrs, }; +/* ethtool support */ +static int temac_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd) +{ + struct temac_local *lp = netdev_priv(ndev); + return phy_ethtool_gset(lp->phy_dev, cmd); +} + +static int temac_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd) +{ + struct temac_local *lp = netdev_priv(ndev); + return phy_ethtool_sset(lp->phy_dev, cmd); +} + +static int temac_nway_reset(struct net_device *ndev) +{ + struct temac_local *lp = netdev_priv(ndev); + return phy_start_aneg(lp->phy_dev); +} + +static const struct ethtool_ops temac_ethtool_ops = { + .get_settings = temac_get_settings, + .set_settings = temac_set_settings, + .nway_reset = temac_nway_reset, + .get_link = ethtool_op_get_link, +}; + static int __devinit temac_of_probe(struct platform_device *op) { struct device_node *np; @@ -976,6 +1002,7 @@ static int __devinit temac_of_probe(struct platform_device *op) ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST; ndev->netdev_ops = &temac_netdev_ops; + ndev->ethtool_ops = &temac_ethtool_ops; #if 0 ndev->features |= NETIF_F_IP_CSUM; /* Can checksum TCP/UDP over IPv4. */ ndev->features |= NETIF_F_HW_CSUM; /* Can checksum all the packets. */