From patchwork Sun Jan 6 01:38:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 209713 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 1D23D2C0080 for ; Sun, 6 Jan 2013 13:18:52 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755506Ab3AFCSj (ORCPT ); Sat, 5 Jan 2013 21:18:39 -0500 Received: from am1ehsobe001.messaging.microsoft.com ([213.199.154.204]:52199 "EHLO am1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755011Ab3AFCSg (ORCPT ); Sat, 5 Jan 2013 21:18:36 -0500 Received: from mail79-am1-R.bigfish.com (10.3.201.239) by AM1EHSOBE001.bigfish.com (10.3.204.21) with Microsoft SMTP Server id 14.1.225.23; Sun, 6 Jan 2013 02:18:32 +0000 Received: from mail79-am1 (localhost [127.0.0.1]) by mail79-am1-R.bigfish.com (Postfix) with ESMTP id 8391F801C7; Sun, 6 Jan 2013 02:18:32 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1de0h1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839he5bhf0ah107ah11b5h121eh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14afh1504h1537h162dh1631h1758h1155h) Received: from mail79-am1 (localhost.localdomain [127.0.0.1]) by mail79-am1 (MessageSwitch) id 1357438676141179_25108; Sun, 6 Jan 2013 02:17:56 +0000 (UTC) Received: from AM1EHSMHS014.bigfish.com (unknown [10.3.201.249]) by mail79-am1.bigfish.com (Postfix) with ESMTP id 1F33330017E; Sun, 6 Jan 2013 02:17:56 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS014.bigfish.com (10.3.207.152) with Microsoft SMTP Server (TLS) id 14.1.225.23; Sun, 6 Jan 2013 02:17:56 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.318.3; Sun, 6 Jan 2013 02:17:54 +0000 Received: from shlinux1.ap.freescale.net (shlinux1.ap.freescale.net [10.192.225.216]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r062Hp4i009656; Sat, 5 Jan 2013 19:17:52 -0700 Received: by shlinux1.ap.freescale.net (Postfix, from userid 1013) id 83FC81AE0C7; Sun, 6 Jan 2013 09:38:39 +0800 (CST) From: Frank Li To: , , , , , CC: , Frank Li Subject: [PATCH 1/1] net: fec: report correct hardware stamping info to ethtool Date: Sun, 6 Jan 2013 09:38:38 +0800 Message-ID: <1357436318-12425-1-git-send-email-Frank.Li@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.net Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Report correct hardware stamping capibilty by ethtool interface. The v1.0 ptp4l check it. Signed-off-by: Frank Li Acked-by: Richard Cochran --- drivers/net/ethernet/freescale/fec.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index a379319..c713db5 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c @@ -1173,12 +1173,38 @@ static void fec_enet_get_drvinfo(struct net_device *ndev, strcpy(info->bus_info, dev_name(&ndev->dev)); } +static int fec_enet_get_ts_info(struct net_device *ndev, + struct ethtool_ts_info *info) +{ + struct fec_enet_private *fep = netdev_priv(ndev); + int ret; + ret = ethtool_op_get_ts_info(ndev, info); + + if (fep->bufdesc_ex) { + + info->so_timestamping |= SOF_TIMESTAMPING_TX_HARDWARE | + SOF_TIMESTAMPING_RX_HARDWARE | + SOF_TIMESTAMPING_RAW_HARDWARE; + if (fep->ptp_clock) + info->phc_index = ptp_clock_index(fep->ptp_clock); + else + info->phc_index = -1; + + info->tx_types = (1 << HWTSTAMP_TX_OFF) | + (1 << HWTSTAMP_TX_ON); + + info->rx_filters = (1 << HWTSTAMP_FILTER_NONE) | + (1 << HWTSTAMP_FILTER_ALL); + } + return ret; +} + static const struct ethtool_ops fec_enet_ethtool_ops = { .get_settings = fec_enet_get_settings, .set_settings = fec_enet_set_settings, .get_drvinfo = fec_enet_get_drvinfo, .get_link = ethtool_op_get_link, - .get_ts_info = ethtool_op_get_ts_info, + .get_ts_info = fec_enet_get_ts_info, }; static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)